mirror of
https://github.com/rapid7/metasploit-payloads
synced 2024-11-26 17:41:08 +01:00
This commit is contained in:
parent
4eff18dc4e
commit
0e8fe2b642
@ -8,9 +8,18 @@ import com.metasploit.meterpreter.TLVType;
|
||||
import com.metasploit.meterpreter.command.Command;
|
||||
|
||||
public class stdapi_fs_ls implements Command {
|
||||
|
||||
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
||||
stdapi_fs_stat statCommand = (stdapi_fs_stat) meterpreter.getCommandManager().getCommand("stdapi_fs_stat");
|
||||
File path = Loader.expand(request.getStringValue(TLVType.TLV_TYPE_DIRECTORY_PATH));
|
||||
String pathString = request.getStringValue(TLVType.TLV_TYPE_DIRECTORY_PATH);
|
||||
if (pathString.equals("*")) {
|
||||
pathString = ".";
|
||||
} else if (pathString.contains("*")) {
|
||||
if (pathString.endsWith(File.separator + "*")) {
|
||||
pathString = pathString.substring(0, pathString.length() - 1);
|
||||
}
|
||||
}
|
||||
File path = Loader.expand(pathString);
|
||||
String[] entries = path.list();
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
if (entries[i].equals(".") || entries[i].equals(".."))
|
||||
|
Loading…
Reference in New Issue
Block a user