Rpyc
Fleetingimport os
os.a = (locals(), globals())
os.environ["NO_COLOR"] = "1"
from rpyc.cli.rpyc_classic import ClassicServer
ClassicServer.run(argv=["dummy", "--port=9999", "--host=0.0.0.0"])
import os
os.a = (locals(), globals())
os.environ["NO_COLOR"] = "1"
from rpyc.cli.rpyc_classic import ClassicServer
ClassicServer.run(argv=["dummy", "--port=9999", "--host=0.0.0.0"])
Or, using using a python2 stack
import os
from rpyc.core import SlaveService
from rpyc.utils.server import ForkingServer
def run(*args, **kwargs):
print("Starting rpyc")
os.a = (locals(), globals(), args, kwargs)
os.environ["NO_COLOR"] = "1"
ForkingServer(
SlaveService,
hostname="0.0.0.0",
port=9999,
reuse_addr=True,
).start()
In that case, you will need to setup the python2 env, which is not that practical.
python2 -m ensurepip --user
python2 -m pip install --user virtualenv
python2 -m virtualenv venv
source ./venv/bin/activate
python -m pip install rpyc==3.4.4 ipython
I also realize that directly using c.modules fails sometimes, but providing a wrapper around the module works.
For instance,
import rpyc;c = rpyc.classic.connect("192.168.1.36", 9999)
c.modules.plyer.flash.on()
========= Remote Traceback (1) =========
Traceback (most recent call last):
File "/home/test/project/.buildozer/android/platform/build/dists/poc/private/lib/python2.7/site-packages/rpyc/core/protocol.py", line 347, in _dispatch_request
File "/home/test/project/.buildozer/android/platform/build/dists/poc/private/lib/python2.7/site-packages/rpyc/core/protocol.py", line 624, in _handle_call
File "/home/test/project/.buildozer/android/platform/build/dists/poc/private/lib/python2.7/site-packages/plyer/facades/flash.py", line 50, in on
File "/home/test/project/.buildozer/android/platform/build/dists/poc/private/lib/python2.7/site-packages/plyer/facades/flash.py", line 71, in _on
NotImplementedError
But, as soon as it was used once in the apk, then it becomes available.
But generally, it is not very practical.
Notes linking here
- a python runtime on android (blog)