Skip to main content

Send Cisco Discovery Protocol packets with Scapy

Project description

CDP Sender Module

CI

Overview

scapy-cdp provides a small command line utility to send Cisco Discovery Protocol (CDP) packets using Scapy. It installs a cdp-sender command that transmits a CDP packet every 60 seconds. The module works well on Linux systems, including Raspberry Pi.

Installation

Install the package with pip:

sudo pip3 install scapy-cdp

This creates the /usr/local/bin/cdp-sender executable.

Usage

Display available options:

sudo cdp-sender --help

Example:

sudo cdp-sender --interface eth0 --device-id MyDevice --software-version "1.2.3" --platform "MyPlatform"

Settings can also come from a JSON configuration file:

{
  "interface": "eth0",
  "device_id": "MyDevice",
  "software_version": "1.2.3",
  "platform": "MyPlatform",
  "ttl": 120,
  "capabilities": "0x0038"
}

Run with the configuration file:

sudo cdp-sender --config config.json

Systemd Service

Create /etc/systemd/system/cdp_sender.service:

[Unit]
Description=CDP Sender Service
After=network.target

[Service]
ExecStart=/usr/local/bin/cdp-sender
Restart=always
User=root

[Install]
WantedBy=multi-user.target

Then enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable cdp_sender
sudo systemctl start cdp_sender

Cron Alternative

To run the script every minute with cron:

sudo crontab -e

Add this line:

* * * * * /usr/local/bin/cdp-sender

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scapy_cdp-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scapy_cdp-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file scapy_cdp-0.1.0.tar.gz.

File metadata

  • Download URL: scapy_cdp-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for scapy_cdp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c77fbd45931bc9e94997893763c24adfb15225f7619e9ccbbc02393fca3dcab8
MD5 b9f77a137c4a9c792951d7709e34ac4d
BLAKE2b-256 29c1925eae2ef1f5f0ddcee93424ed68491971de36af21f8200281d4859a258b

See more details on using hashes here.

File details

Details for the file scapy_cdp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: scapy_cdp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for scapy_cdp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8c2079600b125c6b3b17bad5ada1504e73708031bb168d8aec78ea39409ce33
MD5 cec3dca46abb9119af6eaba7618d3534
BLAKE2b-256 587bc9a740679bcf3f306e6f4f62e9b68ca97a08a25d6a3261fd121cd0fde0e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page