Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory
python-ldapdomaindump
remove-future-requirement.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File remove-future-requirement.patch of Package python-ldapdomaindump
From 413ceec72fb36832b92b7afdeaa7b164ee1837fc Mon Sep 17 00:00:00 2001 From: Steve Kowalik <steven@wedontsleep.org> Date: Wed, 6 Sep 2023 15:45:39 +1000 Subject: [PATCH] Drop future requirement, require Python 3.6+ With Python 2 having been unsupported for two and a half years, it's past time to remove support for it, and by extension, the future module. I've switched to Python 3.6 code, and forced that requirement in setup.py Closes #53 --- Readme.md | 2 +- ldapdomaindump/__init__.py | 26 ++++++++++---------------- ldapdomaindump/convert.py | 8 +++----- ldapdomaindump/pretty.py | 4 +--- requirements.txt | 1 - setup.py | 3 ++- 6 files changed, 17 insertions(+), 27 deletions(-) Index: ldapdomaindump-0.9.4/Readme.md =================================================================== --- ldapdomaindump-0.9.4.orig/Readme.md +++ ldapdomaindump-0.9.4/Readme.md @@ -25,7 +25,7 @@ As well as two grouped files: - *domain_computers_by_os*: Domain computers sorted by Operating System ## Dependencies and installation -Requires [ldap3](https://github.com/cannatag/ldap3) > 2.0, [dnspython](https://github.com/rthalley/dnspython) and [future](https://python-future.org/). ldapdomaindump runs on both python 2 and 3. +Requires [ldap3](https://github.com/cannatag/ldap3) > 2.0 and [dnspython](https://github.com/rthalley/dnspython). ldapdomaindump requires Python 3.6 or greater. Dependencies can be installed manually with `pip install ldap3 dnspython future`, but should in most cases be handled by pip when you install the main package either from git or pypi. Index: ldapdomaindump-0.9.4/ldapdomaindump/__init__.py =================================================================== --- ldapdomaindump-0.9.4.orig/ldapdomaindump/__init__.py +++ ldapdomaindump-0.9.4/ldapdomaindump/__init__.py @@ -21,22 +21,16 @@ # SOFTWARE. # #################### -from __future__ import unicode_literals import sys, os, re, codecs, json, argparse, getpass, base64 # import class and constants from datetime import datetime, timedelta -try: - from urllib.parse import quote_plus -except ImportError: - from urllib import quote_plus +from urllib.parse import quote_plus import ldap3 from ldap3 import Server, Connection, SIMPLE, SYNC, ALL, SASL, NTLM from ldap3.core.exceptions import LDAPKeyError, LDAPAttributeError, LDAPCursorError, LDAPInvalidDnError from ldap3.abstract import attribute, attrDef from ldap3.utils import dn from ldap3.protocol.formatters.formatters import format_sid -from builtins import str -from future.utils import itervalues, iteritems, native_str # dnspython, for resolving hostnames import dns.resolver @@ -125,7 +119,7 @@ MINIMAL_USERATTRIBUTES = ['cn', 'name', MINIMAL_GROUPATTRIBUTES = ['cn', 'name', 'sAMAccountName', 'memberOf', 'description', 'whenCreated', 'whenChanged', 'objectSid', 'distinguishedName', 'objectClass'] #Class containing the default config -class domainDumpConfig(object): +class domainDumpConfig(): def __init__(self): #Base path self.basepath = '.' @@ -158,7 +152,7 @@ class domainDumpConfig(object): self.minimal = False #Only query minimal list of attributes #Domaindumper main class -class domainDumper(object): +class domainDumper(): def __init__(self, server, connection, config, root=None): self.server = server self.connection = connection @@ -429,7 +423,7 @@ class domainDumper(object): rw.generateComputersByOsReport(self) rw.generateUsersByGroupReport(self) -class reportWriter(object): +class reportWriter(): def __init__(self, config): self.config = config self.dd = None @@ -474,7 +468,7 @@ class reportWriter(object): outflags = [] if attr is None or attr.value is None: return outflags - for flag, val in iteritems(flags_def): + for flag, val in flags_def.items(): if int(attr.value) & val: outflags.append(flag) return outflags @@ -484,7 +478,7 @@ class reportWriter(object): outflags = [] if attr is None: return outflags - for flag, val in iteritems(flags_def): + for flag, val in flags_def.items(): if int(attr.value) == val: outflags.append(flag) return outflags @@ -528,7 +522,7 @@ class reportWriter(object): #Generate several HTML tables for grouped reports def generateGroupedHtmlTables(self, groups, attributes): first = True - for groupname, members in iteritems(groups): + for groupname, members in groups.items(): yield self.generateHtmlTable(members, attributes, groupname, first, specialGroupsFormat=True) if first: first = False @@ -761,7 +755,7 @@ class reportWriter(object): #Start of the list yield '[' firstGroup = True - for group in iteritems(groups): + for group in groups.items(): if not firstGroup: #Separate items yield ',' @@ -867,8 +861,8 @@ def main(): #Main parameters #maingroup = parser.add_argument_group("Main options") parser.add_argument("host", type=str, metavar='HOSTNAME', help="Hostname/ip or ldap://host:port connection string to connect to (use ldaps:// to use SSL)") - parser.add_argument("-u", "--user", type=native_str, metavar='USERNAME', help="DOMAIN\\username for authentication, leave empty for anonymous authentication") - parser.add_argument("-p", "--password", type=native_str, metavar='PASSWORD', help="Password or LM:NTLM hash, will prompt if not specified") + parser.add_argument("-u", "--user", type=str, metavar='USERNAME', help="DOMAIN\\username for authentication, leave empty for anonymous authentication") + parser.add_argument("-p", "--password", type=str, metavar='PASSWORD', help="Password or LM:NTLM hash, will prompt if not specified") parser.add_argument("-at", "--authtype", type=str, choices=['NTLM', 'SIMPLE'], default='NTLM', help="Authentication type (NTLM or SIMPLE, default: NTLM)") #Output parameters Index: ldapdomaindump-0.9.4/ldapdomaindump/convert.py =================================================================== --- ldapdomaindump-0.9.4.orig/ldapdomaindump/convert.py +++ ldapdomaindump-0.9.4/ldapdomaindump/convert.py @@ -6,13 +6,11 @@ import json import codecs import re from ldapdomaindump import trust_flags, trust_directions -from builtins import str -from future.utils import itervalues, iteritems logging.basicConfig() logger = logging.getLogger('ldd2bloodhound') -class Utils(object): +class Utils(): @staticmethod def ldap_to_domain(ldap): return re.sub(',DC=', '.', ldap[ldap.find('DC='):], flags=re.I)[3:] @@ -27,7 +25,7 @@ class Utils(object): 'memberOf': groupo['attributes']['memberOf'] if 'memberOf' in groupo['attributes'] else [] } -class BloodHoundConverter(object): +class BloodHoundConverter(): def __init__(self): # Input files self.computers_files = [] @@ -87,7 +85,7 @@ class BloodHoundConverter(object): # Read group mapping - write to csv # file is already created here, we just append with codecs.open('group_membership.csv', 'a', 'utf-8') as outfile: - for group in itervalues(self.groups_by_dn): + for group in self.groups_by_dn.values(): for membergroup in group['memberOf']: try: outfile.write('%s,%s,%s\n' % (self.groups_by_dn[membergroup]['principal'], group['principal'], 'group')) Index: ldapdomaindump-0.9.4/ldapdomaindump/pretty.py =================================================================== --- ldapdomaindump-0.9.4.orig/ldapdomaindump/pretty.py +++ ldapdomaindump-0.9.4/ldapdomaindump/pretty.py @@ -1,12 +1,10 @@ -from __future__ import print_function -from builtins import str import argparse import json import os.path import re from time import strftime, gmtime -class PrettyOuput(object): +class PrettyOuput(): def d2b(self, a): tbin = [] Index: ldapdomaindump-0.9.4/setup.py =================================================================== --- ldapdomaindump-0.9.4.orig/setup.py +++ ldapdomaindump-0.9.4/setup.py @@ -6,7 +6,8 @@ setup(name='ldapdomaindump', author_email='dirkjan@sanoweb.nl', url='https://github.com/dirkjanm/ldapdomaindump/', packages=['ldapdomaindump'], - install_requires=['dnspython', 'ldap3>=2.5,!=2.5.2,!=2.5.0,!=2.6', 'future'], + requires_python=">=3.6", + install_requires=['dnspython', 'ldap3>=2.5,!=2.5.2,!=2.5.0,!=2.6'], package_data={'ldapdomaindump': ['style.css']}, include_package_data=True, scripts=['bin/ldapdomaindump', 'bin/ldd2bloodhound', 'bin/ldd2pretty'],
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor