Skip to content

Commit 468bf46

Browse files
committed
stdapi_fs_file_copy
1 parent 19bcef0 commit 468bf46

File tree

2 files changed

+20
-0
lines changed
  • lib/rex/post/meterpreter
    • extensions/stdapi/fs
    • ui/console/command_dispatcher/stdapi

2 files changed

+20
-0
lines changed

lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,24 @@ class << self
226226
alias rename mv
227227
end
228228

229+
#
230+
# Performs a copy from oldname to newname
231+
#
232+
def File.cp(oldname, newname)
233+
request = Packet.create_request('stdapi_fs_file_copy')
234+
235+
request.add_tlv(TLV_TYPE_FILE_NAME, client.unicode_filter_decode( oldname ))
236+
request.add_tlv(TLV_TYPE_FILE_PATH, client.unicode_filter_decode( newname ))
237+
238+
response = client.send_request(request)
239+
240+
return response
241+
end
242+
243+
class << self
244+
alias copy cp
245+
end
246+
229247
#
230248
# Upload one or more files to the remote remote directory supplied in
231249
# +destination+.

lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def commands
7171
'pwd' => 'Print working directory',
7272
'rm' => 'Delete the specified file',
7373
'mv' => 'Move source to destination',
74+
'cp' => 'Copy source to destination',
7475
'rmdir' => 'Remove directory',
7576
'search' => 'Search for files',
7677
'upload' => 'Upload a file or directory',
@@ -95,6 +96,7 @@ def commands
9596
'rmdir' => ['stdapi_fs_delete_dir'],
9697
'rm' => ['stdapi_fs_delete_file'],
9798
'mv' => ['stdapi_fs_file_move'],
99+
'cp' => ['stdapi_fs_file_copy'],
98100
'search' => ['stdapi_fs_search'],
99101
'upload' => [],
100102
'show_mount' => ['stdapi_fs_mount_show'],

0 commit comments

Comments
 (0)