c# help me with my ******* bot

Discussion in '.NET' started by amitsl, Mar 11, 2012.

  1. amitsl

    amitsl New Member

    Joined:
    Feb 28, 2012
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    [LEFT][COLOR=#CCCCCC][FONT=Monaco]private void startToolStripMenuItem_Click(object sender, EventArgs e)[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]  {[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    int num = Convert.ToInt32(this.kryptonListBox1.Items.Count);[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    int aaa = 0;[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    while (aaa < num)[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    {[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    try[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    {[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    kryptonListBox1.SetSelected(aaa, true);[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    numberof.Text = "number of clicks:" + aaa;[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    aaa++;[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    status.Text = "using the proxy ip";[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    string key = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    string Proxy = kryptonListBox1.SelectedItem.ToString();[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    RegistryKey RegKey = Registry.CurrentUser.OpenSubKey(key, true);[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    RegKey.SetValue("ProxyServer", Proxy);[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    RegKey.SetValue("ProxyEnable", 1);[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    status.Text = "navigate to the referrer";[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    webBrowser1.Navigate(referrer.Text);[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    status.Text = "navigate to the page";[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    webBrowser1.Navigate(url.Text);[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    int wait = 0;[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    status.Text = "sleeping for 3 secondes";[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    Thread.Sleep(900);[/FONT][/COLOR]
    
    [COLOR=#CCCCCC][FONT=Monaco]    foreach (HtmlElement hem in webBrowser1.Document.All)[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    {[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    status.Text = "clicking skip button";[/FONT][/COLOR]
    
    [COLOR=#CCCCCC][FONT=Monaco]    if (hem.GetAttribute("id").Contains("skip_button"))[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    {[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    hem.InvokeMember("Click");[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    status.Text = "clicked skip button";[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    Thread.Sleep(400);[/FONT][/COLOR]
    
    [COLOR=#CCCCCC][FONT=Monaco]    webBrowser1.Navigate(referrer.Text);[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    }[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    else[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    {[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    Thread.Sleep(400);[/FONT][/COLOR]
    
    [COLOR=#CCCCCC][FONT=Monaco]    }[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    }[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    }[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    catch (Exception b)[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    {[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    status.Text = "error with proxy";[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    aaa++;[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    MessageBox.Show(b.ToString());[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    Thread.Sleep(5000);[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    }[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]    }[/FONT][/COLOR]
    [COLOR=#CCCCCC][FONT=Monaco]  }[/FONT][/COLOR][/LEFT]
    

    thats when the program stuck:
    [​IMG]
    here the program stucked and just write that he did 10 clicks but he did nothing
    after the program start i cant change tab or something thats just stuck
    the program stuck on start and thats dosent wait for the site to countdown
    maybe i can do that with httpwebrequest
    can someone help me please?
    thx: )

    edit:
    now i got this code but i got error and the page dosent load sucssesfully thats load half of the page
    Code:
    string Proxy = kryptonListBox1.SelectedItem.ToString();
                WebClient webClient = new WebClient();
                WebProxy webProxy = new WebProxy(Proxy);
                webClient.Proxy = webProxy;
                HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url.Text);
                webRequest.AllowAutoRedirect = true;
                webBrowser1.Update();
                webRequest.Proxy = webProxy;
                HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
                Stream receiveStream = response.GetResponseStream();
                webBrowser1.DocumentStream = receiveStream;
                while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
                {
                    webBrowser1.Update();
                    Thread.Sleep(1000);
                    webBrowser1.Update();
                    Application.DoEvents();
                }
                response.Close();
                webBrowser1.Update();
                webBrowser1.Document.Forms[1].InvokeMember("skip_button");
                while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
                {
                    webBrowser1.Update();
                    Application.DoEvents();
                }
                System.Threading.Thread.Sleep(60000);
                webBrowser1.Navigate(referrer.Text);
    
    [​IMG]
     
  2. mnalam

    mnalam New Member

    Joined:
    Oct 8, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Thanks for this use full coding
     
  3. greenhunter

    greenhunter New Member

    Joined:
    Nov 17, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    after the program start i cant change tab or something thats just stuck
    ------------------------------------------------------------------------------------
    use thread class
     

Share This Page