Skip to content

Commit 6a7871e

Browse files
committed
Formatting
1 parent c8849ea commit 6a7871e

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

nxc/modules/eventlog_creds.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ def options(self, context, module_options):
4141
def find_credentials(self, content, context):
4242
# remove unnecessary words
4343
content = content.replace("\r\n", "\n")
44-
content = content.replace("/add", "")
45-
content = content.replace("/active:yes", "")
44+
content = content.replace("/add", "")
45+
content = content.replace("/active:yes", "")
4646

4747
# sort and unique lines
4848
content = "\n".join(sorted(set(content.split("\n"))))
4949

5050
regexps = [
51-
# "C:\Windows\system32\net.exe" user /add lodos2005 123456 /domain
51+
# "C:\Windows\system32\net.exe" user /add lodos2005 123456 /domain
5252
r"net.+user\s+(?P<username>[^\s]+)\s+(?P<password>[^\s]+)",
5353
# "C:\Windows\system32\net.exe" use \\server\share /user:contoso\lodos2005 password
5454
r"net.+use.+/user:(?P<username>[^\s]+)\s+(?P<password>[^\s]+)",
@@ -72,14 +72,14 @@ def find_credentials(self, content, context):
7272
if match:
7373
# eleminate false positives
7474
# C:\Windows\system32\svchost.exe -k DcomLaunch -p -s PlugPlay
75-
if not match.groupdict().get("username") and match.groupdict().get("password") and len(match.group("password")) < 6:
75+
if not match.groupdict().get("username") and match.groupdict().get("password") and len(match.group("password")) < 6:
7676
# if password is found but username is not found, and password is shorter than 6 characters, ignore it
7777
continue
78-
if not match.groupdict().get("password") and match.groupdict().get("username"):
79-
# if username is found but password is not found. we need? ignore it
78+
if not match.groupdict().get("password") and match.groupdict().get("username"):
79+
# if username is found but password is not found. we need? ignore it
8080
continue
8181
# C:\Windows\system32\RunDll32.exe C:\Windows\system32\migration\WininetPlugin.dll,MigrateCacheForUser /m /0
82-
if match.groupdict().get("username") and match.groupdict().get("password") and len(match.group("password")) < 6 and len(match.group("username")) < 6:
82+
if match.groupdict().get("username") and match.groupdict().get("password") and len(match.group("password")) < 6 and len(match.group("username")) < 6:
8383
# if username and password is shorter than 6 characters, ignore it
8484
continue
8585

@@ -131,6 +131,7 @@ def on_admin_login(self, context, connection):
131131

132132
self.find_credentials(content, context)
133133

134+
134135
class MSEven6Trigger:
135136
def __init__(self, context):
136137
self.context = context
@@ -178,7 +179,8 @@ def query(self, path, query, limit):
178179
handle = resp["Handle"]
179180

180181
return MSEven6Result(self, handle, limit)
181-
182+
183+
182184
class MSEven6Result:
183185
def __init__(self, conn, handle, limit):
184186
self._conn = conn

0 commit comments

Comments
 (0)