1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| import requests from base64 import * session = requests.session() from Crypto.Util.strxor import strxor
data = {'username': 'admin', 'password': '90'} url = 'http://xxxx' admin_password = 'sQYbmlM3493UzUR9uL0tHmK3fabMHC8zH90ZxDGzVsiO3df4TOpTXKKZDv9usNKx2BJECyBZiMU6Rs+BIjF9uQ=='
cipher = b64decode(admin_password) iv = cipher[:16] first = cipher[16:32] second = cipher[32:48] last = cipher[48:64] '''最后一位padding就是01或者12,经过验证为12''' # for i in range(0, 17): # tmp = second[:15] + strxor(strxor(bytes([second[15]]), chr(i).encode()), chr(1).encode()) # cookies = {'admin_password': b64encode(iv + first + tmp + last).decode(), # 'session': 'eyJhZG1pbl9wYXNzd29yZCI6IjYzLzZIemZyV2NqUTNsUXBvL0JLd1NBdElZMUdYajBtc3JoS3p3bzBkMXpJN3UyWHRibytsRWtpLzRjUk0xUmdkeHFZWHZDL0VoTFZRVEZiRlVGMnVBPT0iLCJpc2FkbWluIjpmYWxzZX0.YvyQwA.A_cj48Q1jRm6GEnPuxKbi1Ljd9k'} # response = session.post(url, data=data, cookies=cookies) # print(response.text) # print(i)
# flag = '' # for i in range(15, -1, -1): '''避免01的干扰,起始位调到10''' # for j in range(10, 128): # tmp = second[:i] + strxor(strxor(second[i:], chr(j).encode() + flag.encode()), (16-i) * chr(16-i).encode()) # cookies = {'admin_password': b64encode(iv + first + tmp + last).decode(), # 'session': 'eyJhZG1pbl9wYXNzd29yZCI6InNRWWJtbE0zNDkzVXpVUjl1TDB0SG1LM2ZhYk1IQzh6SDkwWnhER3pWc2lPM2RmNFRPcFRYS0taRHY5dXNOS3gyQkpFQ3lCWmlNVTZScytCSWpGOXVRPT0iLCJpc2FkbWluIjpmYWxzZX0.Yvy0SQ.HkXV3V9wa8SFxAwSxOcXTdRFzSg'} # response = session.post(url, data=data, cookies=cookies) # if 'padding error' not in response.text: # flag = chr(j) + flag # print(flag) # break '''1155'''
# flag = '' # for i in range(15, -1, -1): # for j in range(45, 128): # tmp = first[:i] + strxor(strxor(first[i:], chr(j).encode() + flag.encode()), (16-i) * chr(16-i).encode()) # cookies = {'admin_password': b64encode(iv + tmp + second).decode(), # 'session': 'eyJhZG1pbl9wYXNzd29yZCI6IjYzLzZIemZyV2NqUTNsUXBvL0JLd1NBdElZMUdYajBtc3JoS3p3bzBkMXpJN3UyWHRibytsRWtpLzRjUk0xUmdkeHFZWHZDL0VoTFZRVEZiRlVGMnVBPT0iLCJpc2FkbWluIjpmYWxzZX0.YvyQwA.A_cj48Q1jRm6GEnPuxKbi1Ljd9k'} # response = session.post(url, data=data, cookies=cookies) # if 'padding error' not in response.text: # flag = chr(j) + flag # print(flag) # break '''2f-8ae1-ab4526c8''' flag = '' for i in range(15, -1, -1): for j in range(32, 128): tmp = iv[:i] + strxor(strxor(iv[i:], chr(j).encode() + flag.encode()), (16-i) * chr(16-i).encode()) cookies = {'admin_password': b64encode(tmp + first).decode(), 'session': 'eyJhZG1pbl9wYXNzd29yZCI6IjYzLzZIemZyV2NqUTNsUXBvL0JLd1NBdElZMUdYajBtc3JoS3p3bzBkMXpJN3UyWHRibytsRWtpLzRjUk0xUmdkeHFZWHZDL0VoTFZRVEZiRlVGMnVBPT0iLCJpc2FkbWluIjpmYWxzZX0.YvyQwA.A_cj48Q1jRm6GEnPuxKbi1Ljd9k'} response = session.post(url, data=data, cookies=cookies) if 'padding error' not in response.text: flag = chr(j) + flag print(flag) break '''901cf774-a947-4d2f-8ae1-ab4526c81155'''
|