Python3 library , Direnumerate is an open source tool written in Python designed to automate directory and file enumeration on web servers. It is useful for security professionals and system administrators who want to identify hidden resources and assess the security of web applications.
__title__ = "direnumerate"
__author__ = "Juan Bindez"
__license__ = "GPLv2 License"
__js__ = None
__js_url__ = None

import os

from direnumerate.version import __version__
from direnumerate.__main__ import DirScan
from direnumerate.__main__ import PortScan
from direnumerate.__main__ import FindPattern
from direnumerate.__main__ import InfoIp
from direnumerate.createlist import create_wordlist

wordlist_file = "wordlist.txt"

if not os.path.isfile(wordlist_file):
            create_wordlist(wordlist_file)
direnumerate/__init__.py
JuanBindez/direnumerate
import requests
import socket
import os
import webbrowser
from typing import Optional

from direnumerate.createlist import create_wordlist
from direnumerate.colors import Color
from direnumerate.banner import *
from direnumerate.getinfo import get_info_ip
from direnumerate.ipcalculator import *


class DirScan:
    """
    A class for directory scanning.

    Attributes:
        url (str): The URL to scan.
        wordlist_file (str): The path to the wordlist file.
    """
    def __init__(self, url):
        """
        Initializes a DirScan instance.

        Args:
            url (str): The URL to scan.
            wordlist_file (str): The path to the wordlist file.
        """
        self.url = "http://" + url

    def dir_enum(self, wordlist_file, verbose: bool = False):
        """
        Perform directory enumeration.

        This method reads paths from a wordlist file, appends them to the URL, and sends HTTP requests to
        check for the existence of the resources. It prints the results based on the response status code.

        - 200: Found
        - 204: No Content
        - 400: Bad Request
        - 401: Unauthorized
        - 403: Forbidden
        - 404: Not Found
        - 500: Internal Server Error

        If the wordlist file is not found, it attempts to create one.
        """
        self.wordlist_file = wordlist_file
        

        if verbose:
            try:
                with open(self.wordlist_file, "r") as self.wordlist_file:
                    for line in self.wordlist_file:
                        path = line.strip()
                        full_url = self.url + "/" + path
                        response = requests.get(full_url)
                        
                        if response.status_code == 200:
                            print(Color.GREEN + f"Target access [Found]: -> {Color.RESET + full_url}")
                        elif response.status_code == 204:
                            print(Color.BLUE + f"Target access [No Content]: -> {Color.RESET+ full_url}")
                        elif response.status_code == 400:
                            print(Color.YELLOW + f"Target access [Bad Request]: -> {Color.RESET+ full_url}")
                        elif response.status_code == 401:
                            print(Color.RED + f"Target access [Unauthorized]: -> {Color.RESET+ full_url}")
                        elif response.status_code == 403:
                            print(Color.RED + f"Target access [Forbidden]: -> {Color.RESET+ full_url}")
                        elif response.status_code == 404:
                            print(Color.YELLOW + f"Target access [Not Found]: -> {Color.RESET+ full_url}")
                        elif response.status_code == 500:
                            print(Color.BLUE + f"Target access [Internal Server Error]: -> {Color.RESET+ full_url}")
            except FileNotFoundError:
                print(Color.RED + "Word list file not found." + Color.RESET)
                
            except TypeError:
                print(Color.GREEN + "-------------------- Scan Finished --------------------" + Color.RESET)
                
            except KeyboardInterrupt:
                print(Color.GREEN + "-------------- Attempt interrupted by user ------------" + Color.RESET)

            except requests.exceptions.ConnectionError as rec:
                print(rec)
                print(Color.RED + "[Error] Don't put http:// in hosts, the software already does that" + Color.RESET)

        else:
            try:
                with open(self.wordlist_file, "r") as self.wordlist_file:
                        for line in self.wordlist_file:
                            path = line.strip()
                            full_url = self.url + "/" + path
                            response = requests.get(full_url)
                            
                            if response.status_code == 200:
                                print(Color.GREEN + f"Target access [Found]: -> {Color.RESET + full_url}")
            
            except FileNotFoundError:
                print(Color.RED + "Word list file not found." + Color.RESET)
                
            except TypeError:
                print(Color.GREEN + "-------------------- Scan Finished --------------------" + Color.RESET)
                
            except KeyboardInterrupt:
                print(Color.GREEN + "-------------- Attempt interrupted by user ------------" + Color.RESET)

            except requests.exceptions.ConnectionError as rec:
                print(rec)
                print(Color.RED + "[Error] Don't put http:// in hosts, the software already does that" + Color.RESET)

class PortScan:
    """
    A class for port scanning.

    Attributes:
        host (str): The host to scan for open ports.
        ports (list): A list of ports to scan.
        open_ports (list): A list to store open ports.
    """
    def __init__(self, host):
        """
        Initializes a PortScan instance.

        Args:
            host (str): The host to scan for open ports.
            ports (list): A list of ports to scan.
        """
        self.host = host
        self.open_ports = []

    def scan_ports(self, ports):
        """
        Scan the specified ports on the target host.

        This method attempts to establish a TCP connection to each port in the list of ports on the target host.
        If the connection is successful (result == 0), the port is considered open, and it is added to the open_ports list.
        If the connection fails, the port is considered closed.

        The results are printed to the console, indicating whether each port is open or closed.

        Raises:
            socket.gaierror: If an invalid host is provided.
        """
        self.ports = ports
        
        try:
            for port in self.ports:
                sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                sock.settimeout(1)

                result = sock.connect_ex((self.host, port))

                if result == 0:
                    self.open_ports.append(port)
                    print(Color.GREEN + f"Target -> [http://{self.host}] port: {port} is open" + Color.RESET)
                else:
                    print(Color.RED + f"Target -> [http://{self.host}] port: {port} is closed" + Color.RESET)
                sock.close()
        except socket.gaierror as sq:
            print(sq)
            print(Color.RED + "[Error] Don't put http:// in hosts, the software already does that" + Color.RESET)


