- endpoint = 'https://{}/{}/prelogin.esp'.format(args.server, ('global-protect' if args.portal else 'ssl-vpn'))
- res = s.post(endpoint, verify=args.verify, data=args.extra)
- xml = ET.fromstring(res.content)
- sam = xml.find('saml-auth-method')
- sr = xml.find('saml-request')
- if sam is None or sr is None:
- p.error("This does not appear to be a SAML prelogin response (<saml-auth-method> or <saml-request> tags missing)")
- elif sam.text == 'POST':
- print("Got SAML POST content, opening browser...", file=stderr)
- html, uri = a2b_base64(sr.text).decode(), None
- elif sam.text == 'REDIRECT':
- print("Got SAML REDIRECT to %s, opening browser..." % sr.text, file=stderr)
- uri, html = sr.text, None
+ if args.uri:
+ sam, uri, html = 'URI', args.server, None