annotate make_fuzzinput.py @ 20:6b857c4abe66

Add new fuzzers to the list
author Matt Johnston <matt@ucc.asn.au>
date Sun, 07 Mar 2021 15:38:48 +0800
parents ec5e2b121e57
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 #!/usr/bin/env python3
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3 # A fuzz input consists of a SSH-string header followed by the SSH stream.
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4 # This program prepends a basic prefix.
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 import struct
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7 import sys
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 stream = sys.stdin.buffer.read()
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11 header = b''
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12 # uint32 wrapfd random seed
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 header += struct.pack(">I", 0xafaf1234)
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 # prepend length
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 header = struct.pack(">I", len(header)) + header
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17 sys.stdout.buffer.write(header)
ec5e2b121e57 Dropbear fuzz corpus
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 sys.stdout.buffer.write(stream)