/usr/bin/rfoo-rconsole is in python-rfoo 1.3.0-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #!/usr/bin/python
"""
rconsole
A Python console you can embed in a program and attach to remotely.
To spawn a Python console in a script do the following in global scope
only (!) of any module:
from rfoo.utils import rconsole
rconsole.spawn_server()
This will start a listener for connections in a new thread. You may
specify a port to listen on.
To attach to the console from another shell use the rconsole script
(rfoo/scripts/rconsole).
SECURITY NOTE:
The listener started with spawn_server() will accept any local
connection and may therefore be insecure to use in shared hosting
or similar environments!
"""
import getopt
import sys
import os
import rfoo.utils.rconsole as rconsole
def print_usage():
scriptName = os.path.basename(sys.argv[0])
sys.stdout.write("""
Start remote console:
%(name)s [-h] [-pPORT]
-h, --help Print this help.
-pPORT Set PORT.
""" % {'name': scriptName})
def main():
"""Parse options and run script."""
try:
options, args = getopt.getopt(
sys.argv[1:],
'hp:',
['help']
)
options = dict(options)
except getopt.GetoptError:
print_usage()
return 2
if '-h' in options or '--help' in options:
print_usage()
return
if '-p' in options:
port = int(options.get('-p'))
else:
port = rconsole.PORT
rconsole.interact(port=port)
if __name__ == '__main__':
main()
|