1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-02-22 03:19:04 +01:00

fix fs.file.expand_path on java

This commit is contained in:
Tim W 2019-06-01 05:44:49 +08:00
parent 62c72dd9ed
commit ae7d26c258

View File

@ -19,7 +19,18 @@ public class stdapi_fs_file_expand_path implements Command {
response.add(TLVType.TLV_TYPE_FILE_PATH, System.getenv("TEMP"));
return ERROR_SUCCESS;
} else {
return NotYetImplementedCommand.INSTANCE.execute(meterpreter, request, response);
if (path.startsWith("$") || path.startsWith("%")) {
path = path.substring(1);
}
if (path.endsWith("$") || path.endsWith("%")) {
path = path.substring(0, path.length() - 1);
}
String value = System.getenv(path);
if (value == null) {
return ERROR_FAILURE;
}
response.add(TLVType.TLV_TYPE_FILE_PATH, value);
return ERROR_SUCCESS;
}
}