ramp.py

I needed some simple binary data for testing, so I wrote this python script to generate a simple ramp. It started with just 256 bytes, 00 through FF, then I added options to get more variety, and here it is.

ramp out.dat

will write out.dat as a 256-byte ramp.

ramp -n 100 out.dat

will write out.dat as a 100-byte ramp.

ramp -n 16 -d -r 3 out.dat

will write out.dat as a 48-byte file, 0x0F down to 0x00 repeated three times.

ramp -q "0x10 1+1 0 255" -r 100 out.dat

will write out.dat as a 400-byte file, 0x10 0x02 0x00 0xFF repeated 100 times.

ramp -t "hi" -q 0 -r 10 out.dat

will write out.dat as a 30-byte file, 0x68 0x69 0x00 repeated 10 times.

All of the numbers expected on the command line are parsed by eval(), so you can use decimal or hex, or arithmetic expressions!

Download: ramp.py

And what better way to see the great data you’ve created than with hexdump.py?

Comments

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.