{"id":26820400,"url":"https://github.com/zvdy/pynternet-sniffer","last_synced_at":"2025-03-30T06:32:11.201Z","repository":{"id":256287027,"uuid":"854837606","full_name":"zvdy/pynternet-Sniffer","owner":"zvdy","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-15T13:21:32.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-16T10:58:16.164Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zvdy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-09T21:26:45.000Z","updated_at":"2024-09-15T13:21:36.000Z","dependencies_parsed_at":"2024-09-12T05:51:58.860Z","dependency_job_id":null,"html_url":"https://github.com/zvdy/pynternet-Sniffer","commit_stats":null,"previous_names":["zvdy/pynternet-sniffer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zvdy%2Fpynternet-Sniffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zvdy%2Fpynternet-Sniffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zvdy%2Fpynternet-Sniffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zvdy%2Fpynternet-Sniffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zvdy","download_url":"https://codeload.github.com/zvdy/pynternet-Sniffer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246285645,"owners_count":20752947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-30T06:31:50.925Z","updated_at":"2025-03-30T06:32:11.187Z","avatar_url":"https://github.com/zvdy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pynternet Sniffer\n\n![pylint](pylint.svg) ![py-ver](https://img.shields.io/badge/Python-3.12-blue)  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nPynternet Sniffer is a Python script that monitors network activity, logs the activities, and retrieves IP, MAC, and creator information using the ARP protocol.\n\n## Features\n\n- Monitors network connections and logs established connections.\n- Retrieves IP and MAC addresses using ARP requests for IPv4 and ICMPv6 for IPv6.\n- Logs network activity to a timestamped log file.\n- Optionally logs network activity to the terminal.\n- Gracefully exits on pressing 'q' or 'Esc'.\n- Validates IP addresses before processing.\n- Logs only the first request of each MAC address if specified.\n- Scans the local network for devices within a specified IP range.\n- Adds MAC manufacturer information to log entries.\n\n## Requirements\n\n- Python 3.x\n- [`psutil`] library\n- [`scapy`] library\n\n## Installation\n\n1. **Clone the repository**:\n    ```sh\n    git clone https://github.com/zvdy/pynternet-sniffer.git\n    cd pynternet-sniffer\n    ```\n\n2. **Create a virtual environment** (optional but recommended):\n    ```sh\n    python -m venv venv\n    source venv/bin/activate\n    ```\n\n3. **Install the required libraries**:\n    ```sh\n    pip install -r requirements.txt\n    ```\n\n## Usage\n\n1. **Run the script with elevated privileges**:\n    ```sh\n    sudo /venv/bin/python main.py\n\n    # or\n\n    sudo python main.py\n    ```\n\n2. **Generate network activity** (e.g., using [`ping`]):\n    ```sh\n    ping -c 4 google.com\n    ```\n\n3. **Check the log file**:\n    The network activity will be logged in a file named `network_activity_\u003ctimestamp\u003e.log`.\n\n4. **Exit the script**:\n    Press 'q' or 'Esc' to gracefully exit the script.\n\n### Additional Options\n\n- **Log activity to the terminal**:\n    ```sh\n    sudo python3 main.py -t\n    ```\n\n- **Log only the first request of each MAC address**:\n    ```sh\n    sudo python3 main.py -m\n    ```\n\n- **Specify IP range to scan for devices**:\n    ```sh\n    sudo python3 main.py -r 192.168.1.1/24\n    ```\n\n- **Combine options**:\n    ```sh\n    sudo python3 main.py -t -m -r 192.168.1.1/24\n    ```\n\n## Example\n\n```sh\nsudo python3 main.py -t\n```\n\nIn another terminal:\n\n```sh\nping -c 4 google.com\n```\n\nCheck the `network_activity\u003ctimestamp\u003e.log` file for logged network activity.\n\n## Additional Scripts\n\n### `who.sh`\n\nThe `who.sh` script processes a list of IP addresses from an input file and retrieves information about each IP using the `whois` command. The results are saved to an output file.\n\n#### Usage\n\n1. **Ensure the input file [`dump/remote_ip.txt`] exists**:\n    This file should contain a list of IP addresses, one per line.\n\n2. **Run the script**:\n    ```sh\n    ./scripts/who.sh\n    ```\n\n3. **Check the output file**:\n    The information for each IP will be saved in [`dump/remote-info.txt`].\n\n### `filter.sh`\n\nThe `filter.sh` script lists available network activity log files, prompts the user to select one, and then extracts unique local IP/MAC addresses and remote IP addresses from the selected log file. The results are saved in separate files.\n\n#### Usage\n\n1. **Run the script**:\n    ```sh\n    ./scripts/filter.sh\n    ```\n\n2. **Follow the prompts**:\n    Select the log file you want to process from the list.\n\n3. **Check the output files**:\n    - [`dump/local_ip_mac.txt`] will contain unique local IP and MAC addresses.\n    - [`dump/remote_ip.txt`] will contain unique remote IP addresses.\n\n### License\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzvdy%2Fpynternet-sniffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzvdy%2Fpynternet-sniffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzvdy%2Fpynternet-sniffer/lists"}