⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.cs

📁 原创: 外挂网站刷IP程序的源码 自动ADSL拨号刷新IP,可录制鼠标模拟点击自动点击操作,统计点击数,自动清除COOKIES记录
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using qdog.Mouse;
using System.Diagnostics;
using Microsoft.VisualBasic;
using qdog;
using System.Management;

namespace DialUp
{
    public partial class frmMain : Form
    {
        RasDial.RAS.RASDisplay m_rasDial;
        clsMouseRecord m_clsRecord = new clsMouseRecord();
        clsTimeOut m_objTime = new clsTimeOut();
        Boolean m_bIsWork = false;

        const string RECORD_KEY = "MY_RECORD";
        const string URL_TEMPLATE = "http://www.1983111.com/download/showsoft_{0}.aspx";
        int TIME_OUT = 15;
        int MAX_DIAL = 500;
        string m_strLastUrl = "";


        const string START_CLICK="start_click";
        const string  DISCONNECT="disconnect";
        const string CONNECT="connect";
        const string OPEN_LINK = "open_link";

        public frmMain()
        {
            InitializeComponent();
        }

        private void InitCbo()
        {
            cboTimeOut.Items.Clear();
            for (int i = 1; i <= 60; i++)
            {
                cboTimeOut.Items.Add(i);
            }
            cboTimeOut.SelectedIndex = 14;
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            Process p = new Process();
            p.StartInfo = new ProcessStartInfo("rundll32.exe", "shell32.dll,Control_RunDLL inetcpl.cpl");
            p.Start();
            //p.Close();

            ClearCookies();

            InitCbo();
            //objTime.OnTimeOut += new AWDbCommon.clsTime.OnTimeOutEventHandler(objTime_OnTimeOut);
            m_rasDial = new RasDial.RAS.RASDisplay();
            m_clsRecord = new clsMouseRecord();
            m_clsRecord.KeyDown += new KeyEventHandler(MyKeyDown);
            
            cboRasList.Items.Clear();
            foreach (string strTmp in m_rasDial.Connections)
            {
                cboRasList.Items.Add(strTmp);
            }
            DisableScriptDebug();
            InitWebContent();


            
            
            //UserActivityHook.mouse_event(
        }

        private void InitWebContent()
        {
            //wbContent.Dispose();
            //wbContent = new WebBrowser();
            wbContent.ScriptErrorsSuppressed = true;
            //this.Controls.Add(wbContent);
            //wbContent.Location = new Point(0, 56);
            //wbContent.Anchor=AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
            //wbContent.Width = 800;
            //wbContent.Height = 266;

        }

        private void DisableScriptDebug()
        {
            const string DISABLE_SCRIPT_DEBUG = @"Software\Microsoft\Internet Explorer\Main";
            Microsoft.Win32.RegistryKey rkUser = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(DISABLE_SCRIPT_DEBUG,true);
            if (rkUser != null)
            {
                rkUser.SetValue("Disable Script Debugger", "yes");
            }
            rkUser = null;
            
        }

        //void objTime_OnTimeOut(string strKey)
        //{
        //    switch (strKey)
        //    {
        //        case START_CLICK:
        //            ToClick();
        //            break;
        //        case DISCONNECT:
        //            btnHangup.PerformClick();
        //            break;
        //        case OPEN_LINK:
        //            wbContent.Navigate(m_strLastUrl);
        //            break;
        //        case CONNECT:
        //            btnDialup.PerformClick();
        //            break;
        //        default:
        //            break;
        //    }
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        private void MyKeyDown(object sender, KeyEventArgs e)
        {
            //Debug.Print("KeyDown 	- " + e.KeyData.ToString() + "(" + e.KeyValue + ")");

            if (e.KeyValue == 27 && btnStartRecord.Text.ToLower().Contains("stop"))
                StartOrStop();

        }

        private void btnDialup_Click(object sender, EventArgs e)
        {
            DialUp();
        }

        private void btnHangup_Click(object sender, EventArgs e)
        {
            HangUp();
        }



        private void tmrCheckDial_Tick(object sender, EventArgs e)
        {
            DialUp();
        }

        private void HangUp()
        {
            m_rasDial = new RasDial.RAS.RASDisplay();
                m_rasDial.Disconnect();

            if (m_bIsWork)
            {
                SetState("等待重新拨号...");
                m_objTime.Wait(1);
                DialUp();
            }
        }

        private void DialUp()
        {
            if (cboRasList.Text != "")
            {
                SetState("正在拨号...");
                m_rasDial = new RasDial.RAS.RASDisplay();
                m_rasDial.Connect(cboRasList.Text);
                m_objTime.Wait(4);
                if (!CheckConnected())
                {
                    DialUp();
                    return;
                }
            }

            if (m_bIsWork)
            {
                    OpenUrl();
            }
        }

        private void OpenUrl()
        {
            SetState("正在打开网页...");
            Random ra = new Random();
            //m_strLastUrl = string.Format(URL_TEMPLATE, ra.Next(1, 6040));
            txtUrl.Text = m_strLastUrl;
            wbContent.Navigate(txtUrl.Text);
            wbContent.Focus();
        }

        private Boolean CheckConnected()
        {
            m_rasDial = new RasDial.RAS.RASDisplay();
            return m_rasDial.IsConnected;
        }

