Skip to content

Commit 5ed995e

Browse files
committed
Added type hints
1 parent 2099ad6 commit 5ed995e

22 files changed

+60
-60
lines changed

helper/printer.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from colorama import Fore, Style
1919

2020

21-
def print_colored(message, color, prefix, *args, **kwargs):
21+
def print_colored(message, color, prefix, *args, **kwargs) -> None:
2222
"""
2323
Print colored message with specified color and prefix.
2424
@@ -31,29 +31,30 @@ def print_colored(message, color, prefix, *args, **kwargs):
3131
print(f"{color}{prefix}{Style.RESET_ALL} {message}", *args, **kwargs)
3232

3333

34-
def info(message, *args, **kwargs):
34+
def info(message, *args, **kwargs) -> None:
3535
print_colored(message, Fore.LIGHTBLUE_EX, "[*]", *args, **kwargs)
3636

3737

38-
def success(message, *args, **kwargs):
38+
def success(message, *args, **kwargs) -> None:
3939
print_colored(message, Fore.LIGHTGREEN_EX, "[+]", *args, **kwargs)
4040

4141

42-
def error(message, *args, **kwargs):
42+
def error(message, *args, **kwargs) -> None:
4343
print_colored(message, Fore.LIGHTRED_EX, "[!]", *args, **kwargs)
4444

4545

46-
def warning(message, *args, **kwargs):
46+
def warning(message, *args, **kwargs) -> None:
4747
print_colored(message, Fore.LIGHTYELLOW_EX, "[-]", *args, **kwargs)
4848

4949

50-
def debug(message, *args, **kwargs):
50+
def debug(message, *args, **kwargs) -> None:
5151
print_colored(message, Fore.LIGHTMAGENTA_EX, "[>]", *args, **kwargs)
5252

5353

54-
def nonprefix(message, *args, **kwargs):
54+
def nonprefix(message, *args, **kwargs) -> None:
5555
print(message, *args, **kwargs)
5656

57-
def inp(prompt, *args, **kwargs):
57+
58+
def inp(prompt, *args, **kwargs) -> None:
5859
print_colored(prompt, Fore.LIGHTBLUE_EX, "[?]", end="", *args, **kwargs)
5960
return input()

helper/randomuser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@ class GetUser:
439439
"""
440440
Return a random user agent from the list.
441441
"""
442-
def __init__(self):
442+
def __init__(self) -> str:
443443
self.user_agent = random.choice(users)
444444

445-
def __str__(self):
445+
def __str__(self) -> str:
446446
return self.user_agent

helper/timer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def timer(func):
2323
"""
2424
A timer decorator to measure the execution time of a function.
2525
"""
26-
def wrapper(*args, **kwargs):
26+
def wrapper(*args, **kwargs) -> str:
2727
start_time = time.time()
2828
result = func(*args, **kwargs)
2929
end_time = time.time()

helper/url_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def read_local_content(path):
4040
return None
4141

4242
# I hate pyinstaller.
43-
def resource_path(relative_path):
43+
def resource_path(relative_path) -> str:
4444
if hasattr(sys, '_MEIPASS'):
4545
return os.path.join(sys._MEIPASS, relative_path)
4646
return os.path.join(os.path.abspath("."), relative_path)

utils/caesar_cipher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CaesarCipher:
2727
:param shift: The shift to use for the encryption or decryption.
2828
:param mode: The mode to use for the encryption or decryption.
2929
"""
30-
def __init__(self, text: str, mode: str):
30+
def __init__(self, text: str, mode: str) -> None:
3131
self.text = text
3232
self.mode = mode
3333

@@ -48,14 +48,14 @@ def __init__(self, text: str, mode: str):
4848
printer.error("Invalid mode, please choose either 'encrypt' , 'decrypt' or 'bruteforce'..!")
4949

5050
@staticmethod
51-
def get_key():
51+
def get_key() -> int:
5252
shift = int(printer.inp("Enter a number of shifts (0 to 25) : \t"))
5353
if shift < 0 or shift > 25:
5454
printer.error("Invalid shift number, please choose a number between 0 and 25..!")
5555
return shift
5656

5757
@staticmethod
58-
def caesar_encrypt(text, shift):
58+
def caesar_encrypt(text, shift) -> str:
5959
encrypted_text = ""
6060
for char in text:
6161
if char.isalpha():
@@ -70,7 +70,7 @@ def caesar_encrypt(text, shift):
7070
return encrypted_text
7171

