Ejemplo n.º 1
0
def test_default_attrs():
    assert pyradamsa.Radamsa().mut_offset == 4096

    r = pyradamsa.Radamsa(17, 2048)
    assert r.seed == 17
    assert r.mut_offset == 2048

    r = pyradamsa.Radamsa(mut_offset=19)
    assert r.mut_offset == 19
    assert r.seed == None
Ejemplo n.º 2
0
def raw():
    rad = pyradamsa.Radamsa()
    runs = int(args.runs)
    rcount = 0
    for i in range(runs):
        rcount += 1
        dt = datetime.datetime.now()
        seed = input("Input Raw Input: ")
        #seed = "0300ec7f0a01000000000000000000000002000000000000000000000000eb94200a0000203201a000000a01001800000101ff0220007c01"
        seedHex = bytes.fromhex(seed)
        rfuzz = plc.sendSocketCommand(seedHex)
        foutput = "FUZZ RUN #: " + str(rcount) + "\n" + "TIMESTAMP: " + str(dt) + "\n" + "FUZZ BYTESTRING: \n" + str(seedHex) + "\n"
        print(foutput)
    plc.closeConnection()
Ejemplo n.º 3
0
def atomic_bomb():
    rad = pyradamsa.Radamsa()
    runs = int(args.runs)
    rcount = 0
    for i in range(runs):
        rcount += 1
        dt = datetime.datetime.now()
        seed = "02005979000000000001000000000000000100000000000000000000000058c000000000200a000001010454060001000000000000000000"
        seedHex = bytes.fromhex(seed)
        fValue = rad.fuzz(seedHex)
        rfuzz = plc.sendSocketCommand(fValue)
        foutput = "FUZZ RUN #: " + str(rcount) + "\n" + "TIMESTAMP: " + str(dt) + "\n" + "FUZZ BYTESTRING: \n" + str(fValue) + "\n"
        print(foutput)
        sleep(0.08)
    plc.closeConnection()
Ejemplo n.º 4
0
def mutate_radamsa(mutate_corpus):
    rada = pyradamsa.Radamsa()
    mutate_data = bytearray(random.choice(mutate_corpus))
    return rada.fuzz(mutate_data)
Ejemplo n.º 5
0
def test_returned_len():
    data = b"\xaa\x00"*100
    assert len(pyradamsa.Radamsa(seed=1337).fuzz(data)) == 201
Ejemplo n.º 6
0
def test_seed_static(data):
    r = pyradamsa.Radamsa(1337)
    assert r.fuzz(data) == r.fuzz(data)
Ejemplo n.º 7
0
def test_seed_wraparound(data):
    r = pyradamsa.Radamsa()
    assert r.fuzz(data, -1) == r.fuzz(data, sys.maxsize * 2 + 1)
Ejemplo n.º 8
0
def test_seed_arg(data):
    assert pyradamsa.Radamsa().fuzz(
        data, seed=1337) == b'GET /auth?pass=HelloWorld HTTP\xc0\xb1.1'
Ejemplo n.º 9
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     # fix seed for every build
     self.seed = random.randint(0, 2**32)
     self.rad = pyradamsa.Radamsa()