Skip to content

Commit 17e03d2

Browse files
committed
Retrieve files after killing the process
1 parent 05ad12f commit 17e03d2

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

nxc/modules/notepad.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,13 @@ def read_and_decode_file(self, connection, context, file_path, user):
9696
except Exception as e:
9797
if "STATUS_SHARING_VIOLATION" in str(e): # It means notepad.exe is open on target.
9898
if self.kill:
99-
# If there's a sharing violation, try alternative approach
100-
context.log.debug(f"Sharing violation on {file_path}, trying alternative method")
10199
try:
102100
context.log.debug(f"Trying to kill notepad.exe process for {user} user.")
103101
# To Do: Kill process with RPC, connection.execute can be detect by EDRs and module wont work. Or copy the target bin files without trigger the EDRs
104102
connection.execute("taskkill /IM notepad.exe /F") # If notepad.exe open by user, needs to kill that process for reading files.
105103
time.sleep(1) # Sleep 1 sec for finding and reading processing
106104
context.log.debug(f"Notepad process was successfully killed for {user}")
105+
connection.conn.getFile("C$", file_path, buf.write)
107106
except Exception as e:
108107
context.log.debug(f"Alternative method failed: {e}")
109108
else:

0 commit comments

Comments
 (0)