首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

用C#写个刷帖的工具 想问问亟需什么技术 提供下思路(帮顶给分)

2013-08-01 
用C#写个刷帖的工具 想问问需要什么技术 提供下思路(帮顶给分)自己一点思路都没有仅仅为了做出来好玩 绝对

用C#写个刷帖的工具 想问问需要什么技术 提供下思路(帮顶给分)
   自己一点思路都没有 
    


    仅仅为了做出来好玩 绝对不会恶意灌水CSDN 
    希望大家给点建议 用C#写个刷帖的工具 想问问亟需什么技术 提供下思路(帮顶给分)
[解决办法]
在不考虑cookie的情况下,用Browser控件实现起来非常得心应手。 就是用Browser可以完全模拟你的动作。
[解决办法]


[解决办法]
不用想了,事情没那么简单
[解决办法]
curl就行了,写什么程序啊
一般这些都用脚本
[解决办法]
用C#写个刷帖的工具 想问问亟需什么技术 提供下思路(帮顶给分)用C#写个刷帖的工具 想问问亟需什么技术 提供下思路(帮顶给分)冲着帮顶给分来的...
[解决办法]
帮你顶了 一定要给分哦!用C#写个刷帖的工具 想问问亟需什么技术 提供下思路(帮顶给分)
[解决办法]
同样想学习抓包,顶一个。
[解决办法]
用C#写个刷帖的工具 想问问亟需什么技术 提供下思路(帮顶给分)
[解决办法]
using System; 


using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
using System.Web;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            CSDN cs = new CSDN();

            if (cs.Login("qq578023708", "*************"))  cs.Reply("390521782","帮你顶了,一定要给分哦!"); //390521782为帖子ID
            Console.ReadLine();
        }
    }
    
    class CSDN {   
        HttpWebRequest httpq = null;
        HttpWebResponse httpp = null;
        CookieCollection cc = null;
        string cook = null;
        /// <summary>
        /// 登陆
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="pwd">密码</param>
        /// <returns>返回TRUE 成功 返回 FALSE 失败</returns>
        public bool Login(string userName, string pwd) {
            httpq =(HttpWebRequest) WebRequest.Create("https://passport.csdn.net/ajax/accounthandler.ashx?t=log&u="+userName+"&p="+pwd+"&remember=0&f=http%3A%2F%2Fbbs.csdn.net%2Ftopics%2F390521782&rand=0.5834313757092409");
            httpq.Accept = "*/*";
            httpq.Referer = "https://passport.csdn.net/account/loginbox?callback=logined&hidethird=1&from=http%3a%2f%2fbbs.csdn.net%2ftopics%2f390521782";
            httpq.CookieContainer = new CookieContainer();
            httpp =(HttpWebResponse) httpq.GetResponse();


            httpp.Cookies = cc;
            StreamReader sr = new StreamReader(httpp.GetResponseStream());
            cook = httpp.Headers["set-cookie"];
            string re = sr.ReadToEnd();
            if (re.IndexOf(""status":true") != -1) return true;
            else return false;
            
        }
        /// <summary>
        /// 回帖
        /// </summary>
        /// <param name="id">帖子ID</param>
        /// <param name="text">回帖内容</param>
        /// <returns></returns>
        public string Reply(string id,string text) {
            httpq = (HttpWebRequest)WebRequest.Create("http://bbs.csdn.net/topics/"+id+"?page=1");
            httpq.Accept = "application/json, text/javascript, */*";
            httpq.Referer = "http://bbs.csdn.net/topics/"+id+"?page=1";
            StreamReader ssr = new StreamReader( httpq.GetResponse().GetResponseStream());
            string RR = ssr.ReadToEnd();
            int index1= RR.IndexOf("csrf-param");
            int index2 = RR.IndexOf("content", index1);
            index2 += 9;
            index1 = RR.IndexOf(" ", index2)-1;
            string token= RR.Substring(index2, index1 - index2);
            httpq = (HttpWebRequest)WebRequest.Create("http://bbs.csdn.net/posts?topic_id="+id);


            httpq.Referer = "http://bbs.csdn.net/topics/" + id + "?page=1";
            httpq.Accept = "application/json, text/javascript, */*";
            foreach (Cookie co in cc) {
                httpq.CookieContainer.Add(co);
            }
            httpq.Method = "post";
            httpq.ContentType = "application/x-www-form-urlencoded";
            byte[] bytes = Encoding.UTF8.GetBytes("utf8=%E2%9C%93&authenticity_token="+HttpUtility.UrlEncode(token)+"&post%5Bbody%5D="+HttpUtility.UrlEncode(text)+"&commit=%E6%8F%90%E4%BA%A4%E5%9B%9E%E5%A4%8D");
            httpq.ContentLength = bytes.Length;
            httpq.GetRequestStream().Write(bytes, 0, bytes.Length);
            httpp =(HttpWebResponse) httpq.GetResponse();
            StreamReader sr = new StreamReader(httpp.GetResponseStream());
            return sr.ReadToEnd();

        }
    }
}


[解决办法]
还有人专门研究这个,我写过投票的软件,结果让人给刷爆了,我正在升级和改进

热点排行