Improve command whitelist checker.
This commit is contained in:
parent
0cb3156186
commit
05e2706fa9
@ -37,12 +37,23 @@ public class ExecCommand implements WSCommand {
|
||||
break;
|
||||
}
|
||||
|
||||
String[] splitCommand = command.split(" ");
|
||||
|
||||
for (String whitelistedCommand : ud.getWhitelistedCommands()) {
|
||||
if (command.toLowerCase().startsWith(whitelistedCommand)) {
|
||||
String[] splitWhitelistedCommand = whitelistedCommand.split(" ");
|
||||
|
||||
if (!ud.isWhitelistActsAsBlacklist()) allowCommand = true; //cmd is whitelisted.
|
||||
for (int x = 0; x < splitWhitelistedCommand.length; x ++) {
|
||||
|
||||
break;
|
||||
if (!ud.isWhitelistActsAsBlacklist()) {
|
||||
|
||||
if (splitCommand[x].equalsIgnoreCase(splitWhitelistedCommand[x])) { //cmd is whitelisted.
|
||||
allowCommand = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
allowCommand = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user