class FindPattern:
    """
    A class for searching for a keyword in a log file.

    Attributes:
        file_log (str): The path to the log file.
        keyword (str): The keyword to search for in the log file.
    """

    def __init__(self, file_log):
        """
        Initializes a LogScan instance.

        Args:
            file_log (str): The path to the log file.
            keyword (str, optional): The keyword to search for in the log file.
        """
        self.file_log = file_log

    def find_in_log(self, keyword: str = None):
        """
        Search for the specified keyword in the log file and display matching lines.

        This method reads the lines from the log file and identifies lines that contain the specified keyword.
        It then prints the matching lines along with their line numbers.

        If no matching lines are found, a message is printed indicating that no occurrences were found.
        """
        self.keyword = keyword

        with open(self.file_log, 'r') as file:
            lines = file.readlines()

        matching_lines = [line for line in lines if self.keyword in line]

        if matching_lines:
            
            print(Color.GREEN + f"Lines with the word --> '{self.keyword}':" + Color.RESET)
            for i, line in enumerate(matching_lines, start=1):
                print(f"Line {i}: {line.strip()}")
        else:
            
            print(Color.RED + f"No occurrence of the word --> '{self.keyword}' found." + Color.RESET)


class InfoIp:
    def __init__(self, ip):
        self.ip = ip


    def ip_calculator(self,
                         all: bool = False,
                         verify_valid_ip: bool = False,
                         verify_class: bool = False,
                         calc_subnet_mask: bool = False,
                         calc_count: bool = False,):

        if all:
            if is_valid_ip(self.ip):
                # print(Color.GREEN + "Valid IP address." + Color.RESET)
                ip_class = calculate_ip_class(self.ip)
                print(Color.GREEN + "IP address class:" + Color.RESET, f"{ip_class}")
                subnet_mask = calculate_subnet_mask(self.ip)
                print(Color.GREEN + "Subnet mask:" + Color.RESET, f"{subnet_mask}")
                ip_count = calculate_ip_count(self.ip)
                if ip_count == "Not applicable":
                    print(Color.RED + "Cannot calculate for this address class." + Color.RESET)
                else:
                    print(Color.GREEN + "The number of IP addresses in the block is:" + Color.RESET, f"{ip_count}")

               
            else:
                print(Color.RED + "Invalid IP address. Make sure you use the correct format." + Color.RESET)

        elif verify_valid_ip:

            if is_valid_ip(self.ip):
                print(Color.GREEN + "Valid IP address." + Color.RESET)

        elif verify_class:

            ip_class = calculate_ip_class(self.ip)
            print(Color.GREEN + f"IP address class: ",  + Color.RESET + {ip_class})

        elif calc_subnet_mask:

            subnet_mask = calculate_subnet_mask(self.ip)
            print(Color.GREEN + f"Subnet mask:", + Color.RESET + {subnet_mask})

        elif calc_count:
            if is_valid_ip(self.ip):
                ip_count = calculate_ip_count(self.ip)
                if ip_count == "Not applicable":
                    print(Color.RED + "Cannot calculate for this address class.", + Color.RESET)
                else:
                    print(Color.GREEN + f"The number of IP addresses in the block is:"+ Color.RESET, {ip_count})
            else:
                print(Color.RED + "Invalid IP address. Make sure to use the correct format.", + Color.RESET)
    

    def show_info(self):
        
        informations = get_info_ip(self.ip)
        print(Color.GREEN + "Information about the IP address:" + Color.RESET, self.ip)
        print(Color.GREEN + "IP:" + Color.RESET, informations["ip"])
        print(Color.GREEN + "Hostname:" + Color.RESET, informations["hostname"])
        print(Color.GREEN + "Location:" + Color.RESET, informations["loc"])
        print(Color.GREEN + "City:" + Color.RESET, informations["city"])
        print(Color.GREEN + "Region:" + Color.RESET, informations["region"])
        print(Color.GREEN + "Country:" + Color.RESET, informations["country"])
        print(Color.GREEN + "Internet Service Provider:" + Color.RESET, informations["org"])

        # Additional information (if available)
        print(Color.GREEN + "Postal Code:" + Color.RESET, informations.get("postal"))
        print(Color.GREEN + "Time Zone:" + Color.RESET, informations.get("timezone"))
        print(Color.GREEN + "Coordinates:" + Color.RESET, informations.get("loc"))
        print(Color.GREEN + "Company Name:" + Color.RESET, informations.get("company"))
        print(Color.GREEN + "ASN (Autonomous System Number):" + Color.RESET, informations.get("asn"))
        print(Color.GREEN + "Network Prefix:" + Color.RESET, informations.get("network"))
        print(Color.GREEN + "Network Prefix CIDR:" + Color.RESET, informations.get("cidr"))
        print(Color.GREEN + "Connection Type:" + Color.RESET, informations.get("type"))
        print(Color.GREEN + "Regional Internet Registry (RIR):" + Color.RESET, informations.get("region"))
        print(Color.GREEN + "IP Block:" + Color.RESET, informations.get("ip_block"))

        ic = InfoIp(self.ip)
        ic.ip_calculator(all=True)

