]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
These are Python 3 scripts
authorDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Thu, 30 Sep 2021 08:43:00 +0000 (10:43 +0200)
committerDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Fri, 1 Oct 2021 07:13:05 +0000 (09:13 +0200)
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
test-f5-login.py
test-fortinet-login.py
www/html.py

index fe82ed5282e3d30bcecea2a61af400304c636019..21273d893204a87d48aa2e00ae01d881060d65e2 100755 (executable)
@@ -1,15 +1,8 @@
 #!/usr/bin/python3
 
-from __future__ import print_function
 from sys import stderr, version_info
-if (version_info >= (3, 0)):
-    from urllib.parse import urlparse, urlencode
-    raw_input = input
-    import http.client as httplib
-else:
-    from urlparse import urlparse
-    from urllib import urlencode
-    import httplib
+from urllib.parse import urlparse, urlencode
+import http.client as httplib
 import requests
 import argparse
 import getpass
@@ -58,7 +51,7 @@ assert any(c.value for c in s.cookies if c.name == 'MRHSession') and any(c.value
 
 # Send login credentials
 if args.username is None:
-    args.username = raw_input('Username: ')
+    args.username = input('Username: ')
 if args.password is None:
     args.password = getpass.getpass('Password: ')
 data = dict(username=args.username, password=args.password,
index 0819a560be0d1a9cdfd81018b9f025b2012147d1..91875234f69505581ea3d5f4ba49acd56d908703 100755 (executable)
@@ -1,18 +1,12 @@
 #!/usr/bin/python3
 
-from __future__ import print_function
 from sys import stderr, version_info
 import requests
 import argparse
 import getpass
 from shlex import quote
-if (version_info >= (3, 0)):
-    from urllib.parse import urlparse, urlencode
-    raw_input = input
-    import http.client as httplib
-else:
-    from urlparse import urlparse
-    import httplib
+from urllib.parse import urlparse, urlencode
+import http.client as httplib
 
 p = argparse.ArgumentParser()
 p.add_argument('-v', '--verbose', default=0, action='count')
@@ -53,7 +47,7 @@ res = s.get(endpoint.geturl(), allow_redirects=False)
 
 # Send login credentials
 if args.username is None:
-    args.username = raw_input('Username: ')
+    args.username = input('Username: ')
 if args.password is None:
     args.password = getpass.getpass('Password: ')
 data = dict(username=args.username, credential=args.password, realm=args.realm,
index f3278175d92c5e0f2322c4e8bec982c1542722a0..0facd81946a209f7d9949478f69ef21a00734dff 100755 (executable)
@@ -46,7 +46,7 @@ def replaceVars(line):
     while cnt < len(replace):
         if line.find(replace[cnt]) >= 0:
             line = line.replace(replace[cnt], replace[cnt+1])
-        cnt = cnt + 2
+        cnt += 2
     return line
 
 
@@ -137,7 +137,7 @@ class docHandler(xml.sax.ContentHandler):
             writeHtml(">")
 
     def characters(self, ch):
-        self.content = self.content + ch
+        self.content += ch
 
     def endElement(self, name):
 
@@ -235,7 +235,7 @@ if not arguments:
 
 if writefile > 0:
     fname = arguments[0].split('.')[0]
-    fname = fname + ".html"
+    fname += ".html"
     fdout = codecs.open(fname, 'w', 'utf-8')
 
 parseConfig(arguments[0])