吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 13261|回复: 10
收起左侧

[IDA Plugin] Keypatch is a IDA Pro plugin for Keystone Assembler Engine

[复制链接]
风吹屁屁凉 发表于 2016-8-5 09:47
Keypatch 工具发布了,是个基于 Keystone 的 IDA Pro 汇编引擎插件

Keypatch
Keypatch is a IDA Pro plugin for Keystone Assembler Engine. See this introduction for the motivation behind this tool.
Keypatch v1.0 is available from our Github repo.
Keypatch consists of 2 tools inside.
  • Patcher: this allows you to type in assembly to directly patch your binary.
  • Assembler: this interactive tool let you enter assembly & get back instruction encoding.
Keypatch is confirmed to work on IDA Pro version 6.4, 6.8 & 6.9, but should work flawlessly on older versions. If you find any issues, please report.

1. Why Keypatch?
Sometimes we want to patch the binary while analyzing it in IDA, but unfortunately the built-in asssembler of IDA Pro is not adequate.
  • Only X86 assembler is available. Support for all other architectures is totally missing.
  • The X86 assembler is buggy and fails to understand many modern Intel instructions.
  • This tool is not friendly and without many options that would make the life of reverser easier.
Keypatch was developed to solve this problem. Thanks to the power of Keystone, our plugin offers some nice features.
  • More friendly & easier to use.
  • Cross-architecture: support Arm, Arm64 (AArch64/Armv8), Hexagon, Mips, PowerPC, Sparc, SystemZ & X86 (include 16/32/64bit).
  • Cross-platform: work everywhere that IDA works, which is on Windows, MacOS, Linux.
  • Based on Python, so it is easy to install as no compilation is needed.
  • Open source under GPL v2.
Keypatch can be the missing piece in your toolset of reverse engineering.

2. Install
  • Keypatch requires Keystone, so you have to install Keystone core & Python binding for Python 2.7 from keystone-engine.org/download. Or follow the steps in the appendix section.
  • Copy file keypatch.py to IDA Plugin folder, then restart IDA Pro to use Keypatch.

    • On Windows, the folder is at C:\Program Files (x86)\IDA 6.9\plugins
    • On MacOS, the folder is at /Applications/IDA\ Pro\ 6.9/idaq.app/Contents/MacOS/plugins
    • On Linux, the folder may be at /opt/IDA/plugins/

NOTE - On Windows, if you get an error message from IDA about “fail to load the dynamic library”, then your machine may miss the VC++ runtime library. Fix that by downloading & installing it from https://www.microsoft.com/en-gb/download/details.aspx?id=40784 - On other *nix platforms, the above error message means you do not have 32-bit Keystone installed yet. See appendix section below for more instructions to fix this.

3. Usage
  • To patch your binary, press hotkey CTRL+ALT+K inside IDA to open Keypatch Patcher dialog.
    • The original assembly, encode & instruction size will be displayed in 3 controls at the top part of the form.
    • Choose the syntax, type new assembly instruction in the Assembly box (you can use IDA symbols).
    • Keypatch would automatically update the encoding in the Encode box while you are typing, without waiting for ENTER keystroke.
      • Note that you can type IDA symbols, and the raw assembly will be displayed in the Fixupcontrol.
    • Press ENTER or click Patch to overwrite the current instruction with the new code, thenautomatically advance to the the next instruction.
      • Note that when the new code is shorter than the original code, the extra bytes will be filled in with NOPs by default. Uncheck the choice Padding extra bytes with NOPs if this is not desired.
    • By default, the modification you made is only recorded in the IDA database. To apply these changes to the original binary (thus overwrite it), choose menu Edit | Patch program | Apply patches to input file.

  • To do some code assembling (without overwritting binary), open Keypatch Assembler from menuEdit | Keypatch | Assembler.
    • Choose the architecture, address, endian mode & syntax, then type assembly instruction in theAssembly box.
    • Keypatch would automatically update the encoding in the Encode box while you are typing, without waiting for ENTER keystroke.


