1
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#include <windows.h>
#include <cstdio>
#define cryptkey 1
char sbuff[MAX_PATH];
char *crypt(char *str)
{
unsigned char i;
unsigned int size;
size = lstrlen(str); //size of str
lstrcpy(sbuff,str); //copy it to sbuff
if (cryptkey && size < MAX_PATH) //if crypt key != 0 and size < MAX_PATH then
{
for (i = 0; i < size; i++) //loop while i < size of str
sbuff[i] = sbuff[i] ^ (cryptkey + (i * (cryptkey % 10) + 1));
//xor curr char with (sum of cryptkey and i) multiplied by (cryptkey
// and 10 remainder) +1
//
}
return sbuff; //return sbuff
}
int main()
{
printf(crypt("dwt+`fdeoe{dbk>r}=a~"));
printf("\n");
printf(crypt("alkiodmm"));
printf("\n");
printf(crypt("jljag6119"));
printf("\n");
printf(crypt("ujjmjw"));
printf("\n");
printf(crypt("alkiodmm {dbk>r}=a~"));
return 1;
}
#include <stdio.h>
#include <string.h>
#include <windows.h>
char szCurTitle[1024],szLastTitle[1024];
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
char* lpCmdLine,
int nCmdShow)
{
// Get title of window
HWND hWnd = GetForegroundWindow(); //get a handle on the current window
GetWindowText (hWnd,szCurTitle,sizeof(szCurTitle));
// Titles were different so update the log file and the last title
printf("%s\n",szCurTitle);
char* str2 = "Google";
char* result = strstr(szCurTitle,str2);
if( result == NULL ) printf( "Could not find '%s' in '%s'\n",str2,szCurTitle);
else printf( "Found a substring: '%s'\n", result );
return 0;
}
/*
* Let's assume that you only want the information printed, that you don't need
* to have it all in memory at once. The program then takes a different turn...
*/
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
/* also ident in <windows.h> too */
typedef struct _FILETIME
{
unsigned int dwLowDateTime;
unsigned int dwHighDateTime;
} FILETIME;
struct TrackRecordHeader
{
unsigned int version; /* version == 0x0000000a */
unsigned int trackRecordCount; /* Number of track records stored in input */
};
void foo(float value, FILE *file)
{
int input, hours, minutes, seconds, milli;
input = value;
hours = input / 3600;
input -= hours * 3600;
minutes = input / 60;
input -= minutes * 60;
seconds = input;
value -= (int)value; /* get rid of integer portion */
milli = value * 1000;
fprintf(file, "time = %02d:%02d.%03d\n", minutes, seconds, milli);
}
int main(int argc, char *argv[])
{
if ( argc > 2 )
{
const char *infilename = argv[1];
const char *outfilename = argv[2];
FILE *input = fopen(infilename, "rb"); /* binary input */
FILE *output = fopen(outfilename, "w"); /* text output */
if ( input )
{
printf("Opened \"%s\".\n", infilename);
if ( output )
{
printf("Opened \"%s\".\n", outfilename);
}
else
{
perror(outfilename);
}
}
else
{
perror(infilename);
}
size_t count;
union /* one of the things that we will be reading */
{
struct TrackRecordHeader header;
char text[128];
wchar_t wtext[128 / sizeof(wchar_t)];
FILETIME dateTime;
float fvalue;
} data;
unsigned int x, length; /* helpers for the things we are reading */
// printf("Opened \"%s\" for input.\n", infilename);
// printf("Outputting to file \"%s\".\n", outfilename);
/*
* Now, let's get to it. Read the header first.
*/
count = fread(&data.header, sizeof data.header, 1, input);
if ( count != 1 )
{
puts("problem with fread of header");
return 0;
}
// printf("version = %u\n", data.header.version);
// printf("records = %u\n", data.header.trackRecordCount);
/*
* We need to loop about the number of records...
*/
length = data.header.trackRecordCount;
for ( x = 0; x < length; ++x )
{
unsigned int y, len; /* text length */
/*
* First part of record: length of the playerName to follow.
*/
count = fread(&len, sizeof len, 1, input);
if ( count != 1 )
{
puts("problem with fread of playerNameLength");
return 0;
}
// printf("playerNameLength = %u\n", len);
/*
* Next item: the wchar text of playerName.
*/
count = fread(data.wtext, len, sizeof *data.wtext, input);
if ( count != sizeof *data.wtext )
{
puts("problem with fread of playerName");
return 0;
}
/*
* The strings in the input, wide or not, are not null terminated.
* Let's just print it the hard way.
*/
fputs("[lap time]\n", output);
// wprintf("playerName = " L"%s\n", data.wtext);
fputs("playerName = ", output);
fputws(data.wtext, output);
fputs("\n", output);
/* fputs("playerName = ", stdout);
fputs("playerName = ", output);
for ( y = 0; y < len; ++y )
{
(void)putw(data.wtext[y], stdout);
(void)putw(data.wtext[y], output);
}
puts("\n"); */
/*
* Next item: the length of the carName to follow.
*/
count = fread(&len, sizeof len, 1, input);
if ( count != 1 )
{
puts("problem with fread of carNameLength");
return 0;
}
// printf("carNameLength = %u\n", len);
/*
* Next item: the char text of carName.
*/
count = fread(data.text, len, sizeof *data.text, input);
if ( count != sizeof *data.text )
{
puts("problem with fread of playerName");
return 0;
}
/*
* The strings in the input, wide or not, are not null terminated.
* Let's just print it the hard way.
*/
// fputs("carName = ", stdout);
fputs("carName = ", output);
for ( y = 0; y < len; ++y )
{
// putc(data.text[y], stdout);
putc(data.text[y], output);
}
// puts("\n");
fputs("\n", output);
/*
* Next item: the time/date stamp.
*/
count = fread(&data.dateTime, sizeof data.dateTime, 1, input);
if ( count != 1 )
{
puts("problem with fread of dateTime");
return 0;
}
/*
* Do something with dateTime if you want.
* I'll just throw it away and continue on.
*/
/*
* Next item: the time.
*/
count = fread(&data.fvalue, sizeof data.fvalue, 1, input);
if ( count != 1 )
{
puts("problem with fread of dateTime");
return 0;
}
// printf("Lap time = %f\n", data.fvalue);
// foo(data.fvalue, stdout);
foo(data.fvalue, output);
// puts("\n");
fputs("\n", output);
}
/*
* Now it's time for the information at the end of the input.
* Apparently, we've got a number of checkpoint times. Find out how many.
*/
count = fread(&length, sizeof length, 1, input);
if ( count != 1 )
{
puts("problem with fread of numberOfCheckpointTimes");
return 0;
}
// printf("numberOfCheckpointTimes = %u\n", length);
/*
* Show each of the checkpoint times.
*/
for ( x = 0; x < length; ++x )
{
/*
* Next item: the checkpointTimes.
*/
count = fread(&data.fvalue, sizeof data.fvalue, 1, input);
if ( count != 1 )
{
puts("problem with fread of checkpointTimes");
return 0;
}
// printf("checkpointTimes = %f\n", data.fvalue);
// foo(data.fvalue, output);
// foo(data.fvalue, stdout);
}
/*
* Clean up and leave.
*/
fclose(input);
fclose(output);
}
return 0;
}
Microsoft has revealed in the advisory that the problem is with the Windows’ TrueType font parsing engine. An attacker who exploits this vulnerability can run their own code in kernel mode and then proceed, unhindered to install programs; modify data; or create new accounts.