私は初心者ですし、蒸気にログインしようとしたとき、私は問題が発生しました:C#スチームWebRequests
public Steam(string password, string login)
{
Password = password;
Login = login;
_client.DefaultRequestHeaders.Add("User-Agent",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36");
_rsa = new RSACryptoServiceProvider();
_rsaParameters = new RSAParameters();
_params = new Dictionary<string, string>();
}
public async Task GetRsa()
{
var request = await _client.GetAsync($"https://steamcommunity.com/login/getrsakey?username=" + Login);
var content = await request.Content.ReadAsStringAsync();
Timestamp = content.Between("timestamp\":\"", "\"", StringComparison.InvariantCulture);
TokenGid = content.Between("token_gid\":\"", "\"", StringComparison.InvariantCulture);
Mod = content.Between("publickey_mod\":\"", "\"", StringComparison.InvariantCulture);
Exp = content.Between("publickey_exp\":\"", "\"", StringComparison.InvariantCulture);
_rsaParameters.Modulus = HexToByte(Mod);
_rsaParameters.Exponent = HexToByte(Exp);
_rsa.ImportParameters(_rsaParameters);
var bytePassword = Encoding.ASCII.GetBytes(Password);
var encodedPassword = _rsa.Encrypt(bytePassword, false);
EncryptedBase64Password = Convert.ToBase64String(encodedPassword);
}
public async Task TryLogin()
{
var unixTimestamp = (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
//_params["donotcache"] = unixTimestamp + "000";
_params["username"] = Login;
_params["password"] = EncryptedBase64Password;
_params["twofactorcode"] = "";
_params["emailauth"] = "";
_params["loginfriendlyname"] = "";
_params["captchagid"] = "-1";
_params["captcha_text"] = "";
_params["emailsteamid"] = "";
_params["rsatimestamp"] = Timestamp;
_params["remember_login"] = "false";
var responce2 = await _client.PostAsync($"https://steamcommunity.com/login/dologin/", new FormUrlEncodedContent(_params));
var content2 = await responce2.Content.ReadAsStringAsync();
}
私はこの答えを得る:
"success":false,"requires_twofactor":false,"message":"The account name or password that you have entered is incorrect.","clear_password_field":true,"captcha_needed":false,"captcha_gid":-1
をそしてここで私は理解していません私の間違い。たぶん私のRSA暗号が間違っているか、クッキーに何らかの問題があるかもしれません。
に役立ちます願っています。少なくとも変換の前に。 – Zmey