本文章中所有内容仅供学习交流使用,不用于其他任何目的,严禁用于商业用途和非法用途,否则由此产生的一切后果均与作者无关!
同事王二狗有2个联通号码,但是手机上只能登录一个账号,于是就有了接下来的分析。
掏出Charles抓包,如图,只有2个参数是加密的,mobile和password

在IDA中搜索mobile

这就直接终结了!!!
两个参数全在这里,相同算法相同密钥!!!
边分析边写帖子,这突然就结束了。
由千问老师赞助
总结本次分析难度较低,已经分析了,就发出来吧。
import secrets
import string
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5
import base64
def random_string_with_length(length):
characters = string.ascii_letters + string.digits
return ''.join(secrets.choice(characters) for _ in range(length))
def rsa_encrypt_with_public_key(data_str, public_key_str):
public_key = RSA.import_key(public_key_str)
cipher_rsa = PKCS1_v1_5.new(public_key)
data_bytes = data_str.encode('utf-8')
encrypted_bytes = cipher_rsa.encrypt(data_bytes)
encrypted_b64_str = base64.b64encode(encrypted_bytes).decode('utf-8')
return encrypted_b64_str
def prepare_login_info(username, password):
password_salt = random_string_with_length(6)
salted_password = password + password_salt
encrypted_password = rsa_encrypt_with_public_key(salted_password, PUBLIC_KEY)
username_salt = random_string_with_length(6)
salted_username = username + username_salt
encrypted_username = rsa_encrypt_with_public_key(salted_username, PUBLIC_KEY)
login_info_dict = {
"keyVersion": "2",
"mobile": encrypted_username,
"password": encrypted_password,
"loginStyle": "0"
}
return login_info_dict
PUBLIC_KEY =
if __name__ == "__main__":
my_username = "your_username_here"
my_password = "your_password_here"
result = prepare_login_info(my_username, my_password)
print("Prepared Login Info Dictionary:")
for key, value in result.items():
print(f" {key}: {value}")
print("\n--- Individual Encrypted Values ---")
username_salt = random_string_with_length(6)
password_salt = random_string_with_length(6)
temp_salted_user = my_username + random_string_with_length(6)
temp_salted_pass = my_password + random_string_with_length(6)
final_result = prepare_login_info(my_username, my_password)
print(f"Encrypted Mobile (Username): {final_result['mobile']}")
print(f"Encrypted Password: {final_result['password']}")
import secrets
import string
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5
import base64
def random_string_with_length(length):
characters = string.ascii_letters + string.digits
return ''.join(secrets.choice(characters) for _ in range(length))
def rsa_encrypt_with_public_key(data_str, public_key_str):
public_key = RSA.import_key(public_key_str)
cipher_rsa = PKCS1_v1_5.new(public_key)
data_bytes = data_str.encode('utf-8')
encrypted_bytes = cipher_rsa.encrypt(data_bytes)
encrypted_b64_str = base64.b64encode(encrypted_bytes).decode('utf-8')
return encrypted_b64_str
def prepare_login_info(username, password):
password_salt = random_string_with_length(6)
salted_password = password + password_salt
encrypted_password = rsa_encrypt_with_public_key(salted_password, PUBLIC_KEY)
传播安全知识、拓宽行业人脉——看雪讲师团队等你加入!