Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4879
  • 博文数量: 1
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 20
  • 用 户 组: 普通用户
  • 注册时间: 2013-06-13 02:36
文章分类
文章存档

2014年(1)

我的朋友
最近访客

分类: BSD

2014-06-06 17:38:08

去简单花指令的IDC脚本






发明手改花指令太无聊,于是简略学了下IDC,感到不爽,但是为了略微节俭些膂力,仍是硬着头皮写了一个,可能有bug,能改的花指令也很有限,我只为了敷衍我遇到的情形,有跟我同样情况的能够直接用,后果应当还行,然而做的不完整,只是把一些无用的花指令调换成0x90,不从新剖析,假如遇到IDA提醒红字的处所,按D再按C,呵呵.

代码:

#include idc.idc


static matchBytes(StartAddr, Match)

auto Len, i, PatSub, SrcSub;
Len strlen(Match);

while (i Len)

PatSub substr(Match, i, i+1);
SrcSub form("02X", Byte(StartAddr));
SrcSub substr(SrcSub, i 2, (i 2) + 1);

if (PatSub ! ""
return 0;


if (i 2 1)

StartAddr++;

i++;


return 1;



static main()

auto StartVa, SavedStartVa, StopVa, Size, i, j;

StartVa 0x000102A0;
StopVa 0x000120A0;

Size StopVa StartVa;
SavedStartVa StartVa;

for (i 0; i Size; i++)

// 0F 82 07 00 00 00 0F 83 01 00 00 00
// jz xxxx + jnz xxxx + 0xE8
// 0F 84 07 00 00 00 0F 85 01 00 00 00 E8
// jo xxxx + jno xxxx + 0xE8
// 0F 80 07 00 00 00 0F 81 01 00 00 00 E8
// js xxxx + jns xxxx + 0xE8
// 0F 88 07 00 00 00 0F 89 01 00 00 00 E8
if (matchBytes(StartVa, "0F8070000000F801000000E8"))

for (j 0; j 13; j++)

PatchByte(StartVa, 0x90);
MakeCode(StartVa);
StartVa++;



// jb short near xxxx + jnb short near xxxx + 0xE8
// 72 03 73 01 E8
// jo short near xxxx + jno short near xxxx + 0xE8
// 70 03 71 01 E8
// jz short near xxxx + jnz short near xxxx + 0xE8
// 74 03 75 01 E8
if (matchBytes(StartVa, "703701E8"))

for (j 0; j 5; j++)

PatchByte(StartVa, 0x90);
MakeCode(StartVa);
StartVa++;



StartVa++;


AnalyzeArea(SavedStartVa, StopVa);
Message("Clear FakeJmp Opcode Ok\n");



阅读(3170) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~