Skip to content

Commit

Permalink
DB Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
m8sec committed Nov 4, 2019
1 parent 928e875 commit 7789b8a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<br>
<img src="https://img.shields.io/badge/Python-3.7-blue.svg"/>&nbsp;
<img src="https://img.shields.io/badge/License-GPLv3-green.svg">&nbsp;
<a href="https://www.youtube.com/watch?v=yaGI0XKfWUs">
<a href="https://www.youtube.com/channel/UC6-HLpd0rpPXmpJIhED8qTw">
<img src="https://img.shields.io/badge/Demo-Youtube-red.svg"/></a>&nbsp;
<a href="https://twitter.com/intent/follow?screen_name=m8r0wn">
<img src="https://img.shields.io/twitter/follow/m8r0wn?style=social&logo=twitter" alt="follow on Twitter"></a>
Expand Down
16 changes: 11 additions & 5 deletions ar3/core/smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ def host_info(self):
if arch != 0:
self.os_arch = " x{}".format(str(arch))

self.db.update_host(self.host, self.ip, self.domain, self.os, self.signing)
if self.con.getServerDNSDomainName():
domain = self.con.getServerDNSDomainName()
else:
domain = self.ip

self.db.update_host(self.host, self.ip, domain, self.os, self.signing)

if self.args.gen_relay_list and not self.signing:
self.loggers['relay_list'].info(self.ip)
Expand Down Expand Up @@ -307,10 +312,10 @@ def add_ntds_hash(ntds_hash):
if ntds_hash.find('$') == -1:
if "CLEARTEXT" in ntds_hash:
try:
add_ntds_hash.clear_text += 1
username, password = ntds_hash.split(":CLEARTEXT:")
add_ntds_hash.clear_text += 1
domain, username = username.split("\\")
self.db.update_user(username, '', domain, password)
self.db.update_user(username, password, domain, '')
add_ntds_hash.added_to_db += 1
except:
self.logger.fail("Error adding clear text cred to db: {}".format(ntds_hash))
Expand Down Expand Up @@ -355,7 +360,7 @@ def add_ntds_hash(ntds_hash):
justUser=None, printUserStatus=False,
perSecretCallback=lambda secretType, secret: add_ntds_hash(secret))

self.logger.info([self.host, self.ip, "NTDS", 'Dumping NTDS.dit, this could take a minute'])
self.logger.info([self.host, self.ip, "NTDS", 'Extracting NTDS.dit, this could take a minute'])
NTDS.dump()

self.logger.success([self.host, self.ip, "NTDS", '{} hashes and {} passwords collected'.format(add_ntds_hash.ntds_hashes, add_ntds_hash.clear_text)])
Expand All @@ -369,9 +374,10 @@ def add_ntds_hash(ntds_hash):

try:
self.remote_ops.finish()
NTDS.finish()

except Exception as e:
self.logger.debug(["NTDS", "Error calling remote_ops.finish(): {}".format(e)])
NTDS.finish()

################################
# File Interaction
Expand Down
2 changes: 1 addition & 1 deletion ar3/modules/get_lockedaccounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def run(self, target, args, smb_con, loggers, config_obj):

try:
# Create LDAP Con
x = LdapCon(args.user, args.passwd, args.hash, args.domain, self.args['SERVER']['Value'], args.timeout)
x = LdapCon(args, loggers, args.ldap_srv, smb_con.db)
x.create_ldap_con()
if not x:
logger.fail([smb_con.host, smb_con.ip, self.name.upper(), 'Unable to create LDAP connection'])
Expand Down
2 changes: 1 addition & 1 deletion ar3/modules/get_netdomaincontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def __init__(self):

def run(self, target, args, smb_con, loggers, config_obj):
logger = loggers['console']
x = LdapCon(args, loggers, args.ldap_srv, smb_con.db)
try:
x = LdapCon(args.user, args.passwd, args.hash, args.domain, args.ldap_srv, args.timeout)
x.create_ldap_con()
dc_data = x.custom_query('(userAccountControl:1.2.840.113556.1.4.803:=8192)', ATTRIBUTES['cpu'])
x.close()
Expand Down

0 comments on commit 7789b8a

Please sign in to comment.