play network traffic as sound
Project description
Play network traffic as sound.
Install:
$ pip install dj-arp-storm
$ git clone git@gitlab.com:LISTERINE/dj_as.git ~/.dj_as
Usage:
$ dj_as
Configuration:
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 callbacks.py files.
dj.conf
dj.conf holds the configuration values read by DJ ARP Storm.
DJ ARP Storm will look for a dj.conf file in two places, the first is ~/.dj_as/dj.conf, the second location is the directory that the dj_as binary was installed to. If it is found in the first location it will not look in the second.
The [general] section settings control things like where sound assets are loaded from and how long to run.
The [arrangements] section holds the names of the functions you want to be active.
callbacks.py
callbacks.py 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. https://github.com/KimiNewt/pyshark
Take this method for example:
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:
def handshake_scale(self, pkt):
while not self.has_flags(pkt, 2):
pkt = yield
pkt = yield self.sounds.play(self.sounds.sounds['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:
import pdb; pdb.set_trace()
to your method and interrogate the packet with the python debugger.
Assets:
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:
Assets-| |- first_instrument-| | |- sound_1.ogg | |- another_sound.ogg | |... |- instrument_2-| | |- sound_one.ogg | |- another_sound.ogg | |... |...
Recommendations:
place:
ServerAliveInterval 1
in your /etc/ssh/ssh_config and open an ssh connection to get consistent traffic for a good tempo.
History
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
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
Built Distribution
Hashes for dj_arp_storm-1.0b3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67b63f99269de422d0af3ca6936068c6eb2abb915099cf112bbfcf733c7d2c3e |
|
MD5 | 5f0ac864771e77cb4fe8c5b99923bcf3 |
|
BLAKE2b-256 | 9dacced413abdb9b31f0ee8b7c19eb2cc3d1c80f52466198159a565f6e141b0f |