Codebase list python-ldapdomaindump / cfe01cc debian / patches / prepare-for-python3.patch
cfe01cc

Tree @cfe01cc (Download .tar.gz)

prepare-for-python3.patch @cfe01ccraw · history · blame

--- a/ldapdomaindump/__init__.py
+++ b/ldapdomaindump/__init__.py
@@ -25,7 +25,11 @@
 import sys, os, re, codecs, json, argparse, getpass, base64
 # import class and constants
 from datetime import datetime
-from urllib import quote_plus
+# Handle python3: urllib has been split into parts
+try:
+    from urllib import quote_plus
+except:
+    from urllib.parse import quote_plus
 
 import ldap3
 from ldap3 import Server, Connection, SIMPLE, SYNC, ALL, SASL, NTLM
@@ -799,11 +803,11 @@ class reportWriter(object):
 
 #Some quick logging helpers
 def log_warn(text):
-    print '[!] %s' % text
+    print ('[!] %s' % text)
 def log_info(text):
-    print '[*] %s' % text
+    print ('[*] %s' % text)
 def log_success(text):
-    print '[+] %s' % text
+    print ('[+] %s' % text)
 
 def main():
     parser = argparse.ArgumentParser(description='Domain information dumper via LDAP. Dumps users/computers/groups and OS/membership information to HTML/JSON/greppable output.')