a hexedit (scoure code)
来源:互联网 发布:用友时空医药软件下载 编辑:程序博客网 时间:2024/05/18 03:17
to write shell code in linux, we always want to see the execute code, so i write a hex edit myself.
the flowing is scoure. (it can only view execute code, can't edit it, but i will add it after, if i have time)
#include <stdio.h>
#define ONCE_READ 16
int main(int argc,char *argv[])
{
int i;
FILE *pfile;
unsigned char buf[ONCE_READ];
int ret = 0x10;
int size = 0;
if(argc<2)
{
printf("two few arguments");
return 0;
}
printf("/n/n");
pfile=fopen(argv[1],"r");
while(1)
{
if(ret == ONCE_READ) printf("%08x ",size);
ret = fread(buf,sizeof(buf[0]),ONCE_READ,pfile);
if(ret == 0)break;
size += ret;
for(i=0;i<ONCE_READ;i++)
{
if(i%4 == 0)
printf(" ");
if(i<ret)
printf("%02x ",buf[i]);
else
printf(" ");
}
printf(" ");
for(i=0;i<ret;i++)
{
if(buf[i]>=33 && buf[i]<=126)
printf("%c",buf[i]);
else printf(".");
}
printf("/n");
}
fclose(pfile);
printf("/n/n total %d byte/n/n",size);
return 0;
}
the flowing is scoure. (it can only view execute code, can't edit it, but i will add it after, if i have time)
#include <stdio.h>
#define ONCE_READ 16
int main(int argc,char *argv[])
{
int i;
FILE *pfile;
unsigned char buf[ONCE_READ];
int ret = 0x10;
int size = 0;
if(argc<2)
{
printf("two few arguments");
return 0;
}
printf("/n/n");
pfile=fopen(argv[1],"r");
while(1)
{
if(ret == ONCE_READ) printf("%08x ",size);
ret = fread(buf,sizeof(buf[0]),ONCE_READ,pfile);
if(ret == 0)break;
size += ret;
for(i=0;i<ONCE_READ;i++)
{
if(i%4 == 0)
printf(" ");
if(i<ret)
printf("%02x ",buf[i]);
else
printf(" ");
}
printf(" ");
for(i=0;i<ret;i++)
{
if(buf[i]>=33 && buf[i]<=126)
printf("%c",buf[i]);
else printf(".");
}
printf("/n");
}
fclose(pfile);
printf("/n/n total %d byte/n/n",size);
return 0;
}
- a hexedit (scoure code)
- HexEdit 3.0
- hexedit使用方法
- C# HexEdit
- HexEdit 十六进制文件编辑器
- Uefi hexedit 源码分析
- HexEdit Linux下命令集
- WTL : add HexEdit to CPaneContainerImpl
- HexEdit 3.0爆破+部份分析
- a clump of code
- A. Phone Code
- aaencode - A Xss Code
- code forces 1A
- code forces 377A
- code forces 505A
- A little code
- 1004: code A + B
- Code Forces 587A
- a
- C/C++中的日期和时间
- 解读prototype(感觉不错,厚颜无耻收藏了:)
- 2006.02.12
- 道是有情却无情 [转]
- a hexedit (scoure code)
- 爱情之所以是爱情
- 释酒言醉
- 醉意元宵
- 新的一年开始了
- Java与C/C++的连动
- Visual C++窗体设计技巧集
- 闹元宵
- 美国历史学习