自动点击网页器

自动点击网页器

一 功能需求

    1.自动随机点击数据库中网页地址,可设定时间间隔。

    2.可按指定时间段内的随机时间点击网页。(暂为实现)

    3.可设定完成后自动退出程序。

    4.可设置代理。

    5.加入热键显示和隐藏功能。

    6.按规则抓取网页中的链接。

    7.定时点击网页中的按钮。

二 目前实现情况

    1.自动点击数据库中的网页,指定时间间隔可设置代理,加入热键显示和隐藏功能,按规则抓取网页中的链接。没有实现随机性。

三 可设置代理上网

四 仅供学习交流之用,勿用它途 


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using System.Runtime.InteropServices;

using System.Text.RegularExpressions;
using System.Collections;


namespace WindowsApplication1
{
           
public struct Struct_INTERNET_PROXY_INFO 
            { 
            
public int dwAccessType; 
            
public IntPtr proxy; 
            
public IntPtr proxyBypass; 
            }; 
    
public partial class Form2 : Form
    {
        
public Form2()
        {
            InitializeComponent();
            RegisterHotKey(Handle, 
1002, Keys.Left); // 热键一:Control +光标左箭头
            RegisterHotKey(Handle, 2002, Keys.Right); //热键一:Control +光标右箭头
            RegisterHotKey(Handle, 3002, Keys.Up); // 热键一:Control +光标上箭头
            RegisterHotKey(Handle, 4002, Keys.Down); // 热键一:Control +光标下箭头

        }
        
int i = 0;
        
/// <summary>
        
/// ///
 


         [DllImport(
"wininet.dll", SetLastError = true)] 
         
private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength);

        
private void RefreshIESettings(string strProxy) 
        { 
            
const int INTERNET_OPTION_PROXY = 38
            
const int INTERNET_OPEN_TYPE_PROXY = 3

            Struct_INTERNET_PROXY_INFO struct_IPI; 

            
// Filling in structure 
            struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY; 
            struct_IPI.proxy 
= Marshal.StringToHGlobalAnsi(strProxy); 
            struct_IPI.proxyBypass 
= Marshal.StringToHGlobalAnsi("local"); 

            
// Allocating memory 
            IntPtr intptrStruct = Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI)); 

            
// Converting structure to IntPtr 
            Marshal.StructureToPtr(struct_IPI, intptrStruct, true); 

            
bool iReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, Marshal.SizeOf(struct_IPI)); 
        } 

        
private void NativeUrl(string URL) 
        {

            
//System.Object nullObject = 0;
            
//string strTemp = String.Empty;
            
//System.Object nullObjStr = strTemp;
            webBrowser1.Navigate(URL);
      
        }


        
///
       
        
        
#region 实现热键
        
        

        [System.Runtime.InteropServices.DllImport(
"user32.dll")] //申明API函数 
        public static extern bool RegisterHotKey(
        IntPtr hWnd, 
// handle to window 
        int id, // hot key identifier 
        uint fsModifiers, // key-modifier options 
        Keys vk // virtual-key code 
        ); 

        [System.Runtime.InteropServices.DllImport(
"user32.dll")] //申明API函数 
        public static extern bool UnregisterHotKey(
        IntPtr hWnd, 
// handle to window 
        int id // hot key identifier 
        );

        
public enum KeyModifiers
        {
            None 
= 0,
            Alt 
= 1,
            Control 
= 2,
            Shift 
= 4,
            Windows 
= 8
        }

        
protected override void WndProc(ref Message m)//监视Windows消息
        {
            
const int WM_HOTKEY = 0x0312//如果m.Msg的值为0x0312那么表示用户按下了热键
            switch (m.Msg)
            {
                
case WM_HOTKEY:
                    ProcessHotkey(m); 
//按下热键时调用ProcessHotkey()函数
                    break;
            }

            
base.WndProc(ref m); //将系统消息传递自父类的WndProc
        }

        
