Retrieves and parses network statistics related to IPv4 TCP and UDP connection returns this information as a Pandas DataFrame
Project description
Retrieves and parses network statistics related to IPv4 TCP and UDP connection returns this information as a Pandas DataFrame
Tested against Windows 10 / Python 3.10 / Anaconda
pip install netstat2df
Retrieve and parse network statistics related to IPv4 TCP and UDP connections.
This function uses the 'netstat' command-line utility to gather information about
IPv4 TCP and UDP connections, including local and foreign addresses, ports, process
IDs (PIDs), and executable names. It then processes and returns this information
as a Pandas DataFrame.
Returns:
pd.DataFrame: A DataFrame containing the following columns:
- 'aa_proto': Protocol type ('TCP' or 'UDP').
- 'aa_local_address': Local IP address.
- 'aa_local_port': Local port number.
- 'aa_foreign_address': Foreign IP address.
- 'aa_foreign_port': Foreign port number.
- 'aa_pid': Process ID (PID) of the associated process.
- 'aa_executable': Executable name of the associated process.
- 'aa_status': Status of the connection (may be empty or NaN if unavailable).
Note:
- If any error occurs during the retrieval or parsing of network statistics,
the function returns an empty DataFrame.
Example:
>>> from netstat2df import get_netstat_ipv4_df
>>> df = get_netstat_ipv4_df()
>>> print(df.head())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
netstat2df-0.10.tar.gz
(4.7 kB
view details)
Built Distribution
File details
Details for the file netstat2df-0.10.tar.gz
.
File metadata
- Download URL: netstat2df-0.10.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d448dcfa947bd2aa7d33cc60cab7219a3934e963a927445bd2db9107c31e248b |
|
MD5 | 83ba77837d6bc4386023566c6723f340 |
|
BLAKE2b-256 | 63719a2c2961d6fe605a285f73353cf93b605cb29c3a479b12820f5f22e3eb93 |
File details
Details for the file netstat2df-0.10-py3-none-any.whl
.
File metadata
- Download URL: netstat2df-0.10-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d6f4814945d28b77cccb13ae901f6b1642b43e2349d2fda28b8e8f666894620 |
|
MD5 | b491d4bccad56b82b91f24c72b35df26 |
|
BLAKE2b-256 | a1970b466bfab6560299d0ab00c4c8e5e589a56fa9a7dd5149ec134b0aec0080 |