Skip to content

Improvements for Speed: #26

@Gheris-579

Description

@Gheris-579

#!/usr/bin/env python3
import sys
import os
import time
from helplist import helpp
from modules import (
cms,
Traceroute,
reverseip,
portscan,
iplocation,
httpheader,
findsharedns,
whois,
dnslookup,
robots,
finder,
cloudflare,
wordpress,
)

try:
from colorama import Fore
except ImportError:
os.system("clear")
print("\n Please Install colorama:\n pip3 install colorama\n")
sys.exit()

try:
import requests
except ImportError:
os.system("clear")
print("\n Please Install requests:\n pip3 install requests\n")
sys.exit()

try:
import ipapi
except ImportError:
os.system("clear")
print("\n Please Install ipapi:\n pip3 install ipapi\n")
sys.exit()

try:
import builtwith
except ImportError:
os.system("clear")
print("\n Please Install builtwith:\n pip3 install builtwith\n")
sys.exit()

def get_input_with_banner(prompt):
"""Displays the banner and info list 1, then gets user input."""
helpp.Banner()
helpp.infolist1()
return input(Fore.RED + " ┌─[" + Fore.LIGHTGREEN_EX + "WEBKILLER" + Fore.BLUE + "~" + Fore.WHITE + "@HOME" + Fore.RED + """]
└──╼ """ + Fore.WHITE + "$ ").lower()

def handle_information_gathering():
"""Handles the information gathering submenu."""
helpp.Banner()
helpp.infolist2()
infor = input(Fore.RED + " ┌─[" + Fore.LIGHTGREEN_EX + "WEBKILLER" + Fore.BLUE + "~" + Fore.WHITE + "@HOME" + Fore.RED + "/" + Fore.CYAN + "Information Gathering" + Fore.RED + """]
└──╼ """ + Fore.WHITE + "$ ").lower()

if infor == "1":
    helpp.Banner()
    cloudflare.__start__()
elif infor == "2":
    helpp.Banner()
    cms.__start__()
elif infor == "3":
    helpp.Banner()
    Traceroute.__start__()
elif infor == "4":
    helpp.Banner()
    reverseip.__start__()
elif infor == "5":
    helpp.Banner()
    portscan.__start__()
elif infor == "6":
    helpp.Banner()
    iplocation.__start__()
elif infor == "7":
    helpp.Banner()
    httpheader.__start__()
elif infor == "8":
    helpp.Banner()
    findsharedns.__start__()
elif infor == "9":
    helpp.Banner()
    whois.__start__()
elif infor == "10":
    helpp.Banner()
    dnslookup.__start__()
elif infor == "11":
    helpp.Banner()
    robots.__start__()
elif infor == "12":
    helpp.Banner()
    finder.__start__()
elif infor == "13":
    input(Fore.RED + " [!]" + Fore.GREEN + " Back To Menu (Press Enter...) ")
elif infor == "14":
    sys.exit()
elif infor == "":
    input(Fore.RED + " [!]" + Fore.GREEN + " Please Enter Number (Press Enter...) ")

def handle_cms_detection():
"""Handles the CMS detection submenu."""
helpp.infolist4()
try:
numcms = input(Fore.RED + " ┌─[" + Fore.LIGHTGREEN_EX + "WEBKILLER" + Fore.BLUE + "~" + Fore.WHITE + "@HOME" + Fore.RED + "/" + Fore.CYAN + "CMS Detection" + Fore.RED + """]
└──╼ """ + Fore.WHITE + "$ ").lower()
except KeyboardInterrupt:
print("")
sys.exit()

if numcms == "1":
    handle_wordpress_menu()
elif numcms in ("2", "3"):
    helpp.Banner()
    print(Fore.RED + " [!]" + Fore.BLUE + " Coming Soon ! ")
    try:
        input(Fore.GREEN + " [*] Back To Menu (Press Enter...) ")
    except KeyboardInterrupt:
        print("")
        sys.exit()
elif numcms == "4" or numcms == "":
    try:
        input(Fore.GREEN + " [*] Back To Menu (Press Enter...) ")
    except KeyboardInterrupt:
        print("")
        sys.exit()

def handle_wordpress_menu():
"""Handles the WordPress submenu."""
helpp.infowp()
try:
wp = input(Fore.RED + " ┌─[" + Fore.LIGHTGREEN_EX + "WEBKILLER" + Fore.BLUE + "~" + Fore.WHITE + "@HOME" + Fore.RED + "/" + Fore.CYAN + "CMN" + Fore.RED + "/" + Fore.LIGHTYELLOW_EX + "WordPress" + Fore.RED + """]
└──╼ """ + Fore.WHITE + "$ ").lower()
except KeyboardInterrupt:
print("")
sys.exit()

if wp == "1":
    helpp.Banner()
    wordpress.wpplug()
elif wp == "2":
    helpp.Banner()
    wordpress.user()
elif wp == "3":
    try:
        input(Fore.GREEN + " [*] Back To Menu (Press Enter...) ")
    except KeyboardInterrupt:
        print("\n")
        sys.exit()

def handle_main_menu(number):
"""Handles the main menu options."""
if number == '4':
sys.exit()
elif number == "3":
helpp.infolist3()
elif number == "":
print(Fore.RED + " [!]" + Fore.BLUE + " Please Enter Number :))))")
input("")
elif number == '1':
handle_information_gathering()
elif number == "2":
handle_cms_detection()

if name == "main":
while True:
try:
number = get_input_with_banner("")
handle_main_menu(number)
except KeyboardInterrupt:
print("\n God Lock :) ")
sys.exit()

The operations here are being executed one by one, and therefore direct increase in speed within the main code will not be achievable. However, the following are some locations where speed or efficiency can at least be boosted:

Avoiding unnecessary input(): I have removed the input("\\") calls after showing the error messages from the main menu because they are disrupting the flow. The user should return to the main prompt.".
Functions for submenus: I've made the code more readable by splitting it up into functions (handle_information_gathering, handle_cms_detection, handle_wordpress_menu, handle_main_menu) so the structure is more clear and possibly easier to optimize in the future if more involved actions are placed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions