I have "blackbox" with the following python function code (without permission to change it):
def exec_ping():
forbidden = ['&', ';', '-', '`', '||', '|']
command = input('Enter an IP: ')
for i in forbidden:
if i in command:
print('Invalid characters')
exit()
os.system('ping ' + command)
I want to execute this function with the following command input:
-c 1 localhost; whoami;
To get this command to be running:
ping -c 1 localhost; whoami;
How can I bypass the forbidden characters check? Can I use another characters/encoding?