Python implementation of zzuf mutator - little bit-flip atomic bomb
Project description
Python implementation of bit-flip zzuf mutator.
No more os.system, subprocess.check_output and
subprocess.Popen
Basic usage
Inline
from pyZZUF import *
print pyZZUF('good').mutate()
Options
from pyZZUF import *
zzuf = pyZZUF('good')
# Random seed (default 0)
zzuf.set_seed(9)
# Bit fuzzing ratio (default 0.004)
zzuf.set_ratio(0.91)
# Offsets and ranges
zzuf.set_offset(6)
# Only fuzz bytes at offsets within <ranges>
zzuf.set_fuzz_bytes([[0, 3], [6, EOF]])
# Protect bytes and characters in <list>
zzuf.set_protected([0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39])
# Append more bytes
zzuf.set_protected("0123456789", True)
# Refuse bytes and characters in <list>
zzuf.set_refused("abcd")
# Append more bytes
zzuf.set_refused([0x00, 0xFF], True)
# Permit bytes and characters in <list>
zzuf.set_permitted('bad')
# Append more bytes
zzuf.set_permitted('!', True)
# Fuzzing mode <mode> ([xor] set unset)
zzuf.set_fuzz_mode(FUZZ_MODE_XOR)
print zzuf.mutate()
Mutagen
zzuf = pyZZUF('good')
for data in zzuf.mutagen(start=0.0, stop=1, step=0.1):
if __debug__:
seed, ratio, index = data.get_state()
print data.tostring().encode('hex'), seed, ratio, index
if data == 'bad!':
break
Inheritance of the previous state (meat)
zzuf = pyZZUF('good')
for data in zzuf.mutagen(start=0.0, stop=1, step=0.1, inheritance=True):
if __debug__:
seed, ratio, index = data.get_state()
print data.tostring().encode('hex'), seed, ratio, index
if data == 'bad!':
break
Stream-generator with restoring state of mutator
obj = pyZZUF('good')
gen = obj.mutagen(start=0.0, stop=1, step=0.01)
while True:
try:
data = gen.next()
seed, ratio, index = data.get_state()
if __debug__:
print data.tostring().encode('hex'), seed, ratio, index
if seed == 20:
# Set next state of generator (<seed>, <ratio>).
# In this example, it makes an infinite loop!
gen.send((0, 0.0))
if data == 'bad!':
break
except StopIteration:
break
Check of identity
$ echo -n "The quick brown fox jumps over the lazy dog" | zzuf -r0.04 | hd
00000000 54 68 65 20 71 75 69 63 6b 20 62 72 6f 57 6c 20 |The quick broWl |
00000010 66 4f 58 20 6a 75 6f 70 73 24 6f 76 75 72 20 74 |fOX juops$ovur t|
00000020 68 65 21 6c 61 7a 78 20 66 6f 67 |he!lazx fog|
0000002b
$ python -c "import pyZZUF, sys; sys.stdout.write(pyZZUF.pyZZUF('The quick brown fox jumps over the lazy dog', ratio=0.04).mutate().tostring())" | hd
00000000 54 68 65 20 71 75 69 63 6b 20 62 72 6f 57 6c 20 |The quick broWl |
00000010 66 4f 58 20 6a 75 6f 70 73 24 6f 76 75 72 20 74 |fOX juops$ovur t|
00000020 68 65 21 6c 61 7a 78 20 66 6f 67 |he!lazx fog|
0000002b
Installation
pip install pyZZUF
Notes*
Use PyPy for speedup
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
pyZZUF-0.1-py2.7.tar.gz
(4.3 kB
view details)
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pyZZUF-0.1-py3-none-any.whl
(4.3 kB
view details)
pyZZUF-0.1-py2.7.egg
(8.0 kB
view details)
File details
Details for the file pyZZUF-0.1-py2.7.tar.gz.
File metadata
- Download URL: pyZZUF-0.1-py2.7.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06614a6dc9dc6136ac27ff8ac773454709fb21a285359c16ee4e058e128a941d
|
|
| MD5 |
6209888d7003430ec644eaace37eac2b
|
|
| BLAKE2b-256 |
88e3b90b1fe2a6bf9a67a9da297185d82b24c7c5d911b58618272445b1278c5d
|
File details
Details for the file pyZZUF-0.1-py3-none-any.whl.
File metadata
- Download URL: pyZZUF-0.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba393f731a145b00f4cf03ac227bebde0c47238a616f27b671f3a2f4a29b4480
|
|
| MD5 |
78ced9264d2658d110691ccfbe4dc61d
|
|
| BLAKE2b-256 |
37c476457104c8017a7ac1bc8d1e0ce04bb32384979a4023baa9d8be56315d90
|
File details
Details for the file pyZZUF-0.1-py2.7.egg.
File metadata
- Download URL: pyZZUF-0.1-py2.7.egg
- Upload date:
- Size: 8.0 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc27fd45e2b8127aa13e409c1b79379f5fa07bda9de3b21d65b6cbc1ca05bb3e
|
|
| MD5 |
9f8caee836fa0aee0d8cfeb12ab2fed9
|
|
| BLAKE2b-256 |
d380c6db42e65c2c7c2fe4cb547716f51e4005f194e2974e498094bd4087f758
|