Skip to content

Instantly share code, notes, and snippets.

@wware
Last active November 20, 2019 19:57
Show Gist options
  • Save wware/dd1f93fdc2af3320096f4d50c884fc01 to your computer and use it in GitHub Desktop.
Save wware/dd1f93fdc2af3320096f4d50c884fc01 to your computer and use it in GitHub Desktop.
"""
Provide access to a Bash shell on the remote machine during a RemotePdb session.
"""
import os
import remote_pdb
def rpdb(port=4444):
class RemotePdb(remote_pdb.RemotePdb):
def do_shell(self, arg):
print >> self.stdout, os.popen(arg + " 2>&1").read().strip()
do_H = do_shell
return RemotePdb("0.0.0.0", port)
rpdb().set_trace()
def fac(n):
p = 1
for i in range(2, n+1):
p *= i
return p
print fac(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment