mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-03-18 15:14:10 +01:00
Land #304, add php meterpreter chmod command
This commit is contained in:
commit
3bbb606f0b
@ -28,6 +28,8 @@ define("TLV_TYPE_SEARCH_GLOB", TLV_META_TYPE_STRING | 1231);
|
|||||||
define("TLV_TYPE_SEARCH_ROOT", TLV_META_TYPE_STRING | 1232);
|
define("TLV_TYPE_SEARCH_ROOT", TLV_META_TYPE_STRING | 1232);
|
||||||
define("TLV_TYPE_SEARCH_RESULTS", TLV_META_TYPE_GROUP | 1233);
|
define("TLV_TYPE_SEARCH_RESULTS", TLV_META_TYPE_GROUP | 1233);
|
||||||
|
|
||||||
|
define("TLV_TYPE_FILE_MODE_T", TLV_META_TYPE_UINT | 1234);
|
||||||
|
|
||||||
##
|
##
|
||||||
# Net
|
# Net
|
||||||
##
|
##
|
||||||
@ -405,6 +407,20 @@ function stdapi_fs_file_copy($req, &$pkt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# works on Unix systems but probably not on Windows
|
||||||
|
if (!function_exists('stdapi_fs_chmod') && !is_windows()) {
|
||||||
|
register_command('stdapi_fs_chmod');
|
||||||
|
function stdapi_fs_chmod($req, &$pkt) {
|
||||||
|
my_print("doing chmod");
|
||||||
|
$path_tlv = packet_get_tlv($req, TLV_TYPE_FILE_PATH);
|
||||||
|
$mode_tlv = packet_get_tlv($req, TLV_TYPE_FILE_MODE_T);
|
||||||
|
$path = canonicalize_path($path_tlv['value']);
|
||||||
|
$mode = $mode_tlv['value'];
|
||||||
|
$ret = @chmod($path, $mode);
|
||||||
|
return $ret ? ERROR_SUCCESS : ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# works
|
# works
|
||||||
if (!function_exists('stdapi_fs_getwd')) {
|
if (!function_exists('stdapi_fs_getwd')) {
|
||||||
register_command('stdapi_fs_getwd');
|
register_command('stdapi_fs_getwd');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user