吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 5586|回复: 3
收起左侧

[会员申请] 申请会员ID:T584596

[复制链接]
吾爱游客  发表于 2019-5-18 09:03
1、申 请 I D:T584596
2、个人邮箱:584596597@qq.com
3、原创技术文章:实现自动签到获取论坛积分工具

需求背景:为了提高论坛活跃度,很多论坛下载附件需要支付论坛虚拟币。如果论坛开启了签到送虚拟币的功能,下载附件虚拟币不够时,我们可以通过设置计划任务每天签到获取论坛虚拟币。

支持范围:所有开启“每日签到”功能的 Discuz (2.x,3.x)论坛,可通过访问 http://论坛地址/plugin.php?id=dsu_paulsign:sign 检查论坛是否开启该插件

实现语言:C#

实现流程与代码:
1、通过账号密码模拟登录论坛

[C#] 纯文本查看 复制代码
RequestHandler handler = new RequestHandler(); //RequestHandler为请求数据包
handler.Url = txtUrl.Text + "member.php?mod=logging&action=login&loginsubmit=yes&loginhash=Lp6F5&inajax=1";
handler.CharsetSource = "Page";
handler.Charset = Encoding.GetEncoding(Request.GetPageCharset(txtUrl.Text));
handler.Method = "Post";
handler.Data = string.Format("username={0}&password={1}",txtUser.Text,txtPwd.Text);


2、保存登录信息
[C#] 纯文本查看 复制代码
CookieContainer cookies = new CookieContainer(); //登录信息保存容器
HttpWebResponse resp = Request.Execute(handler);
try {
	cookies.Add(resp.Cookies);
}
catch { }
if (Regex.IsMatch(handler.GetHtml(resp), "登录失败", RegexOptions.IgnoreCase)) //检查论坛是否返回登录失败信息
{
	MessageBox.Show("帐号或密码错误");
	return;
}



3、发起签到请求

3.1、先取得签到数据需要的formhash
[C#] 纯文本查看 复制代码
handler.Url = txtUrl.Text + "plugin.php?id=dsu_paulsign:sign";
handler.Method = "Get";
handler.Cookies = cookies; //带上已登录的cookie信息
resp = Request.Execute(handler);
Match match = Regex.Match(handler.GetHtml(resp), @"formhash=(\w{8})", RegexOptions.IgnoreCase);
if (match.Groups.Count != 2)
{
	MessageBox.Show("没有正确获取到formHash!");
	return;
}
string formhash = match.Groups[1].Value;


3.2、如果取得成功,则开始签到
[C#] 纯文本查看 复制代码
handler.Url = txtUrl.Text + "plugin.php?id=dsu_paulsign:sign&operation=qiandao&infloat=1&sign_as=1";
handler.Method = "Post";
handler.Data = string.Format("formhash={0}&qdxq=kx&qdmode=3", formhash);
resp = Request.Execute(handler);
string html = handler.GetHtml(resp);
if (Regex.IsMatch(html, "您今日已经签到,请明天再来"))
{
	labMsg.Text = "您今日已经签到,请明天再来";
}
else {
	labMsg.Text ="恭喜签到成功!";   
}


4、获取积分情况

[C#] 纯文本查看 复制代码
handler.Url = txtUrl.Text + "home.php?mod=spacecp&ac=credit&showcredit=1&inajax=1&ajaxtarget=extcreditmenu_menu";
handler.Method = "Get";
handler.Cookies = cookies; //带上已登录的cookie信息
resp = Request.Execute(handler);
match = Regex.Match(handler.GetHtml(resp), @"(\d+)币", RegexOptions.IgnoreCase); //抓取用户信息内的虚拟币值
if (match.Groups.Count == 2)
{
	string ygb = match.Groups[1].Value;
	string msg = string.Format("您有 (论坛币{0})!",ygb);
	//记录日志
	if (File.Exists(Application.StartupPath + "/log.txt") == false) {
		using (File.Create(Application.StartupPath + "/log.txt")) { }
	}
	using (StreamWriter sw = File.AppendText(Application.StartupPath + "/log.txt")) { 
		sw.WriteLine(string.Format("#{0}# {1}", DateTime.Now, msg));
	}
	labMsg.Text = msg;
}


5、软件截图

画面

画面


日志

日志

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

Hmily 发表于 2019-5-20 11:38
抱歉,未能达到申请要求,申请不通过,可以关注论坛官方微信(吾爱破解论坛),等待开放注册通知。
吾爱游客  发表于 2019-5-20 14:08
不通过原因是什么呢? 因为描述文字太少?是否可以完善后再次申请?

点评

未达到精华贴的要求。  详情 回复 发表于 2019-5-20 15:31
Hmily 发表于 2019-5-20 15:31
游客 124.156.184.x 发表于 2019-5-20 14:08
不通过原因是什么呢? 因为描述文字太少?是否可以完善后再次申请?

未达到精华贴的要求。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-3-29 00:41

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表