7272
@staticmethod
73-
def caesar_decrypt(encrypted_text, shift):
73+
def caesar_decrypt(encrypted_text, shift) -> str:
7474
decrypted_text = ""
7575
for char in encrypted_text:
7676
if char.isalpha():
@@ -85,7 +85,7 @@ def caesar_decrypt(encrypted_text, shift):
8585
return decrypted_text
8686

8787
@staticmethod
88-
def brute_force(encrypted_text):
88+
def brute_force(encrypted_text) -> None:
8989
for i in range(26):
9090
decrypted_text = ""
9191
for char in encrypted_text:

utils/cybercrime_int.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
"""
1717

18-
import json, time, requests
18+
import time, requests
1919
from helper import printer, timer
2020
from helper import randomuser
2121
from colorama import Style
@@ -28,7 +28,7 @@ class Scan:
2828
:param target: email or a domain
2929
"""
3030
@timer.timer
31-
def __init__(self, target):
31+
def __init__(self, target) -> None:
3232
try:
3333
if '@' in target:
3434
url = f"https://cavalier.hudsonrock.com/api/json/v2/osint-tools/search-by-email?email={target}"

utils/dirbuster.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Scan:
2727
:param domain: url to scan
2828
"""
2929
@timer.timer
30-
def __init__(self, domain):
30+
def __init__(self, domain) -> None:
3131
self.domain = domain
3232
self.url_set = set()
3333

@@ -37,7 +37,7 @@ def __init__(self, domain):
3737
printer.success(f"Scan Completed..! There were {Style.BRIGHT}{len(self.url_set)}{Style.RESET_ALL} valid URLs!")
3838

3939
@staticmethod
40-
def get_wordlist():
40+
def get_wordlist() -> str:
4141
"""
4242
Reads the wordlist from the url and returns a list of names
4343
@@ -49,7 +49,7 @@ def get_wordlist():
4949
except requests.exceptions.ConnectionError:
5050
return None
5151

52-
async def fetch_url(self, session, path):
52+
async def fetch_url(self, session, path) -> None:
5353
"""
5454
Fetches the url and checks if it is valid
5555
@@ -63,7 +63,7 @@ async def fetch_url(self, session, path):
6363
printer.success(f"{len(self.url_set) + 1} Valid URL(s) found : {Style.BRIGHT}{url}{Style.RESET_ALL}")
6464
self.url_set.add(url)
6565

66-
async def scan_async(self, paths):
66+
async def scan_async(self, paths) -> None:
6767
"""
6868
Scans the url asynchronously
6969
@@ -73,7 +73,7 @@ async def scan_async(self, paths):
7373
tasks = [self.fetch_url(session, path) for path in paths]
7474
await asyncio.gather(*tasks, return_exceptions=True)
7575

76-
def scan_urls(self):
76+
def scan_urls(self) -> None:
7777
paths = self.get_wordlist()
7878
if paths is None:
7979
printer.error("Connection Error..!")

utils/email_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Holehe:
2929
:param email: The email address to search for.
3030
"""
3131
@timer.timer
32-
def __init__(self, email):
32+
def __init__(self, email) -> None:
3333
printer.info(f"Trying to find sites where {Style.BRIGHT}{email}{Style.RESET_ALL} is used, thanks to holehe.")
3434
time.sleep(1)
3535
try:
@@ -49,7 +49,7 @@ def __init__(self, email):
4949
printer.error(f"Unexpected error : {e}")
5050

5151
@staticmethod
52-
def _format_output(output):
52+
def _format_output(output) -> str:
5353
lines = output.split("\n")[4:-4]
5454
for i, line in enumerate(lines):
5555
if "[+]" in line:

utils/fake_info_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Generate:
2727
Thanks to Faker, https://pypi.org/project/Faker/
2828
"""
2929
@timer.timer
30-
def __init__(self):
30+
def __init__(self) -> None:
3131
fake = Faker()
3232
printer.info("Generating fake information...")
3333
time.sleep(1)

utils/ig_scrape.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class Scrape:
2626
:param target: The username of the account to scrape.
2727
"""
2828
@timer.timer
29-
def __init__(self, target):
30-
29+
def __init__(self, target) -> None:
3130
printer.info(f"Trying to scrape information about {Style.BRIGHT}{target}{Style.RESET_ALL}...")
3231

3332
try:
@@ -40,7 +39,7 @@ def __init__(self, target):
4039

4140

4241
# Function to print user information
43-
def print_user_info(self, data):
42+
def print_user_info(self, data) -> None:
4443
readable_data = { # Format
4544
'Username': data.get('username', 'N/A'),
4645
'Full Name': data.get('full_name', 'N/A'),

0 commit comments

Comments
 (0)