[approved]: Make approved directory + add flag

This commit is contained in:
2024-09-15 19:02:06 +01:00
parent 428d7b89af
commit 3c9ebe0748
2 changed files with 1 additions and 0 deletions

17
approved/approved.pl Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/perl
# Read the contents of flag.txt. You can only use commands in the approved list.
# Hint: You can supply whatever parameters you like to the command!
my @approved_commands = ("ls", "pwd", "whoami");
while (1) {
printf("\n> ");
my $command = <STDIN>;
foreach my $approved_command (@approved_commands) {
if ($command =~ /^$approved_command/) {
print(`$command`);
last;
}
}
}