direnumerate/__main__.py
JuanBindez/direnumerate
from direnumerate.version import __version__

def show_banner():
    return print("direnumerate " + "v" + __version__ + "\n")
direnumerate/banner.py
JuanBindez/direnumerate
import argparse
from direnumerate.__main__ import DirScan, PortScan, FindPattern, InfoIp
from direnumerate.colors import Color
from direnumerate.banner import *
from direnumerate.version import __version__


def dir_scan(args):
    """
    Perform directory enumeration based on the provided arguments.

    Args:
        args (argparse.Namespace): Command-line arguments and options.
    """
    show_banner()

    if args.verbose:
            try:
                url = args.target
                wordlist_file = args.wordlist

                enum = DirScan(url)
                enum.dir_enum(wordlist_file, verbose=True)
            except TypeError:
                print(Color.GREEN + "-------------------- Scan Finished --------------------" + Color.RESET)
            except KeyboardInterrupt:
                print(Color.GREEN + "-------------- Attempt interrupted by user ------------" + Color.RESET)
    else:
        pass

    try:
        url = args.target
        wordlist_file = args.wordlist

        enum = DirScan(url)
        enum.dir_enum(wordlist_file)
    except TypeError:
        print(Color.GREEN + "-------------------- Scan Finished --------------------" + Color.RESET)
    except KeyboardInterrupt:
        print(Color.GREEN + "-------------- Attempt interrupted by user ------------" + Color.RESET)


def port_scan(args):
    """
    Perform port scanning based on the provided arguments.

    Args:
        args (argparse.Namespace): Command-line arguments and options.
    """
    show_banner()
    try:
        host = args.target
        ports = args.ports

        scanner = PortScan(host)
        scanner.scan_ports(ports)
    except KeyboardInterrupt:
        print(Color.GREEN + "-------------- Port scan interrupted by user ------------" + Color.RESET)


def find_pattern(args):
    show_banner()
    file_name_log = args.logname
    key = args.keyword

    fp = FindPattern(file_name_log)
    fp.find_in_log(keyword=key)


def show_info_ip(args):
    show_banner()
    ip_address = args.target

    ipinfo = InfoIp(ip_address)
    ipinfo.show_info()


def main():
    """
    The main function for the Direnumerate application.

    Parses command-line arguments and options, and executes the appropriate subcommand (dir_scan or port_scan).
    """
    parser = argparse.ArgumentParser(description="Direnumerate - Directory Enumeration on Web Servers")
    subparsers = parser.add_subparsers(title="subcommands")

    dir_parser = subparsers.add_parser("Ds", help="Perform directory enumeration")
    dir_parser.add_argument("-v", "--verbose", required=False, action="store_true", help="Verbose output")
    dir_parser.add_argument("-t", "--target", required=True, help="Target URL (including scheme, e.g. http://www.example.com)")
    dir_parser.add_argument("-w", "--wordlist", required=True, help="Wordlist file")
    dir_parser.set_defaults(func=dir_scan)

    port_parser = subparsers.add_parser("Ps", help="Perform port scanning")
    port_parser.add_argument("-t", "--target", required=True, help="Target host")
    port_parser.add_argument("-p", "--ports", nargs='+', type=int, required=True, help="Ports to scan (e.g., 22 80 443)")
    port_parser.set_defaults(func=port_scan)

    find_pattern_parser = subparsers.add_parser("Fp", help="Perform log scanning")
    find_pattern_parser.add_argument("-log", "--logname", required=True, help="Log Name")
    find_pattern_parser.add_argument("-key", "--keyword", required=True, help="Key Word")
    find_pattern_parser.set_defaults(func=find_pattern)

    info_parser = subparsers.add_parser("info", help="Perform info of ip scanning")
    info_parser.add_argument("-t", "--target", required=True, help="Target host")
    info_parser.set_defaults(func=show_info_ip)

    args = parser.parse_args()
    args.func(args)

if __name__ == "__main__":
    main()



direnumerate/cli.py
JuanBindez/direnumerate
class Color:
    GREEN = '\033[92m'
    LIGTH_GREEN = '\033[1;92m'
    RED = '\033[91m'
    YELLOW = '\033[93m'
    BLUE = '\033[1;34m'
    MAGENTA = '\033[1;35m'
    BOLD = '\033[;1m'
    CYAN = '\033[1;36m'
    LIGHT_CYAN = '\033[1;96m'
    LIGTH_GREY = '\033[1;37m'
    DARK_GREY = '\033[1;90m'
    BLACK = '\033[1;30m'
    WHITE = '\033[1;97m'
    INVERTE = '\033[;7m'
    RESET = '\033[0m'
direnumerate/colors.py
JuanBindez/direnumerate
def create_wordlist(filename):
    """
    Create a wordlist file with commonly used directory and file names.

    This function generates a wordlist containing common directory and file names used for directory enumeration.
    The wordlist is written to the specified filename.

    Args:
        filename (str): The name of the wordlist file to create.

    Example:
        create_wordlist("wordlist.txt")
    """
    wordlist = [
        "admin",
        "login",
        "images",
        "js",
        "css",
        "config",
        "index",
        "robots.txt",
        "backup",
        "secret",
        "support",
        "contact",
        "blog",
        "forum",
        "product",
        "category",
        "brand",
        "password",
        "123456",
        "qwerty",
        "letmein",
        "access",
        "admin123",
        "administrator",
        "superuser",
        "root",
        "test",
        "guest",
        "demo",
        "webmaster",
        "developer",
        "api",
        "api_key",
        "db",
        "database",
        "user",
        "users",
        "auth",
        "authentication",
        "login.php",
        "wp-admin",
        "wp-login.php",
        "upload",
        "uploads",
        "download",
        "downloads",
        "private",
        "public",
        "static",
        "media",
        "files",
        "file",
        "images/",
        "js/",
        "css/",
        "assets/",
        "images/uploads",
        "userfiles",
        "data",
        "temp",
        "temp/",
        "logs",
        "scripts",
        "web",
        "public_html",
        "secure",
        "private/",
        "backup/",
        "backup_files/",
        "conf",
        "config/",
        "configurations/",
        "install",
        "installer",
        "setup",
        "tmp",
        "db.sql",
        "data.sql",
        "users.sql",
        "passwords.txt",
        "passwd",
        "pass",
        "password.txt",
        "login.txt",
        "credentials",
        "phpmyadmin",
        "phpMyAdmin",
        "myadmin",
        "myAdmin",
        "panel",
        "control",
        "manager",
        "admin-panel",
        "admin-login",
        "signin",
        "sign-in",
        "login-form",
        "login.html",
        "login.aspx",
        "login.jsp",
        "signin.html",
        "signin.aspx",
        "signin.jsp",
        "register",
        "signup",
        "register.html",
        "register.aspx",
        "signup.html",
        "signup.aspx",
        "forgot-password",
        "forgot-password.html",
        "forgot-password.aspx",
        "reset-password",
        "reset-password.html",
        "reset-password.aspx",
        "contact-us",
        "contact.html",
        "contact.aspx",
        "contact-form",
        "support.html",
        "support.aspx",
        "support-form",
        "about-us",
        "about.html",
        "about.aspx",
        "faq",
        "faq.html",
        "faq.aspx",
        "terms",
        "terms.html",
        "terms.aspx",
        "privacy",
        "privacy.html",
        "privacy.aspx",
        "legal",
        "legal.html",
        "legal.aspx",
        "policy",
        "policy.html",
        "policy.aspx",
        "blog/",
        "news",
        "news.html",
        "news.aspx",
        "articles",
        "articles.html",
        "articles.aspx",
        "events",
        "events.html",
        "events.aspx",
        "products",
        "products.html",
        "products.aspx",
        "services",
        "services.html",
        "services.aspx",
        "portfolio",
        "portfolio.html",
        "portfolio.aspx",
        "gallery",
        "gallery.html",
        "gallery.aspx",
        "download/",
        "downloads/",
        "download-files",
        "download-file",
        "download.html",
        "download.aspx",
        "download.jsp",
        "upload/",
        "uploads/",
        "upload-file",
        "upload.html",
        "upload.aspx",
        "upload.jsp",
        "logout",
        "logout.html",
        "logout.aspx",
        "logout.jsp",
        "signout",
        "signout.html",
        "signout.aspx",
        "signout.jsp",
        "clients",
        "client",
        "adm",
        "db.sqlite",
        "db.sqlite3",
        "public_html/admin",
        "useruploads",
        "tempfiles",
        "logs/",
        "scripts/",
        "www",
        "htdocs",
        "site",
        "system",
        "platform",
        "app",
        "data/",
        "users/",
        "database/",
        "storage",
        "cache",
        "assets/",
        "lib",
        "include",
        "html",
        "htm",
        "php",
        "asp",
        "jsp",
        "exe",
        "bin",
        "dev",
        "config.php",
        "config.inc",
        "config.ini",
        "settings.php",
        "settings.inc",
        "settings.ini",
        "photo",
        "video",
        "hd",
        "HD",
        "home.php",
        "wp-content",
        "img/users/full/",
        "category",
        "index.php",
        "index.html",
        "index.jsp",
        "index.aspx",
        "index.htm",
        "of",
        "of/",
        "of.html",
        "of.aspx",
        "of.jsp",
        "index-of",
        "file",
        "files/",
        "files",
        "directory",
        "dir",
        "dir/",
        "dir.html",
        "dir.aspx",
        "dir.jsp",
        "list",
        "list.html",
        "list.aspx",
        "list.jsp",
        "view",
        "view.html",
        "view.aspx",
        "view.jsp",
        "explore",
        "explore.html",
        "explore.aspx",
        "explore.jsp",
        "browse",
        "browse.html",
        "browse.aspx",
        "browse.jsp",
        "content",
        "content.html",
        "content.aspx",
        "content.jsp",
        "show",
        "show.html",
        "show.aspx",
        "show.jsp",
        "display",
        "display.html",
        "display.aspx",
        "display.jsp",
        "fetch",
        "fetch.html",
        "fetch.aspx",
        "fetch.jsp",
        "get",
        "get.html",
        "get.aspx",
        "get.jsp",
        "retrieve",
        "retrieve.html",
        "retrieve.aspx",
        "retrieve.jsp",
        "access",
        "access.html",
        "access.aspx",
        "access.jsp",
        "open",
        "open.html",
        "open.aspx",
        "open.jsp",
        "read",
        "read.html",
        "read.aspx",
        "read.jsp",
        "logs",
        "logfiles",
        "access_logs",
        "error_logs",
        "security_logs",
        "event_logs",
        "audit_logs",
        "syslogs",
        "app_logs",
        "debug_logs",
        "traffic_logs",
        "server_logs",
        "apache_logs",
        "nginx_logs",
        "iis_logs",
        "web_logs",
        "firewall_logs",
        "proxy_logs",
        "database_logs",
        "application_logs",
        "error_log.txt",
        "access_log.txt",
        "security_log.txt",
        "event_log.txt",
        "audit_log.txt",
        "syslog.txt",
        "app_log.txt",
        "debug_log.txt",
        "traffic_log.txt",
        "server_log.txt",
        "apache_log.txt",
        "nginx_log.txt",
        "iis_log.txt",
        "web_log.txt",
        "firewall_log.txt",
        "proxy_log.txt",
        "database_log.txt",
        "application_log.txt",
        "log_backup",
        "log_archives",
        "log_history",
        "log_data",
        "log_files",
        "log_records",
        "log_entries",
        "log_storage",
        "log_management",
        "log_viewer",
        "log_analyzer",
        "log_parser",
        "log_monitoring",
        "log_security",
        "log_alerts",
        "log_analysis",
        "log_search",
        "log_export",
        "log_rotation",
        "log_cleanup",
        "log_rotation",
        "log_rotation_script",
        "log_rotation_config",
        "log_purge",
        "log_alert",
        "log_notifications",
        "log_errors",
        "log_warnings",
        "log_info",
        "log_debug",
        "log_critical",
        "log_alert",
        "log_emergency",
        "log_severity",
        "log_level",
        "log_timestamp",
        "log_date",
        "log_time",
        "log_ip",
        "log_user",
        "log_source",
        "log_destination",
        "log_event",
        "log_message",
        "log_code",
        "log_identifier",
        "log_category",
        "log_type",
        "log_origin",
        "log_target",
        "log_client",
        "log_server",
        "log_protocol",
        "log_response",
        "log_request",
        "log_access",
        "log_authentication",
        "log_authorization",
        "log_permission",
        "log_denied",
        "log_granted",
        "log_success",
        "log_failure",
        "log_login",
        "log_logout",
        "log_session",
        "log_session_id",
        "log_user_agent",
        "log_http",
        "log_https",
        "log_ftp",
        "log_ssh",
        "log_telnet",
        "log_smtp",
        "log_pop3",
        "log_imap",
        "log_dns",
        "log_database",
        "log_app",
        "log_firewall",
        "log_proxy",
        "log_vpn",
        "log_virus",
        "log_malware",
        "log_intrusion",
        "log_attack",
        "log_ddos",
        "log_security_event",
        "log_critical_event",
        "log_alert_event",
        "log_error_event",
        "log_warning_event",
        "log_info_event",
        "log_debug_event",
        "log_event_id",
        "log_event_type",
        "log_event_description",
        "log_event_details",
        "log_event_context",
        "log_event_origin",
        "log_event_destination",
        "log_event_source_ip",
        "log_event_target_ip",
        "log_event_timestamp",
        "log_event_date",
        "log_event_time",
        "log_event_user",
        "log_event_category",
        "log_event_severity",
        "log_event_level",
        "log_event_status",
        "log_event_response",
        "log_event_request",
        "log_event_access",
        "log_event_authentication",
        "log_event_authorization",
        "log_event_permission",
        "log_event_denied",
        "log_event_granted",
        "log_event_success",
        "log_event_failure",
        "log_event_login",
        "log_event_logout",
        "log_event_session",
        "log_event_session_id",
        "log_event_user_agent",
        "log_event_http",
        "log_event_https",
        "log_event_ftp",
        "log_event_ssh",
        "log_event_telnet",
        "log_event_smtp",
        "log_event_pop3",
        "log_event_imap",
        "log_event_dns",
        "log_event_database",
        "log_event_app",
        "log_event_firewall",
        "log_event_proxy",
        "log_event_vpn",
        "log_event_virus",
        "log_event_malware",
        "log_event_intrusion",
        "log_event_attack",
        "log_event_ddos",
        "log_event_security_alert",
        "log_event_critical_alert",
        "log_event_warning_alert",
        "log_event_info_alert",
        "log_event_debug_alert",
        "log_event_threat",
        "log_event_vulnerability",
        "log_event_incident",
        "log_event_response_time",
        "log_event_server_error",
        "log_event_client_error",
        "log_event_http_status",
        "log_event_http_code",
        "log_event_http_response",
        "log_event_http_request",
        "log_event_api",
        "log_event_configuration",
        "log_event_settings",
        "log_event_changes",
        "log_event_modification",
        "log_event_audit",
        "log_event_compliance",
        "log_event_policy",
        "log_event_rules",
        "log_event_user_activity",
        "log_event_admin_activity",
        "log_event_system_activity",
        "log_event_network_activity",
        "log_event_server_activity",
        "log_event_application_activity",
        "log_event_database_activity",
        "log_event_traffic",
        "log_event_bandwidth",
        "log_event_latency",
        "log_event_error_rate",
        "log_event_warning_rate",
        "log_event_info_rate",
        "log_event_debug_rate",
        "log_event_security_rate",
        "log_event_access_rate",
        "log_event_authentication_rate",
        "log_event_authorization_rate",
        "log_event_permission_rate",
        "log_event_denied_rate",
        "log_event_granted_rate",
        "log_event_success_rate",
        "log_event_failure_rate",
        "log_event_login_rate",
        "log_event_logout_rate",
        "log_event_session_rate",
        "log_event_session_id_rate",
        "log_event_user_agent_rate",
        "log_event_http_rate",
        "log_event_https_rate",
        "log_event_ftp_rate",
        "log_event_ssh_rate",
        "log_event_telnet_rate",
        "log_event_smtp_rate",
        "log_event_pop3_rate",
        "log_event_imap_rate",
        "log_event_dns_rate",
        "log_event_database_rate",
        "log_event_app_rate",
        "log_event_firewall_rate",
        "log_event_proxy",
        "sitemap",
        "sitemap.xml",
        "site-map",
        "site_map",
        "site-map.xml",
        "site_map.xml",
        "sitemap_html",
        "sitemap_html.xml",
        "sitemap_index",
        "sitemap_index.xml",
        "sitemap_index_html",
        "sitemap_index_html.xml",
        "sitemap_index_html.txt",
        "sitemap_index_html.gz",
        "sitemap_index_html.zip",
        "sitemap_index_html.tar",
        "sitemap_index_html.tar.gz",
        "sitemap_index_html.tar.bz2",
        "sitemap_index_html.7z",
        "sitemap_index_html.rar",
        "sitemap_index_html.tar.xz",
        "sitemap_index_html.tbz2",
        "sitemap_index_html.tbz",
        "sitemap_index_html.cpio",
        "sitemap_index_html.lz",
        "sitemap_index_html.lzma",
        "sitemap_index_html.Z",
        "sitemap_index_html.bz2",
        "sitemap_index_html.arj",
        "sitemap_index_html.deb",
        "sitemap_index_html.rpm",
        "sitemap_index_html.zipx",
        "sitemap_index_html.tgz",
        "sitemap_index_html.xz",
        "sitemap_index_html.cab",
        "sitemap_index_html.ace",
        "sitemap_index_html.wim",
        "sitemap_index_html.dmg",
        "sitemap_index_html.iso",
        "sitemap_index_html.vhd",
        "sitemap_index_html.vhdx",
        "sitemap_index_html.vmdk",
        "sitemap_index_html.udf",
        "sitemap_index_html.fat",
        "sitemap_index_html.ntfs",
        "sitemap_index_html.exfat",
        "sitemap_index_html.hfs",
        "sitemap_index_html.hfs+",
        "sitemap_index_html.btrfs",
        "sitemap_index_html.ext2",
        "sitemap_index_html.ext3",
        "sitemap_index_html.ext4",
        "sitemap_index_html.reiserfs",
        "sitemap_index_html.jfs",
        "sitemap_index_html.xfs",
        "sitemap_index_html.zfs",
        "sitemap_index_html.ufs",
        "sitemap_index_html.minix",
        "sitemap_index_html.apfs",
        "sitemap_index_html.hfsx",
        "sitemap_index_html.qnx",
        "sitemap_index_html.romfs",
        "sitemap_index_html.squashfs",
        "sitemap_index_html.ubifs",
        "sitemap_index_html.yaffs",
        "sitemap_index_html.ecryptfs",
        "sitemap_index_html.f2fs",
        "sitemap_index_html.nilfs",
        "sitemap_index_html.vxfs",
        "sitemap_index_html.gfs",
        "sitemap_index_html.cifs",
        "sitemap_index_html.nfs",
        "sitemap_index_html.afs",
        "sitemap_index_html.9p",
        "sitemap_index_html.npfs",
        "sitemap_index_html.fh",
        "sitemap_index_html.ofs",
        "sitemap_index_html.hpfs",
        "sitemap_index_html.befs",
        "sitemap_index_html.gpfs",
        "sitemap_index_html.wufs",
        "sitemap_index_html.cramfs",
        "sitemap_index_html.romfs",
        "sitemap_index_html.squashfs",
        "sitemap_index_html.ubifs",
        "sitemap_index_html.yaffs",
        "sitemap_index_html.ecryptfs",
        "sitemap_index_html.f2fs",
        "sitemap_index_html.nilfs",
        "sitemap_index_html.vxfs",
        "sitemap_index_html.gfs",
        "sitemap_index_html.cifs",
        "sitemap_index_html.nfs",
        "sitemap_index_html.afs",
        "sitemap_index_html.9p",
        "sitemap_index_html.npfs",
        "sitemap_index_html.fh",
        "sitemap_index_html.ofs",
        "sitemap_index_html.hpfs",
        "sitemap_index_html.befs",
        "sitemap_index_html.gpfs",
        "sitemap_index_html.wufs",
        "sitemap_index_html.cramfs",
        "sitemap_index_html.efs",
        "sitemap_index_html.ntfs3g",
        "sitemap_index_html.ufs",
        "sitemap_index_html.romfs",
        "sitemap_index_html.squashfs",
        "sitemap_index_html.ubifs",
        "sitemap_index_html.yaffs",
        "sitemap_index_html.ecryptfs",
        "sitemap_index_html.f2fs",
        "sitemap_index_html.nilfs",
        "sitemap_index_html.vxfs",
        "sitemap_index_html.gfs",
        "sitemap_index_html.cifs",
        "sitemap_index_html.nfs",
        "sitemap_index_html.afs",
        "sitemap_index_html.9p",
        "sitemap_index_html.npfs",
        "sitemap_index_html.fh",
        "sitemap_index_html.ofs",
        "sitemap_index_html.hpfs",
        "sitemap_index_html.befs",
        "sitemap_index_html.gpfs",
        "sitemap_index_html.wufs",
        "sitemap_index_html.cramfs",
        "sitemap_index_html.efs",
        "sitemap_index_html.ntfs3g",
        "sitemap_index_html.ufs",
        "sitemap_index_html.romfs",
        "sitemap_index_html.squashfs",
        "sitemap_index_html.ubifs",
        "sitemap_index_html.yaffs",
        "sitemap_index_html.ecryptfs",
        "sitemap_index_html.f2fs",
        "sitemap_index_html.nilfs",
        "sitemap_index_html.vxfs",
        "sitemap_index_html.gfs",
        "sitemap_index_html.cifs",
        "sitemap_index_html.nfs",
        "sitemap_index_html.afs",
        "sitemap_index_html.9p",
        "sitemap_index_html.npfs",
        "sitemap_index_html.fh",
        "sitemap_index_html.ofs",
        "sitemap_index_html.hpfs",
        "sitemap_index_html.befs",
        "sitemap_index_html.gpfs",
        "sitemap_index_html.wufs",
        "sitemap_index_html.cramfs",
        "sitemap_index_html.efs",
        "sitemap_index_html.ntfs3g",
        "sitemap_index_html.ufs",
        "sitemap_index_html.romfs",
        "sitemap_index_html.squashfs",
        "sitemap_index_html.ubifs",
        "sitemap_index_html.yaffs",
        "sitemap_index_html.ecryptfs",
        "sitemap_index_html.f2fs",
        "sitemap_index_html.nilfs",
        "sitemap_index_html.vxfs",
        "sitemap_index_html.gfs",
        "sitemap_index_html.cifs",
        "sitemap_index_html.nfs",
        "sitemap_index_html.afs",
        "sitemap_index_html.9p",
        "sitemap_index_html.npfs",
        "sitemap_index_html.fh",
        "sitemap_index_html.ofs",
        "sitemap_index_html.hpfs",
        "sitemap_index_html.befs",
        "sitemap_index_html.gpfs",
        "sitemap_index_html.wufs",
        "sitemap_index_html.cramfs",
        "sitemap_index_html.efs",
        "sitemap_index_html.ntfs3g",
        "sitemap_index_html.ufs",
        "sitemap_index_html.romfs",
        "sitemap_index_html.squashfs",
        "sitemap_index_html.ubifs",
        "sitemap_index_html.yaffs",
        "admin/user",
        "admin/pictures",
        "admin/files",
        "admin/docs",
        "admin/logs",
        "user/admin",
        "user/pictures",
        "user/files",
        "user/docs",
        "user/logs",
        "pictures/admin",
        "pictures/user",
        "pictures/files",
        "pictures/docs",
        "pictures/logs",
        "files/admin",
        "files/user",
        "files/pictures",
        "files/docs",
        "files/logs",
        "docs/admin",
        "docs/user",
        "docs/pictures",
        "docs/files",
        "docs/logs",
        "logs/admin",
        "logs/user",
        "logs/pictures",
        "logs/files",
        "logs/docs",
        "admin/user/pictures",
        "admin/user/files",
        "admin/user/docs",
        "admin/user/logs",
        "admin/pictures/files",
        "admin/pictures/docs",
        "admin/pictures/logs",
        "admin/files/docs",
        "admin/files/logs",
        "admin/docs/logs",
        "user/admin/pictures",
        "user/admin/files",
        "user/admin/docs",
        "user/admin/logs",
        "user/pictures/files",
        "user/pictures/docs",
        "user/pictures/logs",
        "user/files/docs",
        "user/files/logs",
        "user/docs/logs",
        "pictures/admin/user",
        "pictures/admin/files",
        "pictures/admin/docs",
        "pictures/admin/logs",
        "pictures/user/files",
        "pictures/user/docs",
        "pictures/user/logs",
        "pictures/files/docs",
        "pictures/files/logs",
        "pictures/docs/logs",
        "admin/user/pictures/files",
        "admin/user/pictures/docs",
        "admin/user/pictures/logs",
        "admin/user/files/docs",
        "admin/user/files/logs",
        "admin/user/docs/logs",
        "admin/pictures/files/docs",
        "admin/pictures/files/logs",
        "admin/pictures/docs/logs",
        "user/pictures/files/docs",
        "user/pictures/files/logs",
        "user/pictures/docs/logs",
        "admin/user/pictures/files/docs",
        "admin/user/pictures/files/logs",
        "admin/user/pictures/docs/logs",
        "admin/pictures/files/docs/logs",
        "user/pictures/files/docs/logs",
        "admin/user/pictures/files/docs/logs",
        "/user/pictures/files/",
        "/user/pictures/",
        "admin/docs",
        "user/docs",
        "pictures/docs",
        "files/docs",
        "logs/docs",
        "admin/logs",
        "user/logs",
        "pictures/logs",
        "files/logs",
        "admin/user/pictures",
        "admin/user/files",
        "admin/user/docs",
        "admin/user/logs",
        "admin/pictures/files",
        "admin/pictures/docs",
        "admin/pictures/logs",
        "admin/files/docs",
        "admin/files/logs",
        "admin/docs/logs",
        "user/pictures/files",
        "user/pictures/docs",
        "user/pictures/logs",
        "user/files/docs",
        "user/files/logs",
        "user/docs/logs",
        "pictures/files/docs",
        "pictures/files/logs",
        "pictures/docs/logs",
        "/user/pictures/files",
        "/user/pictures/docs",
        "/user/pictures/logs",
        "/user/files/docs",
        "/user/files/logs",
        "/img/members/",
        "img",
        ]

    with open(filename, "w") as wordlist_file:
        for word in wordlist:
            wordlist_file.write(word + "\n")

