mirror of https://github.com/berdav/snappy-fox
19 lines
316 B
Python
19 lines
316 B
Python
import sys
|
|
import random
|
|
|
|
prob = int(sys.argv[3])
|
|
substbyte = int(sys.argv[4])
|
|
|
|
with open(sys.argv[1], "rb") as f:
|
|
indata = bytearray(f.read())
|
|
|
|
for b in range(len(indata)):
|
|
x = random.randint(0, 10000)
|
|
if x < prob:
|
|
# Alter the data
|
|
indata[b] = substbyte
|
|
|
|
with open(sys.argv[2], "wb") as f:
|
|
f.write(indata)
|
|
|