【おまいら】新種のキンタマウイルスが猛威をふるっています【気を付けろよ】

このエントリーをはてなブックマークに追加
42キンタマ判別ソフト ◆IyECH9THjE
捏造か本物かを判定するヤツ。ライセンスはGPLね。
gccで動作確認済み

/* kintamacheck.c written by IyECH9THjE License: GPLv2*/
#include <stdio.h>
const char kintamahead[] = {
'\xff','\xd8','\xff','\xe0','\x00','\x10','\x4a','\x46','\x49','\x46','\x00','\x01','\x01','\x00','\x00','\x01',
'\x00','\x01','\x00','\x00','\xff','\xdb','\x00','\x43','\x00','\x03','\x02','\x02','\x03','\x02','\x02','\x03',
'\x03','\x03','\x03','\x04','\x03','\x03','\x04','\x05','\x08','\x05','\x05','\x04','\x04','\x05','\x0a','\x07',
'\x07','\x06','\x08','\x0c','\x0a','\x0c','\x0c','\x0b','\x0a','\x0b','\x0b','\x0d','\x0e','\x12','\x10','\x0d',
'\x0e','\x11','\x0e','\x0b','\x0b','\x10','\x16','\x10','\x11','\x13','\x14','\x15','\x15','\x15','\x0c','\x0f',
'\x17','\x18','\x16','\x14','\x18','\x12','\x14','\x15','\x14','\xff','\xdb','\x00','\x43','\x01','\x03','\x04',
'\x04','\x05','\x04','\x05','\x09','\x05','\x05','\x09','\x14','\x0d','\x0b','\x0d','\x14','\x14','\x14','\x14',
'\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14',
'\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14',
'\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\x14','\xff','\xc0',
'\x00','\x11','\x08' };
#define buf_size 6000
int cmp (const char* s1, const char* s2, const int size);
43名無しさん@お腹いっぱい。:04/03/17 18:53 ID:Kyy5C8B/
int main (int argc, char** argv)
{
FILE* fs;
char buf[buf_size];
if (argc != 2) { printf("Usage: kintamacheck <target.jpg>\n"); return -1; }
if (!(fs = fopen(argv[1], "rb"))) { printf("Couldn't open the file\n"); return -2; }
if (!fread(buf, sizeof(kintamahead), 1, fs)) { printf("Couldn't read the file\n"); return -3; }
fclose(fs);
if (!cmp(buf, kintamahead, sizeof(kintamahead)))
{
printf("*NOT* KINTAMA\n");
return 0;
}
printf("KINTAMA\n");
return 1;
}
int cmp (const char* s1, const char* s2, const int size)
{
int i;
for (i=0 ; i<size ; i++)
if (*(s1+i) != *(s2+i))
return 0;
return 1;
}