fritznetdevices
- A Python script to retrieve user-friendly all connected devices from a Fritz!Box with additional (neccessary) information
A Python script designed to seamlessly retrieve all connected devices from a Fritz!Box network.
It provides detailed information in a user-friendly format and exports the data to various file types for easy access and analysis.
With enhanced features such as device categorization and reachability checks, this script is perfect to get a comprehensive overview of your network.
Summary:
- It is really useful if you want to migrate your devices to a new router or if you want to keep track of your network devices.
- It provides information that is not available in the Fritz!Box user interface.
It saves you a lot of time and effort by automating the process of retrieving and organizing the data.
You have no need to work with tools like Wireshark, nmap, arp-scan, etc. to get the information you need.
It can take a while to retrieve all the information, especially if you have a lot of devices in your network. So a few minutes of patience is required.
The following file types are generated by the script:
csv
json
xlsx
(Excel)
Simply run the following command in your terminal to clone the repository and install the required packages:
git clone https://github.com/fuchs-fabian/fritznetdevices.git && pip install fritzconnection requests openpyxl pandas
fritzconnection
is a Python library to communicate with the Fritz!Box. It is used to retrieve the necessary information.
For more information about the library, visit the official repository.
To use the script, you need to adjust the config.ini
file to your Fritz!Box credentials.
[fritzbox]
address = 192.168.178.1
username = myuser
password = mypassword
[network]
cidr = 192.168.178.0/24
[features]
manufacturer_and_category = true
web_interface = true
hostname_and_ip_addresses = true
determine_unused_ip_addresses = true
ping_all_devices = false
Adjust minimal the following values:
username
with your Fritz!Box usernamepassword
with your Fritz!Box password
Note: It could be a good idea to create a new user for this script. This user should have only the necessary permissions.
The other values can be adjusted as needed but are not required.
There is also a device_categories.json
file. You can adjust this file to your needs. With this file it is possible to determine if a device is an IoT device, a network device, a server, etc.
Feature | Description | Time Intensity |
---|---|---|
manufacturer_and_category |
Determines the manufacturer and category of the device based on the MAC address. | Low |
web_interface |
Determines if the device has a web interface. | Medium |
hostname_and_ip_addresses |
Determines the hostname and IP addresses of the device. | Medium |
determine_unused_ip_addresses |
Determines unused IP addresses in the network. | High |
ping_all_devices |
Determines if all devices are reachable. | High |
First you need to go to the directory where the script is located.
Then you can run the script with the following command:
python fritznetdevices.py
Let the magic happen! 🎩✨
You can take a look at the exports
folder. There you will find the generated files.
Note: No sensitive data will be sent to the developer or any other third party. The script is designed to run locally on your machine. The only data that will be sent to a third party are the first three octets of the MAC address to determine the manufacturer.
If you want to disable this feature, you can set the
manufacturer_and_category
feature tofalse
.
To retrieve this manufacturer information, the script uses the macvendors.com API.
No costs will be incurred for using these services. Till 1000 requests per day are free. You don't have to register for this service.
Note: Caching is used to reduce the number of requests to the services. The cache is stored in the
cache
folder.
The following information is listed for each device if all features are enabled (in the devices
directory):
- IP Address (
ip
): The device’s IP address. - Name (
name
): The device’s given name or identifier. - MAC Address (
mac
): Unique hardware address of the device. - Status (
status
): Indicates if the device is currently active or inactive. - Connection Type (
connection_type
): Type of connection, e.g., LAN or WLAN. - Address Source (
address_source
): Source from which the IP address is assigned, e.g., DHCP. - Manufacturer (
manufacturer
): The device’s manufacturer, inferred from its MAC address. - Category (
category
): Category or type of device, if available. - Web Interface (
web_interface
): Indicates if the device has a web interface for direct access. - Primary Hostname (
primary_hostname
): The primary hostname associated with the device's IP. - All Hostnames by IPv4 Address (
all_hostnames_by_ipv4_address
): List of all hostnames tied to the device’s IPv4 address. - Is Reachable Over Ping (
is_reachable_over_ping
): Specifies if the device responds to a network ping (reachable or not).
There are also a few other files generated that are useful for more detailed analysis.
All the exported files are stored in the exports
folder.
If you have any bugs, suggestions or feedback, feel free to create an issue or create a pull request with your changes.
If you like fritznetdevices
, you think this tool is useful and saves you a lot of work and nerves and lets you sleep better, please give it a star and consider donating.