From 44edf06bb7a45de9e55aa3297f155daaffc6a261 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sven=20M=C3=A4der?= <maeder@phys.ethz.ch>
Date: Tue, 10 Apr 2018 11:23:43 +0200
Subject: [PATCH] Add intial script

---
 bin/deltalogparse.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100755 bin/deltalogparse.py

diff --git a/bin/deltalogparse.py b/bin/deltalogparse.py
new file mode 100755
index 0000000..e46b6e8
--- /dev/null
+++ b/bin/deltalogparse.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import lib_path
+import lib
+import ldap3
+
+s = ldap3.Server('ldapi:///var/run/slapd/ldapi', get_info=[ldap3.ALL, ldap3.OFFLINE_SLAPD_2_4])
+c = ldap3.Connection(s, authentication=ldap3.SASL, sasl_mechanism=ldap3.EXTERNAL, sasl_credentials='', auto_bind='NONE', version=3, client_strategy='SYNC')
+c.bind()
+
+search_base = 'cn=deltalog'
+search_filter = '(objectClass=auditModify)'
+search_scope = ldap3.SUBTREE
+attributes = [ldap3.ALL_ATTRIBUTES, ldap3.ALL_OPERATIONAL_ATTRIBUTES]
+
+r = c.search(search_base=search_base, search_filter=search_filter, search_scope=search_scope, attributes=attributes)
+if r == True:
+    for entry in c.response:
+        print(entry['dn'], entry['attributes'])
-- 
GitLab