1#!/usr/bin/env python3
2
3# append the 1 byte the fuzzer needs to decide which format to choose,
4# 1 byte for debug or not and then 4 bytes for the srandom() seed.
5# run this script and then merge the generated seeds to the corpus.
6# Note: this has already been done with the existing corpus. This
7# script is included in case new credentials tests are added
8# ./make_seed.py
9# ./fuzz_format_parsers corpus seed -merge=1
10
11import os
12
13if not os.path.exists("./seed"):
14    os.mkdir("./seed")
15
16with os.scandir("../tests/credentials") as entries:
17    for entry in entries:
18        if not entry.is_file():
19            continue
20        print(entry.name)
21        with open("./seed/{}".format(entry.name), "wb") as w:
22            w.write(bytes([1,1,1,1,1,1]))
23            with open("../tests/credentials/{}".format(entry.name), "rb") as r:
24                w.write(r.read())
25        with open("./seed/{}.ssh".format(entry.name), "wb") as w:
26            w.write(bytes([0,1,1,1,1,1]))
27            with open("../tests/credentials/{}".format(entry.name), "rb") as r:
28                w.write(r.read())
29