direnumerate/createlist.py
JuanBindez/direnumerate
import requests

def get_info_ip(ip):
        url = f"https://ipinfo.io/{ip}/json"
        response = requests.get(url)
        data = response.json()
        return data
direnumerate/getinfo.py
JuanBindez/direnumerate


def is_valid_ip(ip):
        try:
            parts = ip.split('.')
            if len(parts) != 4:
                return False
            for part in parts:
                if not 0 <= int(part) <= 255:
                    return False
            return True
        except ValueError:
            return False


def calculate_ip_class(ip):
        """ Funtion to calculate the class of the ipaddress """
        first_octet = int(ip.split('.')[0])
        if 1 <= first_octet <= 126:
            return "A"
        elif 128 <= first_octet <= 191:
            return "B"
        elif 192 <= first_octet <= 223:
            return "C"
        elif 224 <= first_octet <= 239:
            return "D (Multicast)"
        elif 240 <= first_octet <= 255:
            return "E (Experimental)"
        else:
            return "Invalid"


def calculate_subnet_mask(ip):
        """Function to calculate the subnet mask of the a ipadress"""
        if not is_valid_ip(ip):
            return "Invalid IP address."
        
        first_octet = int(ip.split('.')[0])
        
        if 1 <= first_octet <= 126:
            return "255.0.0.0"
        elif 128 <= first_octet <= 191:
            return "255.255.0.0"
        elif 192 <= first_octet <= 223:
            return "255.255.255.0"
        else:
            return "Subnet mask not applicable."
        
