mirror of
https://github.com/Pennyw0rth/NetExec
synced 2026-06-06 16:34:30 +00:00
Merge pull request #982 from stfnw/ldap-database-signing-channelbinding
Add LDAP signing and LDAPS channel binding info to db
This commit is contained in:
@@ -337,7 +337,9 @@ class ldap(connection):
|
||||
self.host,
|
||||
self.hostname,
|
||||
self.domain,
|
||||
self.server_os
|
||||
self.server_os,
|
||||
self.signing_required,
|
||||
self.cbt_status
|
||||
)
|
||||
except Exception as e:
|
||||
self.logger.debug(f"Error adding host {self.host} into db: {e!s}")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
from sqlalchemy import Column, ForeignKeyConstraint, Integer, PrimaryKeyConstraint, String, func, select, delete
|
||||
from sqlalchemy import Boolean, Column, ForeignKeyConstraint, Integer, PrimaryKeyConstraint, String, func, select, delete
|
||||
from sqlalchemy.dialects.sqlite import Insert # used for upsert
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
@@ -37,6 +37,8 @@ class database(BaseDB):
|
||||
hostname = Column(String)
|
||||
domain = Column(String)
|
||||
os = Column(String)
|
||||
signing_required = Column(Boolean)
|
||||
channel_binding = Column(String)
|
||||
|
||||
__table_args__ = (
|
||||
PrimaryKeyConstraint("id"),
|
||||
@@ -50,7 +52,7 @@ class database(BaseDB):
|
||||
self.UsersTable = self.reflect_table(self.User)
|
||||
self.HostsTable = self.reflect_table(self.Host)
|
||||
|
||||
def add_host(self, ip, hostname, domain, os):
|
||||
def add_host(self, ip, hostname, domain, os, signing_required, channel_binding):
|
||||
"""Check if this host has already been added to the database, if not, add it in."""
|
||||
hosts = []
|
||||
updated_ids = []
|
||||
@@ -64,7 +66,9 @@ class database(BaseDB):
|
||||
"ip": ip,
|
||||
"hostname": hostname,
|
||||
"domain": domain,
|
||||
"os": os
|
||||
"os": os,
|
||||
"signing_required": signing_required,
|
||||
"channel_binding": channel_binding
|
||||
}
|
||||
hosts = [new_host]
|
||||
# update existing hosts data
|
||||
@@ -78,6 +82,12 @@ class database(BaseDB):
|
||||
host_data["hostname"] = hostname
|
||||
if domain is not None:
|
||||
host_data["domain"] = domain
|
||||
if os is not None:
|
||||
host_data["os"] = os
|
||||
if signing_required is not None:
|
||||
host_data["signing_required"] = signing_required
|
||||
if channel_binding is not None:
|
||||
host_data["channel_binding"] = channel_binding
|
||||
# only add host to be updated if it has changed
|
||||
if host_data not in hosts:
|
||||
hosts.append(host_data)
|
||||
|
||||
@@ -10,7 +10,9 @@ class navigator(DatabaseNavigator):
|
||||
"IP",
|
||||
"Hostname",
|
||||
"Domain",
|
||||
"OS"
|
||||
"OS",
|
||||
"LDAP signing required",
|
||||
"LDAPS channel binding"
|
||||
]
|
||||
]
|
||||
|
||||
@@ -25,13 +27,18 @@ class navigator(DatabaseNavigator):
|
||||
except Exception:
|
||||
os = host[4]
|
||||
|
||||
signing_required = host[5]
|
||||
channel_binding = host[6]
|
||||
|
||||
data.append(
|
||||
[
|
||||
host_id,
|
||||
ip,
|
||||
hostname,
|
||||
domain,
|
||||
os
|
||||
os,
|
||||
signing_required,
|
||||
channel_binding
|
||||
]
|
||||
)
|
||||
print_table(data, title="Hosts")
|
||||
@@ -54,7 +61,9 @@ class navigator(DatabaseNavigator):
|
||||
"IP",
|
||||
"Hostname",
|
||||
"Domain",
|
||||
"OS"
|
||||
"OS",
|
||||
"LDAP signing required",
|
||||
"LDAPS channel binding"
|
||||
]
|
||||
]
|
||||
host_id_list = []
|
||||
@@ -71,13 +80,18 @@ class navigator(DatabaseNavigator):
|
||||
except Exception:
|
||||
os = host[4]
|
||||
|
||||
signing_required = host[5]
|
||||
channel_binding = host[6]
|
||||
|
||||
data.append(
|
||||
[
|
||||
host_id,
|
||||
ip,
|
||||
hostname,
|
||||
domain,
|
||||
os
|
||||
os,
|
||||
signing_required,
|
||||
channel_binding
|
||||
]
|
||||
)
|
||||
print_table(data, title="Host")
|
||||
|
||||
Reference in New Issue
Block a user