4. Contact
Email keystone.engine@gmail.com for any questions.
For future update of Keypatch, follow our Twitter @keystone_engine for announcement.

Appendix. Install Keystone for IDA Pro
IDA Pro’s Python is 32-bit itself, so it can only loads 32-bit libraries. For this reason, we have to build & install Keystone 32-bit. This section details the steps towards that goal.
A1. Windows
It is easiest to just download & install Python 2.7 module for Windows from http://www.keystone-engine.org/download. Be sure to get the 32-bit version, regardless of your Windows edition.
If you prefer to compile from source, just use MSVC 32-bit & follow the instructions in Windows documentation to build keystone.dll. After that, install Python module as in Python documentation. Then copy keystone.dll to the directory of Keystone Python module.
A2. MacOS
Since version 0.9.1, by default Keystone is built in universal format, so you just need to follow the instruction in Unix documentation to compile & install it. After that, install Python module as in Python documentation.
In short, you can simply run the following commands in the source directory of Keystone to do all the above.
$ mkdir build$ cd build$ ../make-share.sh$ sudo make install$ cd bindings/python$ sudo make installA3. Linux
If your system is Linux 32-bit, you can do the same steps as in MacOS above.
In case you are on 64-bit Linux, you need to cross compile Keystone to 32-bit. Since version 0.9.1, Keystone supports lib32 option to make this easy. After building the core, install Python module as inPython documentation.
Note that to cross-compile on Linux, you need to install some multilib libraries. For example, on Ubuntu 14.04 64-bit, do this with:
$ sudo apt-get install lib32stdc++-4.8-dev libc6-dev-i386
After having multilib dependencies, run the following commands in the source directory of Keystone.
$ mkdir build$ cd build$ ../make-share.sh lib32 lib_only$ cd bindings/python$ sudo make install
Finally, copy the 32-bit binaries at build/llvm/lib/libkeystone.so.* to the Python directory of IDA Pro, for example at /opt/IDAPro6.4/python/.
Done? Now go back to section 2 & install Keypatch for IDA Pro. Enjoy!

http://www.keystone-engine.org/keypatch/

https://github.com/keystone-engine/keypatch

keypatch-2.1.zip

1.35 MB, 下载次数: 168, 下载积分: 吾爱币 -1 CB

免费评分

参与人数 5热心值 +5 收起 理由
燃香小狼 + 1 多谢,还不会用IDA。。。
苏紫方璇 + 1 我很赞同!
lies2014 + 1 谢谢@Thanks!
gjianbo + 1 谢谢@Thanks!
wnagzihxain + 1

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

lies2014 发表于 2016-8-5 10:41
这个插件太实用了,IDA可以直接补丁了,不明白为何IDA一直不实现这个功能
苏紫方璇 发表于 2016-8-5 13:29
峰值飘逸 发表于 2016-8-6 08:13
a310115869 发表于 2016-8-9 00:54
谢谢分享
clf 发表于 2016-9-21 21:25
不错,挺方便的
fedfsf 发表于 2016-10-6 21:26

不错,挺方便的。谢谢分享
0xC4m3l 发表于 2019-6-28 15:18
请问为什么 我装了 东西 但是 edit 里面没有 keypatch 这个选项啊?

点评

keystone-engine装没?  详情 回复 发表于 2019-6-28 18:00
A-new 发表于 2019-6-28 18:00
0xC4m3l 发表于 2019-6-28 15:18
请问为什么 我装了 东西 但是 edit 里面没有 keypatch 这个选项啊?

keystone-engine装没?
0xC4m3l 发表于 2019-6-29 00:22
A-new 发表于 2019-6-28 18:00
keystone-engine装没?

都是按着教程装的 但是没有 Keypatch 的显示 用 别人的有 keypatch 的也没显示
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-16 22:36

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表