加密与解密第三章:IDA的基本操作

IDA编辑二进制代码

edit->patch program
加密与解密第三章:IDA的基本操作

参考:https://blog.csdn.net/hgy413/article/details/50650232

IDA打开应用程序时,会为其创建一个数据库,后缀为IDB。IDB由4个文件组成:

后缀为id0的二叉树形式的数据库,
后缀为id1的程序字节标识,
后缀为nam的Named窗口的索引信息,
后缀为til的给定数据库的本地类型定义的相关信息。

加密与解密第三章:IDA的基本操作

更改数据为结构体和枚举类型

查看输入和输出的idc脚本

#include <idc.idc>

static GetImportSeg()
{
    auto ea, next, name;
    ea = FirstSeg();
    next = ea;
    while ( (next = NextSeg(next)) != -1) {
        name = SegName(next);
        if ( substr( name, 0, 6 ) == ".idata" ) break;
   }
   return next;
}

static main()
{
    auto BytePtr, EndImports;
    BytePtr = SegStart( GetImportSeg() );
    EndImports = SegEnd( BytePtr );
    Message(" \n" + "Parsing Import Table...\n");
    while ( BytePtr < EndImports ) {
        if (LineA(BytePtr, 1) != "") Message("\n" + "____" + LineA(BytePtr,1) + "____" + "\n");
        Message(Name(BytePtr) + "\n");
        BytePtr = NextAddr(BytePtr);
    }
    Message("\n" + "Import Table Parsing Complete\n");
}
//exports.idc 
//(c)  www.PEDIY.com 2000-2008

#include <idc.idc>

static main()
{
    auto x, ord, ea;
    Message("\n Program Entry Points: \n \n");
    for ( x=0; x<= GetEntryPointQty(); x = x+1){  //GetEntryPointQty()得到入口点个数
        ord =  GetEntryOrdinal( x );          //得到该入口点的序列数
        ea = GetEntryPoint( ord );
        Message( Name( ea ) + ":  Ordinal " + ltoa( ord,16 ) + " at offset " + ltoa( ea, 16) + "\n");
    }
    Message("\n" + "Export Parsing Complete\n");
}

解密self modify code

idc文件如下:

//encrypted.idc
//(c)  www.PEDIY.com 2000-2008

#include <idc.idc>
static decrypt(from, size, key ) { 
   auto i, x; 
   for ( i=0; i < size; i=i+1 ) { 
      x = Byte(from); 
      x = (x^key); 
      PatchByte(from,x); 
      from = from + 1;
   } 

} 
static main() { 
decrypt(0x00401060,0x15,0x1);
} 

如果遇到ida未识别十六进制数据,直接强转为代码即可。

FLIRT

能使IDA能在一系列编译器的标准库里自动找出调用的函数

用法打开如下 signatures

加密与解密第三章:IDA的基本操作

导入我们想加载的库的签名文件
加密与解密第三章:IDA的基本操作

之后函数就出来了
加密与解密第三章:IDA的基本操作

转载于:https://blog.51cto.com/10509896/2139515

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值