def calculate_ip_count(ip):
    first_octet = int(ip.split('.')[0])
    
    if 1 <= first_octet <= 126:
        return 2 ** 24  # Classe A (16.777.214 endereços IP para hosts)
    elif 128 <= first_octet <= 191:
        return 2 ** 16  # Classe B (65.534 endereços IP para hosts)
    elif 192 <= first_octet <= 223:
        return 2 ** 8   # Classe C (254 endereços IP para hosts)
    else:
        return "Não aplicável"
    

def calculate_subnet_notation(subnet_notation):
    try:
        ip, subnet_mask = subnet_notation.split("/")
        ip_parts = ip.split(".")
        subnet_bits = int(subnet_mask)

        if 0 <= subnet_bits <= 32 and len(ip_parts) == 4:
            ip_count = 2 ** (32 - subnet_bits)
            return ip_count
        else:
            return "Notação de sub-rede inválida"
    except ValueError:
        return "Notação de sub-rede inválida"


def get_ip_class(ip):
    first_octet = int(ip.split('.')[0])
    if 1 <= first_octet <= 126:
        return 'A'
    elif 128 <= first_octet <= 191:
        return 'B'
    elif 192 <= first_octet <= 223:
        return 'C'
    elif 224 <= first_octet <= 239:
        return 'D (Multicast)'
    elif 240 <= first_octet <= 255:
        return 'E (Experimental)'
    else:
        return 'Inválido'

