Skip to content

Commit e2c1e82

Browse files
committed
Reduce code lines
1 parent 61f6ee1 commit e2c1e82

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

nxc/protocols/smb.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,19 +1156,11 @@ def output(sessions):
11561156
maxUsernameLen = max(maxUsernameLen, len("USERNAME") + 1)
11571157

11581158
# Create the template for formatting
1159-
template = (f"{{USERNAME: <{maxUsernameLen}}} "
1160-
f"{{SID: <{maxSidLen}}}")
1159+
template = (f"{{USERNAME: <{maxUsernameLen}}} {{SID: <{maxSidLen}}}")
11611160

11621161
# Create headers
1163-
header = template.format(
1164-
USERNAME="USERNAME",
1165-
SID="SID",
1166-
)
1167-
1168-
header2 = template.replace(" <", "=<").format(
1169-
USERNAME="",
1170-
SID="",
1171-
)
1162+
header = template.format(USERNAME="USERNAME", SID="SID")
1163+
header2 = template.replace(" <", "=<").format(USERNAME="", SID="")
11721164

11731165
# Store result
11741166
result = [header, header2]
@@ -1178,10 +1170,7 @@ def output(sessions):
11781170
domain = vals["Domain"]
11791171
user_full = f"{domain}\\{username}" if username else ""
11801172

1181-
row = template.format(
1182-
USERNAME=user_full,
1183-
SID=sid
1184-
)
1173+
row = template.format(USERNAME=user_full, SID=sid)
11851174
result.append(row)
11861175

11871176
self.logger.success("Remote Registry enumerated sessions")

0 commit comments

Comments
 (0)