private void ProcessHotkey(Message m)
        {
            IntPtr id 
= m.WParam; //IntPtr用于表示指针或句柄的平台特定类型
            
//MessageBox.Show(id.ToString());
            string sid = id.ToString();
            
switch (sid)
            {
                
case "100": ; break// 按下Control +光标左箭头,调用函数DecreseVolumnb();
                case "200":; break// 按下Control +光标右箭头,调用函数AddVolumnb()
                case "300":// 按下Control +光标上箭头,显示窗体
                    this.Visible = true;
                    
break;
                
case "400":// 按下Control +光标下箭头,隐藏窗体
                    this.Visible = false;
                    
break;
            }
        }

        
private void Form2_FormClosed(object sender, FormClosedEventArgs e)
        {
            UnregisterHotKey(Handle, 
100); //卸载第1个快捷键
            UnregisterHotKey(Handle, 200); //缷载第2个快捷键
            UnregisterHotKey(Handle, 300); //卸载第3个快捷键
            UnregisterHotKey(Handle, 400); //缷载第4个快捷键

        }
        
#endregion


        
int start=0;
        
int count = 0;
        
private void Form2_Load(object sender, EventArgs e)
        {
            
try
            {
                
// TODO: 这行代码将数据加载到表“dataDataSet.biao1”中。您可以根据需要移动或移除它。
                this.biao1TableAdapter.Fill(this.dataDataSet.biao1);
                button2.Enabled 
= false;
            }
            
catch (Exception ex1)
            {
                MessageBox.Show(ex1.Message,
"错误!");
            }
        
        }

        
private void button1_Click(object sender, EventArgs e) //start
        {
            
if (chk_IsProxy.Checked == true)
            {
                RefreshIESettings(
"192.168.0.1:808"); //使用代理
            }
            
            i 
= 0;
            
//webBrowser1.Navigate(strUrl);
            count = dataDataSet.biao1.Rows.Count;
            progressBar1.Maximum 
= start + count;
            progressBar1.Minimum 
= 0;
            progressBar1.Step 
= 10;

            
decimal inter = decimal.Parse((textBox1.Text.Trim()));//間隔時間
            timer1.Interval = (int)(inter * 1000);
            timer1.Start();
            button1.Enabled 
= false;
            button2.Enabled 
= true;
        }

        
private void button3_Click(object sender, EventArgs e) //生成
        {
           
//// string strUrl = dataDataSet.biao1.Rows[0][1].ToString();
           // i = 0;
           
// //webBrowser1.Navigate(strUrl);
           
// int inter = int.Parse(textBox1.Text.Trim());
           
// timer1.Interval = inter*1000;
           
// timer1.Start();
          
             count 
= int.Parse(textBox2.Text.Trim());
             start 
= int.Parse(textBox3.Text.Trim());

            progressBar1.Maximum 
= count;
            progressBar1.Minimum 
= 0;
            progressBar1.Step 
= 10;

            
for (int i = 0; i < count; i++)  //2000
            {
                StringBuilder sb 
= new StringBuilder();
                sb.Append(
"http://www.docin.com/u-" + (start + i).ToString() + ".html");//start  250000

                biao1BindingSource.AddNew();
               
                biao1BindingSource.EndEdit();
                dataGridView1.Rows[i].Cells[
1].Value = sb.ToString();
                progressBar1.Value 
= i;
            }
            MessageBox.Show(
"生产网址完成","提示!",MessageBoxButtons.OK,MessageBoxIcon.Information);             
            
///
          

                    
        }

        
private void timer1_Tick(object sender, EventArgs e)
        {
            
try
            {
                
if (webBrowser1.IsBusy == true//如果忙停止处理
                {
                    webBrowser1.Stop();
                }
               
                
string strUrl = dataDataSet.biao1.Rows[i][1].ToString();
                
                dataGridView1.Rows[i].Selected 
= true;
                
//RefreshIESettings("192.168.0.1:808"); //使用代理
                NativeUrl(strUrl);
                i
++;
                
if (i >= count)
                {
                    timer1.Stop();
                    button1.Enabled 
= true;

                    MessageBox.Show(
"点击完成""提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    
if (checkBox1.Checked == true)
                    {
                        
this.Close();
                    }
                }

                progressBar1.Value 
= i;

            }
            
catch (Exception ex)
            {
                MessageBox.Show(ex.Message,
"错误!",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }

        
private void button2_Click(object sender, EventArgs e) //stop
        {
            timer1.Stop();
            button1.Enabled 
= true;
        }

        
private void button4_Click(object sender, EventArgs e) //save
        {
            
try
            {
                
this.biao1BindingSource.EndEdit();
                
this.biao1TableAdapter.Update(this.dataDataSet.biao1);
              }
             
catch (Exception ex1)
             {
                    MessageBox.Show(ex1.Message,
"错误!");
             }
        }

        
private void button5_Click(object sender, EventArgs e) //Refresh
        {
            
this.biao1TableAdapter.Fill(this.dataDataSet.biao1);
        }

        
private void button6_Click(object sender, EventArgs e)
        {
            dataDataSet.biao1.Clear();

            
//IHTMLDOCTMNET
            
        }

        
private void button7_Click(object sender, EventArgs e)
        {
            
try
            {
                
string pre = textBox4.Text.Trim();
                
string all_code = webBrowser1.Document.Body.OuterHtml;

                
string p = pre + @"([/w-]+/.)+[/w-]+(/[/w- ./?%&=]*)?";
                ArrayList my_list 
= new ArrayList();
                Regex re 
= new Regex(p, RegexOptions.IgnoreCase);
                MatchCollection mc 
= re.Matches(all_code);
                
int j = 0;
                
for (int i = 0; i <= mc.Count - 1; i++)
                {
                    
//bool _foo = false;
                    string name = mc[i].ToString();
                    
//foreach (string list in my_list)
                    
//{
                    
//    if (name == list)
                    
//    {
                    
//        _foo = true;
                    
//        break;
                    
//    }
                    
//}//过滤


                    biao1BindingSource.AddNew();
                    biao1BindingSource.EndEdit();
                    dataGridView1.Rows[i].Cells[
1].Value = "http://www.docin.com" + name;
                    
if(i%2  == 0)
                    {
                        
//biao1BindingSource.AddNew();
                        
//biao1BindingSource.EndEdit();
                        
//dataGridView1.Rows[j].Cells[1].Value = "http://www.docin.com"+name;
                        j++;
                    }
      

                    
//if (!_foo)
                    
//{


                    
//}

                    


                }

            }
            
catch (Exception ex)
            {
                MessageBox.Show(ex.Message,
"提示!");
            }
        }
    }
}

Tonyyang

实现网页自动点击的工具软件,可同时监控点击页面内容变化并报警提示。适用于广告点击、提高网页点击率。支持链接点击、JS广告点击、IFRAM点击,支持同页面多点点击,多线程多网址多窗口点击。实现模拟鼠标单击、双击、右击功能。 1、支持定时点击和多线程高速点击连续点击,自定义点击间隔时间。 2.支持后台点击或者前台显示点击效果,可完全隐藏运行。 3、点击后续工作处理,屏蔽弹出窗口,强制关闭外部窗口。 4、可同时添加点击多个页面,支持导入网页所有链接,或指添加网址。 5、点击时显示实时速度,自动统计点击效果与流量。 6、支持代理服务,换IP点击。可导入大量免费代理服务,可随机使用或环使用代理服务 7、支持对代理服务使用情况进行统计管理。 8、网页内容变化监控,包括网页脚本执行产生的变化。 9、网页内容关键字监控,同时监控多个关键字。 10、网页HTML元素级监控,同时监控多个元素,进行数据比较。 11、网络故障监控,本地网络故障时报警。 12、点击失败监控,网站服务出现问题,或网页打不开时报警。 13、监控报警处置方式:弹出提示对话框;声音提示;任务中止;启动新任务;启动外部处置程序;保存当前页面;程序关闭;自动关机。 WINXP,WIN2003用户安装必须安装补丁Microsoft .NET Framework 2.0 Service Pack 2 注意是SP2补丁. 声明:本软件不得用于非法用途,非法使用本软件与软件作者无关.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值