A
A
Asprod2021-11-09 18:32:04
Python
Asprod, 2021-11-09 18:32:04

Error with RSA steam?

import sys
from Crypto.Util.number import long2str
sys.path.append(r'E:\anaconda\Lib\site-packages')
import requests
import time
import base64
from Crypto.Cipher import PKCS1_v1_5
import time
from Crypto.PublicKey import RSA

get_rsakey_url = 'https://store.steampowered.com/login/getrsakey/'
login_url = 'https://store.steampowered.com/login/dologin/' 
login_headers = {
    'Referer':'https://store.steampowered.com/login/',
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',
}

req = requests.session()
sign_dict = {'account_incorrect_sign':1,'guard_fail_sign':1}


def get_login_rsakey():
    # После ввода неправильного пароля учетной записи в первый раз он будет установлен на 0, и он должен быть установлен на 1 в начале 
    sign_dict['guard_fail_sign'] = 1                    
    
    username = "username"
    password = "pass"
    
    data = {
    'donotcache':str(int(time.time()*1000)),
    'username':username
    }
    getkey_html = req.post(get_rsakey_url,data=data,headers=login_headers).json()    
    mod = getkey_html.get('publickey_mod')
    exp = getkey_html.get('publickey_exp')
    timestamp = getkey_html.get('timestamp')
    rsa_key = RSA.construct((mod,exp))
    print(rsa_key)
    rsa = PKCS1_v1_5.PKCS115_Cipher(rsa_key) 
    encrypted_password = base64.b64encode(rsa.encrypt(password))
    return username,encrypted_password,timestamp


Traceback (most recent call last):
File "/home/stanph/Desktop/projects/steamphish/autores.py", line 99, in
data = get_login_rsakey()
File "/home/stanph/Desktop/projects/steamphish/ autores.py", line 40, in get_login_rsakey
rsa_key = RSA.construct((mod,exp))
File "/home/stanph/.local/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py" , line 539, in construct
key = self._math.rsa_construct(*tup)
File "/home/stanph/.local/lib/python3.8/site-packages/Crypto/PublicKey/_slowmath.py", line 84, in rsa_construct
assert isinstance(n, int)
AssertionError

I searched on Google and did not find how to fix the error

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question