        private void btnGo_Click(object sender, EventArgs e)
        {
            Random ra = new Random();
            if (txtUrl.Text == "")
            {
                txtUrl.Text = string.Format(URL_TEMPLATE, ra.Next(1, 6040));
            }
            wbContent.Navigate(txtUrl.Text);
            wbContent.Focus();
        }

        private void wbContent_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            Debug.Print(e.Url.ToString());
            if (m_bIsWork)
            {
                tmrCheckClick.Enabled = true;
                tmrCheckClick.Stop();
                tmrCheckClick.Interval = TIME_OUT * 1000;
                tmrCheckClick.Start();

                if (e.Url.ToString().ToLower() == m_strLastUrl.ToLower())
                {
                    SetState("完成 " + e.Url.ToString());
                    if (m_bIsWork)
                    {
                        m_objTime.Wait(1);
                        if (cboRasList.Text != "")
                            ToClick();
                        else
                            OpenUrl();
                    }
                }
            }
        }

        private void ToClick()
        {
            SetState("开始点击操作...");
            tmrCheckClick.Stop();
            tmrCheckClick.Enabled = false;

            //Debug.Print("Start To Click.");
            foreach (MousePos mpV in m_clsRecord.GetAllRecord(RECORD_KEY))
            {
                clsMouseRecord.SetCursorPos(mpV.X, mpV.Y);
                m_clsRecord.mouse_event(UserActivityHook.MouseAction.MOUSEEVENTF_LEFTDOWN);
                m_clsRecord.mouse_event(UserActivityHook.MouseAction.MOUSEEVENTF_LEFTUP);
                Debug.Print(mpV.X.ToString() + "," + mpV.Y.ToString());
                m_objTime.Wait(1);
            }

            CloseIE();
        }

        private void CloseIE()
        {
            SetState("点击操作完成,正在关闭IE窗口...");
            m_objTime.Wait(4);

            foreach (Process pTmp in Process.GetProcessesByName("IEXPLORE"))
            {
                    pTmp.Kill();
            }
            try
            {
                ClearCookies();
                //InitWebContent();

                int nCount = int.Parse(stCount.Text) + 1;

                stCount.Text = nCount.ToString();
                if (nCount >= MAX_DIAL)
                {
                    btnStop.PerformClick();
                    return;
                }
            }
            catch
            { }

            if (!m_bIsWork)
                return;

            if (cboRasList.Text != "")
            {
                //m_objTime.Wait(1);
                SetState("正在挂断...");
                //m_objTime.Wait(4);
                HangUp();
            }
            else
            {
                OpenUrl();
            }

        }

        private void btnStartRecord_Click(object sender, EventArgs e)
        {
                StartOrStop();
        }

        private void StartOrStop()
        {
            if (btnStartRecord.Text.ToLower().Contains("start"))
            {
                if (m_clsRecord.StartRecord(RECORD_KEY))
                {
                    SetStartMode(true);
                    btnStartRecord.Enabled = false;
                    btnStartRecord.Text = "ESC To Stop.";
                }
                
            }
            else
            {
                SetStartMode(false);
                btnStartRecord.Enabled = true;
                btnStartRecord.Text = "start Record.";
                m_clsRecord.Stop();
            }
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            SetState("开始工作...");
            
            SetStartMode(true);
            m_bIsWork = true;
            DialUp();
        }

        private void SetStartMode(Boolean bValue)
        {
            if (cboRasList.Text!="")
            {
                if (bValue)
                {
                    TIME_OUT = int.Parse(cboTimeOut.Text);
                    MAX_DIAL = int.Parse(cboMaxDial.Text);

                    if (this.WindowState != FormWindowState.Maximized)
                        this.WindowState = FormWindowState.Maximized;

                    //this.MaximizeBox = !bValue;

                    //this.MinimizeBox = !bValue;

                }
                else
                {
                    if (this.WindowState != FormWindowState.Normal)
                        this.WindowState = FormWindowState.Normal;
                    //this.Width = 800;
                    //this.Height = 350;
                }
                this.TopMost = chkTop.Checked;
                cboMaxDial.Enabled= cboTimeOut.Enabled = !bValue;
                
                btnStop.Enabled = bValue;
                btnStart.Enabled = !bValue;

            }

        }

        private void btnStop_Click(object sender, EventArgs e)
        {
            m_objTime.CancelWait();
            SetStartMode(false);
            m_bIsWork = false;
            HangUp();
        }

        private void SetState(string strMemo)
        {
            stWorking.Text = strMemo;
        }

        private void tmrCheckClick_Tick(object sender, EventArgs e)
        {
            SetState("等待超时...");
            m_objTime.Wait(1);
            ToClick();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            m_objTime.CancelWait();
            this.Close();
        }

        private void btnClick_Click(object sender, EventArgs e)
        {
            ToClick();
        }

        private void btnMin_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void ClearCookies()
        {
            string strCookiesPath = Environment.GetFolderPath(Environment.SpecialFolder.Cookies);

            foreach(string strFileName in System.IO.Directory.GetFiles(strCookiesPath))
            {
                if (!strFileName.ToLower().Contains("index.dat"))
                {
                    try
                    {
                        System.IO.File.Delete(strFileName);
                    }
                    catch { }
                }
            }

        }

        private void btnMax_Click(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Maximized)
                this.WindowState = FormWindowState.Normal;
            else
                this.WindowState = FormWindowState.Maximized;
        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -