PYScanVLAN is a Python3 program designed for scanning VLANs on a network port by checking all or specified VLAN tags. It is designed to be run on a Linux system that supports the iproute2 commands like ip
- Configure the options in the
config.ini
file. - Run the program using the command
python3 PYScanLAN.py
. - The program will scan the specified VLANs and output the results to a JSON.
This section provides explanations for the various configuration options available in the script. Set in the config.ini file
- Description: Set this variable to the desired network interface.
- Example:
INTERFACE = 'eth1'
- Description: Specifies the wait time (in seconds) for DHCP lease acquisition.
- Example:
DHCP_WAIT_TIME = 15
- Description: When set to
True
, the script calculates the total possible hosts in each network based on the subnet mask. - Example:
CALCULATE_POSSIBLE_HOSTS = True
- Description: When set to
True
, the script adds the regular subnet mask (e.g., "255.255.255.0") from the CIDR notation (e.g., "/24"). - Example:
CALCULATE_SUBNET_MASK = True
- Description: Specifies the range of VLAN IDs to check.
- Example:
VLAN_CHECK_RANGE_START = 1 VLAN_CHECK_RANGE_END = 4096
- Description: Path to the DHCP client lease file. The script uses this file to obtain DHCP configuration details.
- Example:
LEASE_FILE_PATH = '/var/lib/dhcp/dhclient.leases'
Ensure that this path points to the correct location of the DHCP client lease file on your system. The script relies on the information stored in this file for DHCP-related operations.
- Python 3.x
- Linux operating system (Preferably Debian; it was developed on Debian)
- iproute2 on linux
{
"detected_networks": [
{
"vlan_id": "default",
"ip_address": "100.110.152.81",
"domain": "he.orld.fl.wtsky.net"
},
{
"vlan_id": 6,
"rx_bytes": 38725,
"ip_address": "10.110.6.109",
"cidr_subnet_mask": 24,
"possible_host_count": 254,
"subnet_mask": "255.255.255.0",
"domain": "orld.fl.wtsky.net"
},
{
"vlan_id": 10,
"rx_bytes": 901,
"ip_address": "10.110.10.245",
"cidr_subnet_mask": 24,
"possible_host_count": 254,
"subnet_mask": "255.255.255.0"
}
]
}