string login = ""; // Login
string pass = ""; // Pass
using (var request = new xNet.HttpRequest())
{
request.Cookies = new CookieDictionary();
request.AllowAutoRedirect = false;
request.UserAgent = "VKAndroidApp/4.10.0-1151 (Android 4.4.2; SDK 19; armeabi-v7a; LGE LGM-V300K; ru)";
request.AllowAutoRedirect = false;
request.IgnoreProtocolErrors = true;
string auth = request.Get("https://oauth.vk.com/token?scope=nohttps%2Call&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&2fa_supported=1&lang=ru&device_id=&grant_type=password&username=" + login + "&password=" + pass + "&libverify_support=1").ToString();
File.AppendAllText("1.txt", auth);
if (auth.Contains("access_token"))
{
string access_token = Pars(auth, "access_token\":\"", "\"", 0);
string user_id = Pars(auth, "user_id\":", ",\"", 0);
string secret = Pars(auth, "secret\":\"", "\"", 0);
string sig = GetMd5Hash(MD5.Create(), "execute.getFriendsAndLists" + secret);
string friend_get = request.Get("https://api.vk.com/method/execute.getFriendsAndLists?access_token=" + access_token + "&sig=" + sig).ToString();
txtLog.Text = friend_get;
}
else if (auth.Contains("username_or_password_is_incorrect"))
{
MessageBox.Show("Bad");
}
else
{
MessageBox.Show("Error");
}
public static string GetMd5Hash(MD5 md5Hash, string input)
{
byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
return sBuilder.ToString();
}
sig = md5("api_id={api_id}method=friends.getrandom={random}timestamp={timestamp}user_id={user_id}{app_secret}")
url = "https://api.vkontakte.ru/api.php?api_id={api_id}&method=friends.get&random={random}×tamp={timestamp}&sig={sig}&user_id={user_id}"
api_id=2274003method=friends.getrandom=454905timestamp=1547208095user_id=421620512hHbZxrka2uZ6jB1inYsH
95513c4177ae86f08ea40e9e0ef2797b