Skip to content

Commit

Permalink
Deal with multiple challenges
Browse files Browse the repository at this point in the history
.. and skip second password challenge if not requested.
  • Loading branch information
schlatterbeck committed Oct 3, 2017
1 parent 409e64f commit ec23653
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions snxconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,28 +203,28 @@ def login (self) :
self.open (data = urlencode (d))
self.debug (self.purl)
self.debug (self.info)
if 'MultiChallenge' not in self.purl :
print ("Login failed (expected MultiChallenge)")
self.debug ("Login failed (no MultiChallenge): %s" % self.purl)
return
d = self.parse_pw_response ()
otp = getpass ('One-time Password: ')
d ['password'] = enc.encrypt (otp)
self.debug (self.nextfile)
self.open (data = urlencode (d))
self.debug (self.info)
if not self.purl.endswith ('Portal/Main') :
print ("Login failed (expected Portal)")
self.debug ("Login failed (expected Portal): %s" % self.purl)
while 'MultiChallenge' in self.purl :
d = self.parse_pw_response ()
otp = getpass ('One-time Password: ')
d ['password'] = enc.encrypt (otp)
self.debug ("nextfile: %s" % self.nextfile)
self.debug ("purl: %s" % self.purl)
self.open (data = urlencode (d))
self.debug ("info: %s" % self.info)
if self.purl.endswith ('Portal/Main') :
if self.args.save_cookies :
self.jar.save (self.args.cookiefile, ignore_discard = True)
self.debug ("purl: %s" % self.purl)
self.open ('sslvpn/SNX/extender')
self.debug (self.purl)
self.debug (self.info)
self.parse_extender ()
self.generate_snx_info ()
return True
else :
print ("Unexpected response, looking for MultiChallenge or Portal")
self.debug ("purl: %s" % self.purl)
return
if self.args.save_cookies :
self.jar.save (self.args.cookiefile, ignore_discard = True)
self.open ('sslvpn/SNX/extender')
self.debug (self.purl)
self.debug (self.info)
self.parse_extender ()
self.generate_snx_info ()
return True
# end def login

def next_file (self, fname) :
Expand Down

0 comments on commit ec23653

Please sign in to comment.