15
0

Accepting request 1267645 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1267645
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-ldapdomaindump?expand=0&rev=4
This commit is contained in:
2025-04-07 17:15:13 +00:00
committed by Git OBS Bridge
6 changed files with 55 additions and 214 deletions

33
73.patch Normal file
View File

@@ -0,0 +1,33 @@
From 07d88abbfc0056bf02321bdbcd503e59143b56e7 Mon Sep 17 00:00:00 2001
From: Levente Polyak <levente@leventepolyak.net>
Date: Fri, 4 Apr 2025 17:49:22 +0200
Subject: [PATCH] fix(pyproject): declare license file property according to
PEP
Fixes #72
---
pyproject.toml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pyproject.toml b/pyproject.toml
index 7657122..c7ab099 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,11 +11,16 @@ authors = [
]
urls = { "Homepage" = "https://github.com/dirkjanm/ldapdomaindump/" }
requires-python = ">=3.6"
-license = "MIT"
+license = { file = "LICENSE" }
dependencies = [
"dnspython",
"ldap3>=2.5,!=2.5.2,!=2.5.0,!=2.6"
]
+classifiers = [
+ "License :: OSI Approved :: MIT License",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.12",
+]
[tool.setuptools.packages.find]
include = ["ldapdomaindump"]

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cbc66b32a7787473ffd169c5319acde46c02fdc9d444556e6448e0def91d3299
size 19445

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:99dcda17050a96549966e53bc89e71da670094d53d9542b3b0d0197d035e6f52
size 18933

View File

@@ -1,3 +1,15 @@
-------------------------------------------------------------------
Sun Apr 6 09:48:03 UTC 2025 - Martin Hauke <mardnh@gmx.de>
- Update to version 0.10.0
* Add servicePrincipalName to output.
* Fix functions descriptions.
* Drop future requirement, require Python 3.6+.
- Drop patch:
* remove-future-requirement.patch
- Add patch:
* 73.patch
-------------------------------------------------------------------
Wed Sep 6 05:58:09 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -1,8 +1,8 @@
#
# spec file for package python-ldapdomaindump
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2020, Martin Hauke <mardnh@gmx.de>
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2020-2025, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,14 +18,14 @@
Name: python-ldapdomaindump
Version: 0.9.4
Version: 0.10.0
Release: 0
Summary: Active Directory information dumper via LDAP
License: MIT
URL: https://github.com/dirkjanm/ldapdomaindump/
Source: https://files.pythonhosted.org/packages/source/l/ldapdomaindump/ldapdomaindump-%{version}.tar.gz
# PATCH-FIX-UPSTREAM Based on gh#dirkjanm/ldapdomaindump#55
Patch0: remove-future-requirement.patch
# PATCH-FIX-UPSTREAM https://github.com/dirkjanm/ldapdomaindump/pull/73
Patch0: https://patch-diff.githubusercontent.com/raw/dirkjanm/ldapdomaindump/pull/73.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
@@ -35,7 +35,7 @@ BuildRequires: python-rpm-macros
Requires: python-dnspython
Requires: python-ldap3 >= 2.5
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module dnspython}
@@ -76,7 +76,7 @@ find . -type f -exec dos2unix {} \;
%files %{python_files}
%license LICENSE
%doc Readme.md
%doc README.md
%python_alternative %{_bindir}/ldapdomaindump
%python_alternative %{_bindir}/ldd2bloodhound
%python_alternative %{_bindir}/ldd2pretty

View File

@@ -1,204 +0,0 @@
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'],