Skip to content

Commit

Permalink
update merge
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanBindez committed May 29, 2024
2 parents 505c821 + e4bbe30 commit 96c95a5
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 32 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Direnumerate



![PyPI - Downloads](https://img.shields.io/pypi/dm/direnumerate)
![PyPI - License](https://img.shields.io/pypi/l/direnumerate)
[![Documentation Status](https://readthedocs.org/projects/direnumerate/badge/?version=latest)](https://direnumerate.readthedocs.io/en/latest/?badge=latest)
![GitHub Tag](https://img.shields.io/github/v/tag/JuanBindez/direnumerate?include_prereleases&link=https%3A%2F%2Fgithub.com%2FJuanBindez%2Fdirenumerate%2Ftags)
<a href="https://pypi.org/project/direnumerate/"><img src="https://img.shields.io/pypi/v/direnumerate" /></a>

[PDF documentation](https://direnumerate.readthedocs.io/_/downloads/en/latest/pdf/)

#### Test in Colab

https://colab.research.google.com/github/JuanBindez/direnumerate-colab/blob/main/direnumerate.ipynb

## Description

Expand All @@ -27,11 +32,6 @@ Direnumerate is an open source tool written in Python designed to automate direc

-----------------

## install in ubuntu:

pip install direnumerate --break-system-packages
----------

## Command line usage:

### Directory Scan:
Expand All @@ -42,7 +42,6 @@ Direnumerate is an open source tool written in Python designed to automate direc

direnumerate -t 44.228.249.3 -p 22 80 443


## Scripts usage:

### Directory Scan in Websites:
Expand Down
1 change: 0 additions & 1 deletion direnumerate.log

This file was deleted.

3 changes: 3 additions & 0 deletions direnumerate/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def dirs(self,
response = requests.get(full_url)

if response.status_code == 200:

result = f'[Found] {full_url}'
results_list.append(result)
print(f"{Color.GREEN}[Found]:{Color.RESET} {full_url}")
Expand All @@ -165,6 +166,7 @@ def dirs(self,
print(error_message)
if log:
self.logger.warning("Attempt interrupted by user.")

except requests.exceptions.ConnectionError as rec:
error_message = f"{Color.RED}[Error] {rec}{Color.RESET}"
print(error_message)
Expand All @@ -178,6 +180,7 @@ def dirs(self,
path = line.strip()
full_url = f"{self.url}/{path}"
response = requests.get(full_url)


result = ""
if response.status_code == 200:
Expand Down
100 changes: 100 additions & 0 deletions direnumerate/ipcalculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@

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 []
2 changes: 2 additions & 0 deletions direnumerate/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

__version__ = "4.0-rc4"


if __name__ == "__main__":
print(__version__)
6 changes: 0 additions & 6 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,3 @@ InfoIp Object
:members:
:inherited-members:

UserScan Object
---------------

.. autoclass:: UserScan
:members:
:inherited-members:
10 changes: 5 additions & 5 deletions docs/user/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ Directory scan:

.. code:: bash
$ direnumerate Ds -t "testphp.vulnweb.com" -w wordlist.txt
$ direnumerate -t "testphp.vulnweb.com" -w wordlist.txt
Directory scan with all outputs verbose, (-v command):

.. code:: bash
$ direnumerate Ds -v -t "testphp.vulnweb.com" -w wordlist.txt
$ direnumerate -v -t "testphp.vulnweb.com" -w wordlist.txt
Port scan:

.. code:: bash
$ direnumerate Ps -t 44.228.249.3 -p 22 80 443
$ direnumerate -t 44.228.249.3 -p 22 80 443
Finds patterns in logs:

.. code:: bash
$ direnumerate Fp -log test.log -key ERROR
$ direnumerate -log test.log -key ERROR
Ip info:

.. code:: bash
$ direnumerate info -t 8.8.8.8
$ direnumerate -i 8.8.8.8
To list all command line options, simply type
Expand Down
13 changes: 0 additions & 13 deletions docs/user/userscan.rst

This file was deleted.

0 comments on commit 96c95a5

Please sign in to comment.