110,580
社区成员
发帖
与我相关
我的任务
分享
string result = null;
txtLog.WriteLog("开始注册");
string email = "ipx5gjynbnwc5q@163.com";// getEmail();
string password = Util.CreateRandomCode(6);
if (string.IsNullOrEmpty(email))
{
txtLog.WriteLog("缺少邮箱账号");
}
else
{
WebClient.Encoding = Encoding.GetEncoding(936);
WebClient.Referer = "http://login.sina.com.cn/signup/";
WebClient.Host = "login.sina.com.cn";
result = WebClient.DownloadString("http://login.sina.com.cn/signup/signupmail.php");
WebClient.DownloadData("https://login.sina.com.cn/images/signup/showcolor.png");
MatchCollection matches = Regex.Matches(result, @"([\d\w]{32}|referer|entry|src|type|regtime)"":""(.*?)""", RegexOptions.IgnoreCase);
txtLog.WriteLog("识别验证码");
WebClient.Referer = "https://login.sina.com.cn/signup/signup";
WebClient.Headers["host"] = "login.sina.com.cn";
//下面是识别验证码
string door = Util.RecogniteValidateImage(WebClient.OpenRead("https://login.sina.com.cn/cgi/pin.php?r=" + Util.GetTimeStamp() + "&lang=zh&type=hollow"), picValidate, getValidateCode);
IDictionary<string, string> data = new Dictionary<string, string>();
while (true)
{
if (checkUserName(email)) break;//判断邮箱是否可用
email = getEmail();
if (string.IsNullOrEmpty(email))
{
txtLog.WriteLog("缺少邮箱账号");
break;
}
}
if (!string.IsNullOrEmpty(email))
{
data.Clear();
data.Add("othermail", email);
data.Add("password", password);
data.Add("door", door);
data.Add("arg", "");
data.Add("hobbies[]", "23");
data.Add("mailType", "sina.cn");
data.Add("regtype", "othermail");
data.Add("username", "");
foreach (Match salt in matches)
{
data.Add(salt.Groups[1].Value, salt.Groups[2].Value);
}
if (!data.ContainsKey("r"))
data.Add("r", "");
WebClient.XMLHttpRequest();
WebClient.Referer = "https://login.sina.com.cn/signup/signup";
WebClient.Host = "login.sina.com.cn";
result = WebClient.UploadData("https://login.sina.com.cn/signup/signupflow", data);
i++;
}
}
foreach (Match salt in matches)
{
data.Add(salt.Groups[1].Value, salt.Groups[2].Value);
}
这段代码实现的数据给清空了,看起来应该是盐值,浏览器就果断报“请重新验证验证码”的错了