# Função para calcular as notações de sub-rede possíveis com base na classe
def calculate_possible_subnets(ip_class):
    if ip_class == 'A':
        return ['/8', '/16', '/24']
    elif ip_class == 'B':
        return ['/16', '/24']
    elif ip_class == 'C':
        return ['/24']
    else:
        return []

direnumerate/ipcalculator.py
JuanBindez/direnumerate
#!/usr/bin/env python
"""This module contains setup instructions for direnumerate."""

import codecs
import os

from setuptools import setup

here = os.path.abspath(os.path.dirname(__file__))

with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
    long_description = "\n" + fh.read()

with open(os.path.join(here, "direnumerate", "version.py")) as fp:
    exec(fp.read())



setup(name = "direnumerate",
      version = __version__,  # noqa: F821
      author = "Juan Bindez",
      author_email = "juanbindez780@gmail.com",
      packages = ["direnumerate"],
      package_data = {
          "direnumerate": ["https://github.com/JuanBindez/direnumerate/raw/main/img/logo.png", "LICENSE"],
      },
      url = "https://github.com/juanbindez/direnumerate",
      license = "GPLv2 license",
      entry_points={
          "console_scripts": [
          "direnumerate = direnumerate.cli:main"],},
      install_requires=[
          'requests',
      ],
      
      classifiers = [
          "Development Status :: 5 - Production/Stable",
          "Environment :: Console",
          "Intended Audience :: Developers",
          "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
          "Natural Language :: English",
          "Operating System :: OS Independent",
          "Programming Language :: Python :: 3.7",
          "Programming Language :: Python :: 3.8",
          "Programming Language :: Python :: 3.9",
          "Programming Language :: Python :: 3.10",
          "Programming Language :: Python :: 3.11",
          "Programming Language :: Python",
          "Topic :: Internet",
          "Topic :: Multimedia :: Video",
          "Topic :: Software Development :: Libraries :: Python Modules",
          "Topic :: Terminals",
          "Topic :: Utilities",
      ],
      description = ("Python 3 library for directory enumeration tool in web applications."),
      include_package_data = True,
      long_description_content_type = "text/markdown",
      long_description = long_description,
      zip_safe = True,
      python_requires = ">=3.7",
      project_urls = {
           "Bug Reports": "https://github.com/juanbindez/direnumerate/issues",
           "Read the Docs": "https://github.com/JuanBindez/direnumerate/tree/main/docs/user",
      },
      keywords = ["web", "enumerate", "directory", "tools", "cli", "scan",],)

setup.py
JuanBindez/direnumerate
from direnumerate import InfoIp

ip = "8.8.8.8"

calc = InfoIp(ip)
calc.show_info()
test.py
JuanBindez/direnumerate