시스템 해킹

 1576, 1/79 회원가입  로그인  
   yelohair354
   시스템 해킹 Linux 초보에서 dump코드에서 막혀서 질문드립니다 ㅠ

http://www.hackerschool.org/HS_Boards/zboard.php?AllArticle=true&no=1747 [복사]


덤프코드를 똑같이해서 해더파일 추가를 시켯는데 실행이 안되서

어떻게 올려야되는지 질문드립니다 ㅠㅠ

void printchar(unsigned char c)
{
    if(isprint(c))
        printf("%c",c);
    else
        printf(".");
}

void dumpcode(unsigned char* buff, int len)
{
    int i;
    for(i=0 ; i<len ; i++){
        if(i%16 == 0)
            printf("0x%08x", &buff[i]);

        printf("%02x", buff[i]);

        if(i%16-15 == 0){
            int j;
            printf(" ");
            for(j=i-15 ; j<=i ; j++)
                printchar(buff[j]);
            printf("\n");
        }
    }

    if (i%16 != 0){
        int j;
        int spaces=(len-i+16-i%16)*3+2;
        for(j=0 ; j<spaces ; j++)
            printf(" ");
        for(j=i-i%16;j<len;j++)
            printchar(buff[j]);
    }
    printf("\n");
}


이렇게 넣구요 ㅠㅠ

예제 실행 파일을



#include<stdio.h>

#include “dumpcode.h”
int main()
{
int i;
char str[20] = “hackerschool!”;
printf(“%s\n”, str);
dumpcode((unsigned char *)&str, 100);
}



이렇게 저장하고



gcc -o dumpcodetest dumpcodetest.c



이렇게 컴파일을 실행했습니다

그랫더니..

gcc: dumpcodetest: No such file or directory
In file included from dumpcodetest.c:2:
/usr/include/dumcode.h: In function 'dumpcode' :
/usr/include/dumcode.h: 20:parse error before '}' token
/usr/include/dumcode.h:  At top level
/usr/include/dumcode.h: 27:parse error before '}' token
/usr/include/dumcode.h: 32:'len' undeclared here (not in a function)
/usr/include/dumcode.h: 32:'i' undeclared here (not in a function)
/usr/include/dumcode.h: 32:'i' undeclared here (not in a function)
/usr/include/dumcode.h: 33: parse error before "for"
/usr/include/dumcode.h: 38: parse error befor string constant

이런 오류가 납니다 ㅠㅠ.. 변수 선언은 되있는데 왜 오류가 나는지 이해가 않되요 ㅠㅠ

어떻게 해야 예제가 실행이 될까요..ㅠ..?

  Hit : 4701     Date : 2014/03/31 01:18



    
kumi123 /usr/include

디렉토리의 정확히 넣으셧나 확인해보세요
2014/04/02