获取群组锐捷获取ip信息失败败

百度云获取群组信息失效是啥意思_百度知道
百度云获取群组信息失效是啥意思
//zhidao.baidu【◆】【哈搂】【◆】,你可以专门向【百度云网盘-官方客服号】定向提问;opencid=0" target="_blank">http.hiphotos.如果你认为我的解答对解决你的问题有帮助.
其他类似问题
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁获取群组失败是怎么回事?_百度知道
获取群组失败是怎么回事?
获取群组失败是怎么回事?
我有更好的答案
按默认排序
请单独Q群主-百度云网盘,说明你的问题,该问题需要配合官方工程师具体查证原因。请联系百度云问题答疑2群
入群后您好
网络不稳定
其他类似问题
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁C#实现WebQQ协议群发机器人
目前我实现的一些功能包括 &第一次登录 &二次登陆 获取群信息 &获取群好友 发送群消息 发送消息给好友
先给出一些webqq的一些参数吧
psessionid 这个是在第二次登录的时候在 cookie中的一个重要的值,在后面获取群信息,获取好友信息等 都要用到这个参数
vfwebqq 这个同上
ptwebqq 同上
hash &这个参数是后面发送群消息和好友消息需要用到的,以前版本没有 后面加上了
先给出腾讯密码加密算法 &这部分我是用我以前python版本的 比较懒这部分没有转为c#版本的
#md5&&&&&&&def&PCMd5(self,s):&&&&&&&&&&&h=hashlib.md5()&&&&&&&&&&&h.update(s)&&&&&&&&&&&return&h.hexdigest()&&&&&&&#16&to&cgar&&&&&&&def&hex2asc(self,s):&&&&&&&&&&&_str=&&.join(s.split(r'\x'))&&&&&&&&&&&lenlength=len(_str)&&&&&&&&&&&data=''&&&&&&&&&&&for&i&in&range(0,length,2):&&&&&&&&&&&&&&&data+=chr(int(_str[i:i+2],16))&&&&&&&&&&&return&data&&&&&&&#the&password&encrypt&&v1&is&checkcode&&&&&&&def&PasswordSecret(self,password,v1,v2,md5=True):&&&&&&&&&&&if&md5==True:&&&&&&&&&&&&&&&password=self.PCMd5(password).upper()&&&&&&&&&&&lenlength=len(password)&&&&&&&&&&&temp=''&&&&&&&&&&&for&i&in&range(0,length,2):&&&&&&&&&&&&&&&temp+=r'\x'+password[i:i+2]&&&&&&&&&&&return&self.PCMd5(self.PCMd5(self.hex2asc(temp)+self.hex2asc(v2)).upper()+v1).upper()&&&
然后给的是hash算法
///&&summary&&&&&&&&&&&&///&获取hash值的算法&&&&&&&&&&&///&&/summary&&&&&&&&&&&&///&&param&name=&b&&&/param&&&&&&&&&&&&///&&param&name=&j&&&/param&&&&&&&&&&&&///&&returns&&/returns&&&&&&&&&&&&public&string&Hash(string&b,&string&j)&&&&&&&&&&&{&&&&&&&&&&&&&&&string&a&=&j&+&&password&error&;&&&&&&&&&&&&&&&string&i&=&&&;&&&&&&&&&&&&&&&List&int&&E&=&new&List&int&();&&&&&&&&&&&&&&&while(true)&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&if&(i.Length&&=&a.Length)&&&&&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&&&&&i&+=&b;&&&&&&&&&&&&&&&&&&&&&&&if&(i.Length&==&a.Length)&&&&&&&&&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&&&&else&&&&&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&&&&&ii&=&i.Substring(0,&a.Length);&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&for&(int&c&=&0;&c&&&i.Length;&c++)&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&int&tmp&=&(char)i[c]&^&(char)a[c];&&&&&&&&&&&&&&&&&&&E.Add(tmp);&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&string[]&seed&=&{&0&,&&1&,&&2&,&&3&,&&4&,&&5&,&&6&,&&7&,&&8&,&&9&,&&A&,&&B&,&&C&,&&D&,&&E&,&&F&};&&&&&&&&&&&&&&&i&=&&&;&&&&&&&&&&&&&&&for&(int&c&=&0;&c&&&E.Count;&c++)&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&i&+=&seed[E[c]&&&&4&&&15];&&&&&&&&&&&&&&&&&&&i&+=&seed[E[c]&&&15];&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&&&return&i;&&&&&&&&&&&}&&&
这个函数的参数是 第一个是你的qq号 第二个是ptwebqq 之前一直以为是vfwebqq 结果一直出错
&这两个函数都是正确的,网上很多的方法已经失效了
首先在登录时,你必须检查是否需要输入验证码 这个函数的返回值是一个字符串
ptui_checkVC('0','!NTZ','\x00\x00\x00\x00\x22\x79\x9f\x0d',&'ef0e577a4dc9f266a3aa8f3aefff6f498a9a038f032d99f');&
第一个参数是0 表示不需要输入参数,第二个参数是一个验证码 后面用来加密密码的
//检查是否需要&验证码&&&&&&&&&&&public&bool&check()&&&&&&&&&&&{&&&&&&&&&&&&&&&string&url&=&&https://ssl./check?uin={$uin}&appid=1003903&js_ver=10092&js_type=0&login_sig=K5F0E8woS74td4sRIqKiSHmH6B2RYYP467z2r*6YWaH4wc7vE*4G*X7V2kGP9s1*&u1=http%3A%2F%%2Floginproxy.html&r=0.1679&;&&&&&&&&&&&&&&&urlurl&=&url.Replace(&{$uin}&,&this.qq);&&&&&&&&&&&&&&&HttpItem&item&=&new&HttpItem()&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&URL&=&url,//URL&&&&&必需项&&&&&&&&&&&&&&&&&&&&&&&Encoding&=&System.Text.Encoding.GetEncoding(&utf-8&),//URL&&&&&可选项&默认为Get&&&&&&&&&&&&&&&&&&&&&&Method&=&&get&,//URL&&&&&可选项&默认为Get&&&&&&&&&&&&&&&&&&&&&&IsToLower&=&false,//得到的HTML代码是否转成小写&&&&&可选项默认转小写&&&&&&&&&&&&&&&&&&&&&&Timeout&=&100000,//连接超时时间&&&&&可选项默认为100000&&&&&&&&&&&&&&&&&&&&&&&ReadWriteTimeout&=&30000,//写入Post数据超时时间&&&&&可选项默认为30000&&&&&&&&&&&&&&&&&&&&&&UserAgent&=&&Mozilla/5.0&(Windows&NT&6.1;&WOW64;&rv:18.0)&Gecko/&Firefox/18.0&,//用户的浏览器类型,版本,操作系统&&&&&可选项有默认值&&&&&&&&&&&&&&&&&&&&&&ContentType&=&&application/x-www-form-urlencoded&,//返回类型&&&&可选项有默认值&&&&&&&&&&&&&&&&&&&&&&ResultTypeResultType&=&ResultType.String,&&&&&&&&&&&&&&&};&&&&&&&&&&&&&&&HttpResult&result&=&http.GetHtml(item);&&&&&&&&&&&&&&&Regex&reg&=&new&Regex(@&ptui_checkVC\('(.*)','(.*)','(.*)',&'(.*)'\);&);&&&&&&&&&&&&&&&Match&m&=&reg.Match(result.Html);&&&&&&&&&&&&&&&string[]&ret&=&new&string[m.Groups.Count];&&&&&&&&&&&&&&&for&(int&i&=&0;&i&&&m.Groups.Count;&i++)&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&ret[i]&=&m.Groups[i].V&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&this.checkv2&=&ret[3];&&&&&&&&&&&&&&&if&(ret[1]&==&&0&)&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&this.checkcode&=&ret[2];&&&&&&&&&&&&&&&&&&&this.session&=&ret[4];&&&&&&&&&&&&&&&&&&&return&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&else&&&&&&&&&&&&&&&&&&&return&&&&&&&&&&&&}&&&
接下来是我们第一次登录
public&bool&Login()&&&&&&&&&&&{&&&&&&&&&&&&&&&string&url&=&&https://ssl./login?u={$uin}&p={$pwd}&verifycode={$verify}&webqq_type=10&remember_uin=1&login2qq=0&aid==http%3A%2F%%2Floginproxy.html%3Flogin2qq%3D0%26webqq_type%3D10&h=1&ptredirect=0&ptlang=2052&daid=164&from_ui=1&pttype=1&dumy=&fp=loginerroralert&action=2-9-33854&mibao_css=m_webqq&t=1&g=1&js_type=0&js_ver=10092&login_sig=K5F0E8woS74td4sRIqKiSHmH6B2RYYP467z2r*6YWaH4wc7vE*4G*X7V2kGP9s1*&pt_uistyle=5&pt_vcode_v1=0&pt_verifysession_v1={$session}&;&&&&&&&&&&&&&&&urlurl=url.Replace(&{$uin}&,this.qq);&&&&&&&&&&&&&&&urlurl=url.Replace(&{$verify}&,this.checkcode);&&&&&&&&&&&&&&&string&pwd&=&encrypt.Encrypt_Password(this.qq,this.password,this.checkcode);&&&&&&&&&&&&&&&urlurl=url.Replace(&{$pwd}&,pwd);&&&&&&&&&&&&&&&urlurl&=&url.Replace(&{$session}&,&this.session);&&&&&&&&&&&&&&&HttpItem&item&=&new&HttpItem()&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&URL&=&url,&&&&&&&&&&&&&&&&&&&Encoding&=&System.Text.Encoding.GetEncoding(&utf-8&),&&&&&&&&&&&&&&&&&&&&&Method&=&&get&,&&&&&&&&&&&&&&&&&&&IsToLower&=&false,&&&&&&&&&&&&&&&&&&&Timeout&=&100000,&&&&&&&&&&&&&&&&&&&&Referer=&https://ui./cgi-bin/login?daid=164&target=self&style=5&mibao_css=m_webqq&appid=1003903&enable_qlogin=0&no_verifyimg=1&s_url=http%3A%2F%%2Floginproxy.html&f_url=loginerroralert&strong_login=1&login_state=10&t=&,&&&&&&&&&&&&&&&&&&&Host=&d.&,&&&&&&&&&&&&&&&&&&&UserAgent&=&&Mozilla/5.0&(Windows&NT&6.1;&WOW64;&rv:18.0)&Gecko/&Firefox/18.0&,//用户的浏览器类型,版本,&&&&&可选项有默认值&&&&&&&&&&&&&&&&&&&&&&ContentType&=&&application/x-www-form-urlencoded&,&&&&&&&&&&&&&&&&&&&ResultTypeResultType&=&ResultType.String&&&&&&&&&&&&&&&};&&&&&&&&&&&&&&&HttpResult&result&=&http.GetHtml(item);&&&&&&&&&&&&&&&&&&foreach&(Cookie&c&in&result.CookieCollection)&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&if&(c.Name&==&&ptwebqq&)&&&&&&&&&&&&&&&&&&&&&&&this.ptwebqq&=&c.V&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&this.hash=&Hash(this.qq,&this.ptwebqq);&&&&&&&&&&&&&&&&&&Regex&reg&=&new&Regex(@&ptuiCB\('(.*)','(.*)','(.*)','(.*)','(.*)',\s'(.*)'\);&);&&&&&&&&&&&&&&&Match&m&=&reg.Match(result.Html);&&&&&&&&&&&&&&&string[]&ret&=&new&string[m.Groups.Count];&&&&&&&&&&&&&&&for&(int&i&=&0;&i&&&m.Groups.Count;&i++)&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&ret[i]&=&m.Groups[i].V&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&if&(ret[1]&==&&0&)&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&this.proxyurl&=&ret[3];&&&&&&&&&&&&&&&&&&&return&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&else&&&&&&&&&&&&&&&&&&&return&&&&&&&&&&&&&&&&&&&&&&&&&&&}&&&
第一次登录后会返回
return&ptuiCB('0','0','http://ptlogin4./check_sig?pttype=1&uin=&service=login&nodirect=0&ptsig=uV34Xt9XM3e2oQ3wuub8LIBIGsIIZATjiz-cqSVHJ5o_&s_url=http%3A%2F%%2Floginproxy.html%3Flogin2qq%3D0%26webqq_type%3D10&f_url=&ptlang=2052&ptredirect=100&aid=1003903&daid=164&j_later=0&low_login_hour=0&regmaster=0&pt_login_type=1&pt_aid=0&pt_aaid=0&pt_light=0','0','登录成功!',&'你的名字');&
如果第一个参数不是0的话 表示有错,如果像这样的话就表示成功了
返回结果中的那个ur链接我们用get方式打开它,这个步骤是为了获取一个关键的cookie值 p_skey 这个是第二次登录的时候有用
接下来是我们二次登录了
public&void&Login2()&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Dictionary&string,&Object&&r&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&&&r.Add(&status&,&&online&);&&&&&&&&&&&&&&&r.Add(&ptwebqq&,&this.ptwebqq);&&&&&&&&&&&&&&&r.Add(&passwd_sig&,&&&);&&&&&&&&&&&&&&&r.Add(&clientid&,&this.clientid.ToString());&&&&&&&&&&&&&&&r.Add(&psessionid&,&null);&&&&&&&&&&&&&&&Dictionary&string,&Object&&data&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&&&data.Add(&r&,&JsonConvert.SerializeObject(r));&&&&&&&&&&&&&&&data.Add(&clientid&,&this.clientid);&&&&&&&&&&&&&&&data.Add(&psessionid&,&&null&);&&&&&&&&&&&&&&&string&postdata&=&Tool.MakePostData(data);&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//string&postdata=&r=%7B%22status%22%3A%22online%22%2C%22ptwebqq%22%3A%22{$ptwebqq}%22%2C%22passwd_sig%22%3A%22%22%2C%22clientid%22%3A%22{$clientid}%22%2C%22psessionid%22%3Anull%7D&clientid={$clientid}&psessionid=null&;&&&&&&&&&&&&&&&//postdatapostdata=postdata.Replace(&{$ptwebqq}&,this.ptwebqq);&&&&&&&&&&&&&&&//postdatapostdata&=&postdata.Replace(&{$clientid}&,&this.clientid);&&&&&&&&&&&&&&&HttpItem&item&=&new&HttpItem()&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&URL&=&&http://d./channel/login2&,//URL&&&&&必需项&&&&&&&&&&&&&&&&&&&&&&&&Method&=&&POST&,//URL&&&&&可选项&默认为Get&&&&&&&&&&&&&&&&&&&IsToLower&=&false,//得到的HTML代码是否转成小写&&&&&可选项默认转小写&&&&&&&&&&&&&&&&&&&Timeout&=&100000,//连接超时时间&&&&&可选项默认为100000&&&&&&&&&&&&&&&&&&&&&&&Postdata=postdata,&&&&&&&&&&&&&&&&&&&Host=HOST[0],&&&&&&&&&&&&&&&&&&&Referer=REFERER[0],&&&&&&&&&&&&&&&&&&&UserAgent&=&&Mozilla/5.0&(Windows&NT&6.2;&WOW64)&AppleWebKit/537.36&(KHTML,&like&Gecko)&chrome_6494_1.html' target='_blank'&Chrome/34.0.&Safari/537.36&,//用户的浏览器类型,版本,&&&&&可选项有默认值&&&&&&&&&&&&&&&&&&&&&&ContentType&=&&application/x-www-form-urlencoded&,//返回类型&&&&可选项有默认值&&&&&&&&&&&&&&&&&&&Accept=&*/*&,&&&&&&&&&&&&&&&&&&&ResultTypeResultType&=&ResultType.String&&&&&&&&&&&&&&&};&&&&&&&&&&&&&&&HttpResult&result&=&http.GetHtml(item);&&&&&&&&&&&&&&&JObject&obj&=&(JObject)JsonConvert.DeserializeObject(result.Html);&&&&&&&&&&&&&&&this.vfwebqq=&obj[&result&][&vfwebqq&].ToString();&&//&&&&&&&&&&&&&this.psessionid&=&obj[&result&][&psessionid&].ToString();&&&&&&&&&&&&&&}&&&
这个步骤很重要,获取很多有用的cookie值,上面提到的那些就要用一个变量保存下来,以便后面使用
下面我们就要拉去我们的群组信息了
这个返回结果是一个json格式的,我们需要序列化为json对象,把里面的群相关信息存起来
///&&summary&&&&&&&&&&&&///&获取群列表&&&&&&&&&&&///&&/summary&&&&&&&&&&&&public&void&GetGroupNameList()&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Dictionary&string,&Object&&r&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&&&r.Add(&hash&,&this.hash);&&&&&&&&&&&&&&&r.Add(&vfwebqq&,&this.vfwebqq);&&&&&&&&&&&&&&&Dictionary&string,&Object&&data&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&&&data.Add(&r&,&JsonConvert.SerializeObject(r));&&&&&&&&&&&&&&&string&postdata&=&Tool.MakePostData(data);&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//string&postdata&=&&r=%7B%22hash%22%3A%22{$hash}%22%2C%22vfwebqq%22%3A%22{$vfwebqq}%22%7D&;&&&&&&&&&&&&&&&//postdatapostdata&=&postdata.Replace(&{$hash}&,&this.hash);&&&&&&&&&&&&&&&//postdatapostdata&=&postdata.Replace(&{$vfwebqq}&,&this.vfwebqq);&&&&&&&&&&&&&&&HttpItem&item&=&new&HttpItem()&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&URL&=&&http://s./api/get_group_name_list_mask2&,&&&&&&&&&&&&&&&&&&&Method&=&&POST&,&&&&&&&&&&&&&&&&&&&IsToLower&=&false,&&&&&&&&&&&&&&&&&&&Timeout&=&100000,&&&&&&&&&&&&&&&&&&&Postdata&=&postdata,&&&&&&&&&&&&&&&&&&&Host&=&HOST[1],&&&&&&&&&&&&&&&&&&&Referer&=&REFERER[1],&&&&&&&&&&&&&&&&&&&UserAgent&=&&Mozilla/5.0&(Windows&NT&6.2;&WOW64)&AppleWebKit/537.36&(KHTML,&like&Gecko)&Chrome/34.0.&Safari/537.36&,//用户的浏览器类型,版本,&&&&&可选项有默认值&&&&&&&&&&&&&&&&&&&&&&ContentType&=&&application/x-www-form-urlencoded&,&&&&&&&&&&&&&&&&&&&ResultTypeResultType&=&ResultType.String&&&&&&&&&&&&&&&};&&&&&&&&&&&&&&&HttpResult&result&=&http.GetHtml(item);&&&&&&&&&&&&&&&JObject&ret&=&(JObject)JsonConvert.DeserializeObject(result.Html);&&&&&&&&&&&&&&&JObject&retjson&=&(JObject)ret[&result&];&&&&&&&&&&&&&&&foreach&(JToken&jk&in&retjson[&gnamelist&])//获取群信息用&code&&发送群信息用&gid&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&this.grouplist.Add(jk[&gid&].ToString()+&:&+jk[&code&].ToString(),&jk[&name&].ToString());&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&}&&&
每个群 有个gid 和code &name &其中获取群成员的使用code 而向群发送消息的时候用的是gid 这部分一定要注意 我花了很多时间才发现自己的错误
获取某个群的群成员信息 参数就是上面提到的code 不要用错了哦
///&&summary&&&&&&&&&&&&///&根据群code得到群信息&&&&&&&&&&&///&&/summary&&&&&&&&&&&&///&&param&name=&gcode&&&/param&&&&&&&&&&&&public&void&GetGroupInfo(string&gcode)&&&&&&&&&&&{&&&&&&&&&&&&&&&string&url&=&&http://s./api/get_group_info_ext2?gcode={$gcode}&cb=undefined&vfwebqq={$vfwebqq}&t=5&;&&&&&&&&&&&&&&&urlurl=url.Replace(&{$vfwebqq}&,this.vfwebqq);&&&&&&&&&&&&&&&urlurl&=&url.Replace(&{$gcode}&,&gcode);&&&&&&&&&&&&&&&&&&HttpItem&item&=&new&HttpItem()&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&URL&=&url,&&&&&&&&&&&&&&&&&&&Encoding&=&System.Text.Encoding.GetEncoding(&utf-8&),&&&&&&&&&&&&&&&&&&&&Method&=&&get&,&&&&&&&&&&&&&&&&&&&IsToLower&=&false,&&&&&&&&&&&&&&&&&&&&&Timeout&=&100000,&&&&&&&&&&&&&&&&&&&&ReadWriteTimeout&=&30000,&&&&&&&&&&&&&&&&&&&Host=HOST[1],&&&&&&&&&&&&&&&&&&&Referer=REFERER[1],&&&&&&&&&&&&&&&&&&&UserAgent&=&&Mozilla/5.0&(Windows&NT&6.1;&WOW64;&rv:18.0)&Gecko/&Firefox/18.0&,//用户的浏览器类型,版本,&&&&&可选项有默认值&&&&&&&&&&&&&&&&&&&&&&ContentType&=&&application/x-www-form-urlencoded&,&&&&&&&&&&&&&&&&&&&&ResultTypeResultType&=&ResultType.String,&&&&&&&&&&&&&&&};&&&&&&&&&&&&&&&HttpResult&result&=&http.GetHtml(item);&&&&&&&&&&&&&&&JObject&ret&=&(JObject)JsonConvert.DeserializeObject(result.Html);&&&&&&&&&&&&&&&JObject&retjson&=&(JObject)ret[&result&];&&&&&&&&&&&&&&&foreach&(JToken&jk&in&retjson[&cards&])&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&this.groupinfo.Add(jk[&muin&].ToString(),&jk[&card&].ToString());&&&&&&&&&&&&&&&}&&&&&&&&&&&}&&&
下面是向群里面发送消息 &这个用的就是刚才说的 gid 也不要用错了
public&void&SendGroupMsg(long&groupid,string&msg)&&&&&&&&&&&{&&&&&&&&&&&&&&&string&style=&\&{content}\&&;&&&&&&&&&&&&&&&string&temp=&&;&&&&&&&&&&&&&&&temp&+=&style.Replace(&{content}&,&msg)&+&&,&;&&&&&&&&&&&&&&&temptemp&=&temp.Substring(0,&temp.Length&-&1);&&&&&&&&&&&&&&&Random&rd&=&new&Random();&&&&&&&&&&&&&&&int&msg_id&=&(rd.Next(100000)&+&100000);&&&&&&&&&&&&&&&string&content=&[{$msg},\&\&,[\&font\&,{\&name\&:\&宋体\&,\&size\&:\&10\&,\&style\&:[0,0,0],\&color\&:\&000000\&}]]&;&&&&&&&&&&&&&&&contentcontent&=&content.Replace(&{$msg}&,&temp);&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Dictionary&string,&Object&&r&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&&&r.Add(&group_uin&,&groupid);&&&&&&&&&&&&&&&r.Add(&content&,&content);&&&&&&&&&&&&&&&r.Add(&msg_id&,&msg_id);&&&&&&&&&&&&&&&r.Add(&clientid&,&this.clientid);&&&&&&&&&&&&&&&r.Add(&psessionid&,this.psessionid);&&&&&&&&&&&&&&&Dictionary&string,&Object&&data&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&&&data.Add(&r&,&JsonConvert.SerializeObject(r));&&&&&&&&&&&&&&&data.Add(&clientid&,&this.clientid);&&&&&&&&&&&&&&&data.Add(&psessionid&,&this.psessionid);&&&&&&&&&&&&&&&string&postdata&=&Tool.MakePostData(data);&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&HttpItem&item&=&new&HttpItem()&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&URL&=&&http://d./channel/send_qun_msg2&,&&&&&&&&&&&&&&&&&&&Accept=&*/*&,&&&&&&&&&&&&&&&&&&&Method&=&&POST&,&&&&&&&&&&&&&&&&&&&IsToLower&=&false,&&&&&&&&&&&&&&&&&&&KeepAlive=true,&&&&&&&&&&&&&&&&&&&Timeout&=&100000,&&&&&&&&&&&&&&&&&&&Postdata&=&postdata,&&&&&&&&&&&&&&&&&&&Host&=&HOST[0],&&&&&&&&&&&&&&&&&&&Referer&=&REFERER[0],&&&&&&&&&&&&&&&&&&&UserAgent&=&&Mozilla/5.0&(Windows&NT&6.1;&WOW64)&AppleWebKit/537.36&(KHTML,&like&Gecko)&Chrome/37.0.2041.4&Safari/537.36&,&&&&&&&&&&&&&&&&&&&ContentType&=&&application/x-www-form-urlencoded&,&&&&&&&&&&&&&&&&&&&ResultTypeResultType&=&ResultType.String&&&&&&&&&&&&&&&};&&&&&&&&&&&&&&&HttpResult&result&=&http.GetHtml(item);&&&&&&&&&&&&&&&JObject&ret&=&(JObject)JsonConvert.DeserializeObject(result.Html);&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//string&html&=&HttpHelper2.GetHtml(&http://d./channel/send_qun_msg2&,&postdata,HttpHelper.cookies);&&&&&&&&&&&&&&}&&&
上面实现的都是与群操作相关的
接下来是获取好友信息的方法
///&&summary&&&&&&&&&&&&///&获取好友列表信息&&&&&&&&&&&///&&/summary&&&&&&&&&&&&public&void&GetFriendList()&&&&&&&&&&&{&&&&&&&&&&&&&&&Dictionary&string,&Object&&r&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&&&r.Add(&h&,&&hello&);&&&&&&&&&&&&&&&r.Add(&hash&,&this.hash);&&&&&&&&&&&&&&&r.Add(&vfwebqq&,&this.vfwebqq);&&&&&&&&&&&&&&&Dictionary&string,&Object&&data&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&&&data.Add(&r&,&JsonConvert.SerializeObject(r));&&&&&&&&&&&&&&&string&postdata&=&Tool.MakePostData(data);&&&&&&&&&&&&&&&&&&HttpItem&item&=&new&HttpItem()&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&URL&=&&http://s./api/get_user_friends2&,&&&&&&&&&&&&&&&&&&&Method&=&&POST&,&&&&&&&&&&&&&&&&&&&IsToLower&=&false,&&&&&&&&&&&&&&&&&&&Timeout&=&100000,&&&&&&&&&&&&&&&&&&&Postdata&=&postdata,&&&&&&&&&&&&&&&&&&&Host&=&HOST[1],&&&&&&&&&&&&&&&&&&&Referer&=&REFERER[1],&&&&&&&&&&&&&&&&&&&UserAgent&=&&Mozilla/5.0&(Windows&NT&6.2;&WOW64)&AppleWebKit/537.36&(KHTML,&like&Gecko)&Chrome/34.0.&Safari/537.36&,//用户的浏览器类型,版本,&&&&&可选项有默认值&&&&&&&&&&&&&&&&&&&&&&ContentType&=&&application/x-www-form-urlencoded&,&&&&&&&&&&&&&&&&&&&ResultTypeResultType&=&ResultType.String&&&&&&&&&&&&&&&};&&&&&&&&&&&&&&&HttpResult&result&=&http.GetHtml(item);&&&&&&&&&&&&&&&JObject&ret&=&(JObject)JsonConvert.DeserializeObject(result.Html);&&&&&&&&&&&&&&&JObject&retjson&=&(JObject)ret[&result&];&&&&&&&&&&&&&&&//有备注的好友&&&&&&&&&&&&&&&foreach&(JToken&jk&in&retjson[&marknames&])&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&this.friendlist.Add(jk[&uin&].ToString(),&jk[&markname&].ToString());&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&//无备注名的好友&&&&&&&&&&&&&&&foreach&(JToken&jk&in&retjson[&info&])&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&if&(!this.friendlist.ContainsKey(jk[&uin&].ToString()))&&&&&&&&&&&&&&&&&&&&&&&this.friendlist.Add(jk[&uin&].ToString(),&jk[&nick&].ToString());&&&&&&&&&&&&&&&}&&&&&&&&&&&}&&&
这个方法可以获取到好友的信息,分为两部分一部分是有备注名的好友信息,一部分是无备注名的好友信息
把这部分信息保存下来以后有用
获取一个具体好友的信息(自己的信息也是通过这个获取)
public&void&GetFriendInfo(string&tuin)&&&&&&&&&&{&&&&&&&&&&&&&&string&url&=&&http://s./api/get_friend_info2?tuin={$tuin}&verifysession=&code=&vfwebqq={$vfwebqq}&t=4&;&&&&&&&&&&&&&&urlurl&=&url.Replace(&{$vfwebqq}&,&vfwebqq);&&&&&&&&&&&&&&urlurl&=&url.Replace(&{$tuin}&,&tuin);&&&&&&&&&&&&&&&&&HttpItem&item&=&new&HttpItem()&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&URL&=&url,&&&&&&&&&&&&&&&&&&Encoding&=&System.Text.Encoding.GetEncoding(&utf-8&),&&&&&&&&&&&&&&&&&&Method&=&&get&,&&&&&&&&&&&&&&&&&&IsToLower&=&false,&&&&&&&&&&&&&&&&&&Timeout&=&100000,&&&&&&&&&&&&&&&&&&ReadWriteTimeout&=&30000,&&&&&&&&&&&&&&&&&&Host&=&HOST[1],&&&&&&&&&&&&&&&&&&Referer&=&REFERER[1],&&&&&&&&&&&&&&&&&&UserAgent&=&&Mozilla/5.0&(Windows&NT&6.1;&WOW64;&rv:18.0)&Gecko/&Firefox/18.0&,//用户的浏览器类型,版本,&&&&&可选项有默认值&&&&&&&&&&&&&&&&&&&&&ContentType&=&&application/x-www-form-urlencoded&,&&&&&&&&&&&&&&&&&&ResultTypeResultType&=&ResultType.String,&&&&&&&&&&&&&&};&&&&&&&&&&&&&&HttpResult&result&=&http.GetHtml(item);&&&&&&&&&&}&&&
接下来是向某一个好友发送信息
public&void&SendPersonMsg(string&tuin,string&msg)&&&&&&&&&&&{&&&&&&&&&&&&&&&string&style&=&&\&{content}\&&;&&&&&&&&&&&&&&&string&temp&=&&&;&&&&&&&&&&&&&&&temp&+=&style.Replace(&{content}&,&msg)&+&&,&;&&&&&&&&&&&&&&&temptemp&=&temp.Substring(0,&temp.Length&-&1);&&&&&&&&&&&&&&&Random&rd&=&new&Random();&&&&&&&&&&&&&&&int&msg_id&=&(rd.Next(100000)&+&100000);&&&&&&&&&&&&&&&string&content&=&&[{$msg},\&\&,[\&font\&,{\&name\&:\&宋体\&,\&size\&:\&10\&,\&style\&:[0,0,0],\&color\&:\&000000\&}]]&;&&&&&&&&&&&&&&&contentcontent&=&content.Replace(&{$msg}&,&temp);&&&&&&&&&&&&&&&&&&&&&Dictionary&string,&Object&&r&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&&&r.Add(&to&,&tuin);&&&&&&&&&&&&&&&r.Add(&face&,&561);&&&&&&&&&&&&&&&r.Add(&content&,&content);&&&&&&&&&&&&&&&r.Add(&msg_id&,msg_id);&&&&&&&&&&&&&&&r.Add(&clientid&,&this.clientid);&&&&&&&&&&&&&&&r.Add(&psessionid&,&this.psessionid);&&&&&&&&&&&&&&&Dictionary&string,&Object&&data&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&&&data.Add(&r&,&JsonConvert.SerializeObject(r));&&&&&&&&&&&&&&&data.Add(&clientid&,&this.clientid);&&&&&&&&&&&&&&&data.Add(&psessionid&,&this.psessionid);&&&&&&&&&&&&&&&string&postdata&=&Tool.MakePostData(data);&&&&&&&&&&&&&&&&&&HttpItem&item&=&new&HttpItem()&&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&&URL&=&&http://d./channel/send_buddy_msg2&,&&&&&&&&&&&&&&&&&&&Accept&=&&*/*&,&&&&&&&&&&&&&&&&&&&Method&=&&POST&,&&&&&&&&&&&&&&&&&&&IsToLower&=&false,&&&&&&&&&&&&&&&&&&&KeepAlive&=&true,&&&&&&&&&&&&&&&&&&&Timeout&=&100000,&&&&&&&&&&&&&&&&&&&Postdata&=&postdata,&&&&&&&&&&&&&&&&&&&Host&=&HOST[0],&&&&&&&&&&&&&&&&&&&Referer&=&REFERER[0],&&&&&&&&&&&&&&&&&&&UserAgent&=&&Mozilla/5.0&(Windows&NT&6.1;&WOW64)&AppleWebKit/537.36&(KHTML,&like&Gecko)&Chrome/37.0.2041.4&Safari/537.36&,&&&&&&&&&&&&&&&&&&&ContentType&=&&application/x-www-form-urlencoded&,&&&&&&&&&&&&&&&&&&&ResultTypeResultType&=&ResultType.String&&&&&&&&&&&&&&&};&&&&&&&&&&&&&&&&&&HttpResult&result&=&http.GetHtml(item);&&&&&&&&&&&&&&&JObject&ret&=&(JObject)JsonConvert.DeserializeObject(result.Html);&&&&&&&&&&&}&&&
好了,这篇和上一篇文章就基本上实现了WebQQ的基本功能,
为了保持QQ一直在线我们比如一定时间向服务器发送心跳请求,心跳请求的返回值就是我们收到的消息,这个是很重要的所以想对群消息进行处理的话都需要在这里处理它
public&void&HeartBreak()&&&&&&&&&&{&&&&&&&&&&&&&&/*&&&&&&&&&&&&&Dictionary&string,&Object&&r&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&r.Add(&clientid&,&this.clientid);&&&&&&&&&&&&&r.Add(&psessionid&,&this.psessionid);&&&&&&&&&&&&&r.Add(&key&,&0);&&&&&&&&&&&&&r.Add(&ids&,&&[]&);&&&&&&&&&&&&&Dictionary&string,&Object&&data&=&new&Dictionary&string,&Object&();&&&&&&&&&&&&&data.Add(&r&,&JsonConvert.SerializeObject(r));&&&&&&&&&&&&&data.Add(&clientid&,&this.clientid);&&&&&&&&&&&&&data.Add(&psessionid&,&this.psessionid);&&&&&&&&&&&&&string&postdata2&=&Tool.MakePostData(data);&&&&&&&&&&&&&*/&&&&&&&&&&&&&&string&postdata&=&&r=%7B%22clientid%22%3A%22{$clientid}%22%2C%22psessionid%22%3A%22{$psessionid}%22%2C%22key%22%3A0%2C%22ids%22%3A%5B%5D%7D&clientid={$clientid}&psessionid={$psessionid}&;&&&&&&&&&&&&&&postdatapostdata=postdata.Replace(&{$clientid}&,this.clientid);&&&&&&&&&&&&&&postdatapostdata&=&postdata.Replace(&{$psessionid}&,&this.psessionid);&&&&&&&&&&&&&&HttpItem&item&=&new&HttpItem()&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&URL&=&&http://d./channel/poll2&,&&&&&&&&&&&&&&&&&&Method&=&&POST&,&&&&&&&&&&&&&&&&&&IsToLower&=&false,&&&&&&&&&&&&&&&&&&Timeout&=&100000,&&&&&&&&&&&&&&&&&&Postdata&=&postdata,&&&&&&&&&&&&&&&&&&Host&=&HOST[0],&&&&&&&&&&&&&&&&&&Referer&=&REFERER[0],&&&&&&&&&&&&&&&&&&UserAgent&=&&Mozilla/5.0&(Windows&NT&6.2;&WOW64)&AppleWebKit/537.36&(KHTML,&like&Gecko)&Chrome/34.0.&Safari/537.36&,//用户的浏览器类型,版本,&&&&&可选项有默认值&&&&&&&&&&&&&&&&&&&&&ContentType&=&&application/x-www-form-urlencoded&,&&&&&&&&&&&&&&&&&&ResultTypeResultType&=&ResultType.String&&&&&&&&&&&&&&};&&&&&&&&&&&&&&HttpResult&result&=&http.GetHtml(item);&&&&&&&&&&&&&&JObject&ret&=&(JObject)JsonConvert.DeserializeObject(result.Html);&&&&&&&&&&&&&&JObject&retjson&=&(JObject)ret[&result&][0];&&&&&&&&&&&&&&if&(retjson[&poll_type&].ToString()&==&&group_message&)&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&JObject&msg&=&(JObject)retjson[&value&];&&&&&&&&&&&&&&&&&&ProcessMsg(msg);&&&&&&&&&&&&&&}&&&&&&&&&&&&&&Thread.Sleep(2000);&&&&&&&&&&&&&}&&&
在发送信息的上面还有一些可以拓展的,比如图片等,我这一部分还没有研究,如果有谁做过的话希望分享一下咯。
【声明】:黑吧安全网()登载此文出于传递更多信息之目的,并不代表本站赞同其观点和对其真实性负责,仅适于网络安全技术爱好者学习研究使用,学习中请遵循国家相关法律法规。如有问题请联系我们,联系邮箱,我们会在最短的时间内进行处理。
上一篇:【】【】

我要回帖

更多关于 获取硬盘信息失败 的文章

 

随机推荐