Skip to content

Commit f22c18e

Browse files
committed
Merge branch 'module-psexec_command-file_prefix' of github.com:kn0/metasploit-framework into kn0-module-psexec_command-file_prefix
2 parents 11754f2 + 9702341 commit f22c18e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/auxiliary/admin/smb/psexec_command.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def initialize(info = {})
5151
OptString.new('WINPATH', [true, 'The name of the remote Windows directory', 'WINDOWS']),
5252
], self.class)
5353

54+
register_advanced_options([
55+
OptString.new('FILEPREFIX', [false, 'Add a custom prefix to the temporary files','']),
56+
], self.class)
57+
5458
deregister_options('RHOST')
5559
end
5660

@@ -60,8 +64,8 @@ def peer
6064

6165
# This is the main controle method
6266
def run_host(ip)
63-
text = "\\#{datastore['WINPATH']}\\Temp\\#{Rex::Text.rand_text_alpha(16)}.txt"
64-
bat = "\\#{datastore['WINPATH']}\\Temp\\#{Rex::Text.rand_text_alpha(16)}.bat"
67+
text = "\\#{datastore['WINPATH']}\\Temp\\#{datastore['FILEPREFIX']}#{Rex::Text.rand_text_alpha(16)}.txt"
68+
bat = "\\#{datastore['WINPATH']}\\Temp\\#{datastore['FILEPREFIX']}#{Rex::Text.rand_text_alpha(16)}.bat"
6569
@smbshare = datastore['SMBSHARE']
6670
@ip = ip
6771

0 commit comments

Comments
 (0)