-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflooder.py
127 lines (95 loc) · 3.66 KB
/
flooder.py
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import subprocess
import platform
import random
import time
import json
import os
# Set colors
color_yellow = "\033[93m"
color_green = "\033[92m"
color_red = "\033[91m"
color_reset = "\033[0m"
# Clear CMD/Terminal
def clean():
os_name = platform.system()
if os_name == "Windows":
os.system("cls")
else:
os.system("clear")
clean()
print("This script is still only in development.\nIf you have any problems report them on my GitHub page.")
print()
input("Press Enter to continue...")
clean()
print("""
___ _ _ _ __ _ _ ___ _
| __| |___ ___ __| (_)/ _|_ _| \| |/ __| |
| _|| / _ \/ _ \/ _` | | _| || | .` | (_ | |__
|_| |_\___/\___/\__,_|_|_| \_, |_|\_|\___|____|
|__/
""")
# User inputs
username = input("Enter username: ")
# Validate msgcount input
while True:
msgcount = input("Amount of messages: ")
if not msgcount.isdigit():
print("Only numbers are allowed. Please try again.")
else:
msgcount = int(msgcount)
if msgcount <= 0:
print("Please enter a positive number.")
else:
break
message_option = input("Use custom messages? (y/n): ").lower()
messages = []
if message_option == 'y':
# Custom messages
print("Enter your custom messages (one per line). Press enter on an empty line to finish.")
while True:
message = input("> ")
if not message:
break
messages.append(message)
else:
with open("messages.txt", "r", encoding="utf-8") as file:
messages = [line.strip() for line in file if line.strip()]
if not messages:
print("No messages found.")
exit()
all_messages = messages + [random.choice(messages).strip() for _ in range(msgcount - len(messages))]
random.shuffle(all_messages)
curl_command = [
'curl',
"-s",
'-X', 'POST',
'-H', 'Content-Type: application/json',
'-H', 'Accept: application/json',
'-d', '{{"username": "{}", "question": "{{message}}", "deviceId": "error"}}'.format(username, ''),
'https://ngl.link/api/submit'
]
counter = 1
try:
for message in all_messages[:msgcount]:
encoded_message = json.dumps(message)
encoded_message = encoded_message[1:-1]
# Create a copy of the curl_command list for this iteration
current_curl_command = list(curl_command)
current_curl_command[9] = '{{"username": "{}", "question": "{}", "deviceId": "bro is paying for nothing"}}'.format(username, encoded_message)
t = time.localtime()
current_time = time.strftime("[INFO: ""%H:%M:%S""]", t)
try:
output = subprocess.check_output(current_curl_command, stderr=subprocess.STDOUT)
response = json.loads(output.decode('utf-8')) # Parse the API response
if "questionId" in response:
print(f"{counter}." + color_yellow + current_time + color_reset + color_green + " Message sent successfully: " + color_reset + message)
else:
print(f"{counter}." + color_yellow + current_time + color_reset + color_red + " Something went wrong. " + color_reset + message)
counter += 1
except subprocess.CalledProcessError as e:
print(f"Error executing cURL command: {e}")
except json.JSONDecodeError:
print(f"{counter}." + color_yellow + current_time + color_reset + color_red + " To many messages! Ngl.Link can not take it any more." + color_reset)
counter += 1
except Exception as ex:
print(f"An error occurred: {ex}")