pe_to_shellcode - 让PE文件像shellcode一样注入运行

pe_to_shellcode - 让PE文件像shellcode一样注入运行

项目介绍

pe_to_shellcode 是一个开源工具,由@hasherezade@hh86共同开发。它能够将PE(Portable Executable)文件转换成可以在目标进程中像shellcode那样直接注入并执行的格式。这种转换后,PE文件保持其原始结构的同时,添加了反射加载的stub,使得注入更为便捷。

项目技术分析

  • 支持32位和64位PE文件。
  • 转换过程中,会修改PE头以允许从缓冲区开始处执行,如同shellcode一般。
  • 包含基本的PE格式支持,如重定位、导入表和TLS回调函数。

该工具利用反射机制来加载PE文件,通过调整头部信息,确保即使在被当作shellcode注入到其他进程时,仍能正确执行。然而,对于那些依赖更复杂PE特性(如异常处理、延迟加载的导入或MUI文件等)的文件,可能无法成功转换。

应用场景

pe_to_shellcode 在以下场景中特别有用:

  • 安全研究:用于测试代码注入攻击,理解和防御这类威胁。
  • 模拟注入环境:在不实际注入的情况下,验证代码是否能在目标环境中运行。
  • 系统调优:为低级别系统操作创建轻量级PE执行体。

项目特点

  1. 通用性:适用于多种类型的PE文件,包括32位和64位。
  2. 简洁的转换流程:通过简单的命令行接口即可完成转换,无需额外编程。
  3. 完整度:尽管有部分限制,但大多数基础PE结构都能被正确处理。
  4. 兼容性:转换后的PE文件既可以作为shellcode使用,也可继续作为常规PE文件运行。

使用步骤

  1. 运行 pe2shc.exe 并指定要转换的PE文件路径。
  2. 使用与目标应用程序相同位数的 runshc.exe 运行转换后的文件进行校验。
  3. 如果运行正常,转换即告成功,可将其作为shellcode注入。

获取项目

访问GitHub发布页面,下载最新版本,或者使用Git克隆项目(包括所有子模块):

git clone --recursive https://github.com/hasherezade/pe_to_shellcode.git

pe_to_shellcode 提供了一种创新的方式来处理PE文件,不仅简化了shellcode的制作过程,也为深入理解PE文件加载机制提供了工具。如果你在工作或学习中需要处理PE文件,这是一个值得尝试的工具。

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Shellcode Helper v1.62 Coded by TeLeMan (c) 2008-2013 Usage: schelper.exe [options] Options: -i [input file] input file (Default: stdin) -o [output file] output file (Default: stdout) -s input file format (Default: Auto-Detection) -sb input file format is Binary -sp the input file format's parameters -d output file format (Default: C format) -db output file format is Binary -dp the output file format's parameters -search get the start offset by the pattern: e.g. PK\x03\x04 -soff fix the match offset after searching (Default: 0) -off convert the input file from the offset (Default: 0) -len convert the input file with the length (Default: 0 - MAX) -en [encoder] encode shellcode (Default: XorDword) -de [encoder] decode shellcode (Default: Auto-Detection) -ex exclude characters: e.g. 0x00,0x01-0x1F,0xFF (Default: 0x00) -in incude characters only -ep the encoder's parameters -t [pid] execute or inject shellcode into process for testing -td [pid] execute or inject shellcode into process for debugging -stack put shellcode into stack and execute it (ESP is the shellcode start) -noinfo display no normal messages except error messages Available formats: 0 - C 1 - C(HexArray) 2 - Perl 3 - Python 4 - Ruby 5 - JavaScript(Escape) 6 - VBScript(Escape) 7 - Pascal 8 - MASM(Data) 9 - HexDump 10 - BitString 11 - HexString 12 - HexArray(C like) 13 - Base64 14 - Binary 15 - HexString(C like) 16 - HexString(Escape) 17 - HexString(JavaScript,UNICODE) 18 - URI(ISO-8859-1) 19 - XML(PCDATA) 20 - BigNumber 21 - BigNumber(Hex) 22 - BigNumber(BaseX) 23 - FloatPoint 24 - UnixTimestamp 25 - GUID 26 - MASM(ASM) 27 - NASM 28 - YASM(ASM) 29 - FASM(ASM) 30 - JWASM(ASM) 31 - POASM(ASM) 32 - GOASM(ASM) 33 - GNU ASM Available encoders:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

柳旖岭

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值