출처 : 미상....
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"
main () {
char buffer[64];
fgets(buffer, 63, stdin);
printf(buffer);
dumpcode((char*)buffer, 96);
}
'List > Shellcode' 카테고리의 다른 글
[mipsel] execve("/bin/sh", [/bin/sh, 0], 0) - 56byte (0) | 2015.01.11 |
---|---|
Basic Shellcode execve(&/bin/sh, [&/bin/sh,0], 0) (25byte) (0) | 2015.01.10 |
port binding shellcode( 210byte) (0) | 2014.09.11 |
setreuid(geteuid(), geteuid()) + execve(/binsh~~) (41byte) (0) | 2014.08.29 |
Port Binding Shellcode && Reverse Binding Shellcode (0) | 2014.07.29 |