Skip to main content

play network traffic as sound

Project description

DJ ARP Storm

.. image::

Play network traffic as sound.

.. code-block:: bash

$ pip install dj-arp-storm
$ git clone ~/.dj_as
# Install tshark. For ubuntu install tshark package, for arch, install wireshark-cli
$ sudo pacman -S wireshark-cli
$ sudo usermod -a -G wireshark <your-user-name>
# Log out and log in for group change to take effect

.. code-block:: bash

$ dj_as


Please note that your callbacks will be imported into DJ ARP Storm, so before running the program, make sure you trust the contents of your ``dj.conf`` and ```` files.

``dj.conf`` holds the configuration values read by DJ ARP Storm.

dj.conf Sections
The general section settings control things like where sound assets are loaded from and how long to run.
assets; ~/.dj_as/assets
callbacks; ~/.dj_as/
default_interface; en3
timeout; 500


:assets: The directory where sound folders are held.

- Default: ``~/.dj_as/assets``

:callbacks: The file that holds user created functions for playing sounds.

- Default: ``~/.dj_as/assets``

:default_interface: Which network interface to capture on.

- Default: ``auto`` (automatically select the system default gateway)
- ``select`` (prompts user to select from a list of interfaces)
- ``<eth0, en0, wlan0, etc...>`` (setting default_interface to the name of an interface like ``eth0`` will connect to that specific interface)

:timeout: The number of packets to process before quitting.

- Default: ``500``
- ``-1`` (run forever)

The arrangements section holds the names of the functions you want to be active.
```` holds a class called ``Callbacks``. This where you can put functions that will react to packets. These callback functions should be instance methods that take a single parameter to pass in the latest packet. The callbacks must also be generators. This allows more complicated callbacks to be stateful. The packet passed in is a pyshark ``Packet`` object.

Take this method for example:

.. code-block:: python

def ssh_drum(self, pkt):
while not self.has_port(pkt, 22, ptype="dstport"):
pkt = yield
pkt = yield self.sounds.delay_play(self.sounds.sounds['drum']['snare-1.ogg'])

This simple method will check the latest packet ``pkt`` for a destination port of 22. Until it see this packet, DJ ARP Storm will yield new packets into it. Once a packet meeting this requirement is seen, it will play a snare sound.

Now look at this more complicated example:

.. code-block:: python

def handshake_scale(self, pkt):
while not self.has_flags(pkt, 2):
pkt = yield
pkt = yield['violin']['b3.ogg'])
while not self.has_flags(pkt, 18):
pkt = yield
pkt = yield self.sounds.delay_play(self.sounds.sounds['violin']['a3.ogg'], 0.2)
while not int(pkt.tcp.flags, 16):
pkt = yield
pkt = yield self.sounds.delay_play(self.sounds.sounds['violin']['c-3.ogg'], 0.2)

By breaking it up into sections you can see it follows the same pattern as the ``ssh_drum`` method above: while not matching packet, get new packet; then play sound. This just has multiple layers in it. Once one layer has ben completed, it will start testing for the next. Just remember it will resume from where it left off the last time, and not start from the top again until it has completed all it's steps.

If you'd like to inspect the packets coming through try adding:

.. code-block:: python

import pdb; pdb.set_trace()

to your method and interrogate the packet with the python debugger.

Assets are the sound files that DJ ARP Storm will play in your callbacks. All sound files must be in .ogg format. The assets folder should be setup in the following hierarchy:


|- first_instrument-|
| |- sound_1.ogg
| |- another_sound.ogg
| |...
|- instrument_2-|
| |- sound_one.ogg
| |- another_sound.ogg
| |...


ServerAliveInterval 1

in your ``/etc/ssh/ssh_config`` and open an ssh connection to get consistent traffic for a good tempo.


1.0b1 (2017-07-17)

* First release on PyPI.

1.0b2 (2017-07-19)

* Removed bpf filters because pyshark is blocking
* Shortened sound file names

1.0b2 (2017-07-19)

* Updated license
* Updated link to source

1.0b3 (2017-07-20)
* Bug fixes

1.0b4 (2017-07-21)
* Docs
* New interface options
* Suppress annoying output

Project details

Download files

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

Files for dj-arp-storm, version 1.0b8
Filename, size File type Python version Upload date Hashes
Filename, size dj_arp_storm-1.0b8-py2.py3-none-any.whl (11.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size dj_arp_storm-1.0b8.tar.gz (57.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page