http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Lectures&no=1217 [º¹»ç]
#include <stdio.h>
/*
¹ÙÀ̳ʸ® ÆÄÀÏÀÇ ³»¿äÀ» Ç¥½ÃÇÏ´Â ÇÁ·Î±×·¥ÀÎ "dump"¸¦ ÀÛ¼º.
dev-c ¿¡¼ Å×½ºÆà ¿Ï·á
±Ã±ÝÇÑÁ¡Àº ihonest@naver.com À̳ª
ÇØÄð ¾ÆÀ̵ð·Î ÂÊÁö ³¯·ÁÁּſä
»ç¿ë¹ýÀº ¸¸¾à ¹ÙÀ̳ʸ®ÇÒ ÆÄÀϸíÀÌ aa ¶ó¸é
dump.exe aaÀÌ·±½ÄÀ¸·Î Ä¡¹È µÊ
*/
int main(int argc, char* argv[])
{
FILE *fp;
unsigned char buf[16];
unsigned long addr = 0;
int readnum, i;
if(argc <= 1) {
printf("usage: dump filename\n");
return 1;
}
if (!(fp = fopen(argv[1], "rb"))) {
printf("ÆÄÀÏÀ» ¿Áö ¸øÇß½À´Ï´Ù.\n");
return 1;
}
while(1) {
printf("%08X", addr);
readnum = fread(buf, 1, 16, fp);
for(i = 0; i < readnum; i++) {
if(i == 8)
printf(" ");
printf("02X ", buf[i]);
}
for(i = readnum; i < 16; i++) {
if(i == 8)
printf(" ");
printf(" ");
}
printf(" ");
for(i = 0; i < readnum; i++)
printf("%c", (32<=buf[i]&&buf[i] <=126) ? buf[i] : '.');
printf("\n");
addr += 16;
if(feof(fp))
break;
}
fclose(fp);
return 0;
}
|
Hit : 7935 Date : 2009/04/25 12:33
|