Mercurial > dropbear-fuzzcorpus
view make_verify.py @ 3:5e4454cc7b17
copy fuzzer-preauth to fuzzer-preauth_nomaths
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 23 Jan 2018 23:28:22 +0800 |
parents | e5383cd558e5 |
children |
line wrap: on
line source
#!/usr/bin/env python3 """ takes a pubkey, turns it into fuzzer-verify input """ import sys import struct import re import binascii BLOB_RE=re.compile(r'(?:ssh-rsa|ecdsa-\S+|ssh-dss) ([a-zA-Z0-9/+=]+)') inp = sys.stdin.read() b64blob = BLOB_RE.search(inp).groups(1)[0] blob = binascii.a2b_base64(b64blob) sigtypelen = struct.unpack('>I', blob[:4])[0] sigtype = blob[4:4+sigtypelen] print("Type is %s" % sigtype, file=sys.stderr) # a bodgy key followed by signature # eg rfc4253 # string "ssh-rsa" # string rsa_signature_blob sys.stdout.buffer.write(blob) sys.stdout.buffer.write(struct.pack('>I', sigtypelen)) sys.stdout.buffer.write(sigtype) sys.stdout.buffer.write(struct.pack('>II', 4, 20))