From a476b8276c895b94e9f0912eb22e0cf7fd16f49f Mon Sep 17 00:00:00 2001 From: aradhyamathur Date: Sat, 9 Dec 2017 11:58:16 +0530 Subject: [PATCH 1/7] accelerometer typo fix --- plyer_command_list.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plyer_command_list.rst b/plyer_command_list.rst index 817774c..d9f4d83 100644 --- a/plyer_command_list.rst +++ b/plyer_command_list.rst @@ -160,7 +160,7 @@ Example:: from plyer import accelerometer accelerometer.enable() - accelerator.acceleration + accelerometer.acceleration Battery -------- From bfc6d3e9b385b5f351e0b3d41434ed89372bc435 Mon Sep 17 00:00:00 2001 From: "Karl E. Nelson" Date: Tue, 21 Jul 2020 18:13:01 -0700 Subject: [PATCH 2/7] Fix version sheer --- .gitignore | 2 ++ buildozer.spec | 3 ++- main.py | 58 +++++++++++++++++++++++++++++++++++++++++++++++- requirements.txt | 2 +- 4 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f9a9ead --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.buildozer +bin diff --git a/buildozer.spec b/buildozer.spec index 924b083..11cf07f 100644 --- a/buildozer.spec +++ b/buildozer.spec @@ -18,7 +18,7 @@ version.regex = __version__ = '(.*)' version.filename = %(source.dir)s/main.py # requirements of the app -requirements = hostpython2,android,cryptography,pyasn1,pyjnius,twisted,kivy,docutils,pygments,cffi +requirements = hostpython3==3.7.8,android,cryptography,pyasn1,pyjnius,bcrypt,attrs,twisted,kivy,docutils,pygments,cffi # android specific android.permissions = INTERNET, WAKE_LOCK, CAMERA, VIBRATE, ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, SEND_SMS, CALL_PRIVILEGED, CALL_PHONE @@ -26,6 +26,7 @@ android.permissions = INTERNET, WAKE_LOCK, CAMERA, VIBRATE, ACCESS_COARSE_LOCATI #android.sdk=21 #android.api=22 +android.accept_sdk_license=True android.wakelock=True #orientation=all diff --git a/main.py b/main.py index b7c3798..fc56b3b 100644 --- a/main.py +++ b/main.py @@ -10,6 +10,7 @@ from twisted.internet import reactor from twisted.cred import portal, checkers from twisted.conch import manhole, manhole_ssh +from twisted.conch.ssh import keys from kivy.lang import Builder from kivy.uix.floatlayout import FloatLayout from kivy.properties import StringProperty @@ -19,6 +20,59 @@ from kivy.uix.screenmanager import Screen app = None +#+---[RSA 3072]----+ +#|E .o o=.o.=.. | +#|o...=**=o= = | +#|o.o.+*++= + . . | +#|o+ . ....+ . o +.| +#| o ..S. . . +| +#| o .. | +#| . . | +#| . . | +#| .. | +#+----[SHA256]-----+ +private_rsa="""-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn +NhAAAAAwEAAQAAAYEArtmBetbHICKPEQAYsE74WS5m9JNnHVmkijJ+shnVW6QGLcG6meov +WcTiEq0Ti8/r7Yj5oNg7gheNjKEck5QJQJELNIiVQQ8iMDOZrwAgwpLxKnQiYW+X4EoIqk +lRPQvng3SL9uJ2Rz5Q9Ti353Ir1CBD5J9EpsIUkY0LfiAXjAdMgMzOMGnIvept+uEnSQR0 +OmMYxdpRVTLVn6mBbvNCWXpJTPm5ksBgGfkLyyLdLIOIXBnIuL6FrtRCH9khW28cx8oxcs +sz5eEOEEY2WV6CRuT+hpinTBPQzzqQDbckTfNGVqULPlc40eF9Swa3n9YrKJRL32P9bK31 +ZUGWWJuzy6XSZ0D/WdrZEG+DTzHe4Qe8li2Of7DK0dRYvPj564QJWLRvQIzpUgjA/wkbAj +Jq1kyCzZSd2WYxQz175UNZzT7sHRXGHq4kh7Ooa57o9ebZf0xErep178lOg4MIcrOlK5AZ +p3HJV8HkfFQ5P0ULVUANc150pjCkNX0AnGzWKk0DAAAFiO+OF3/vjhd/AAAAB3NzaC1yc2 +EAAAGBAK7ZgXrWxyAijxEAGLBO+FkuZvSTZx1ZpIoyfrI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It0sg4hcGci4voWu1EIf2SFbbxzHyjFyyzPl4Q4QRjZZXoJG5P6GmKdME9DPOpANtyRN80ZWpQs+VzjR4X1LBref1isolEvfY/1srfVlQZZYm7PLpdJnQP9Z2tkQb4NPMd7hB7yWLY5/sMrR1Fi8+PnrhAlYtG9AjOlSCMD/CRsCMmrWTILNlJ3ZZjFDPXvlQ1nNPuwdFcYeriSHs6hrnuj15tl/TESt6nXvyU6Dgwhys6UrkBmncclXweR8VDk/RQtVQA1zXnSmMKQ1fQCcbNYqTQM=" + def getManholeFactory(namespace, **passwords): realm = manhole_ssh.TerminalRealm() @@ -29,6 +83,8 @@ def getManhole(_): p.registerChecker( checkers.InMemoryUsernamePasswordDatabaseDontUse(**passwords)) f = manhole_ssh.ConchFactory(p) + f.publicKeys[b'ssh-rsa'] = keys.Key.fromString(public_rsa) + f.privateKeys[b'ssh-rsa'] = keys.Key.fromString(private_rsa) return f @@ -55,7 +111,7 @@ def get_interface_ip(self, ifname): return socket.inet_ntoa(fcntl.ioctl( s.fileno(), 0x8915, # SIOCGIFADDR - struct.pack('256s', ifname[:15]) + struct.pack('256s', ifname[:15].encode('utf-8')) )[20:24]) diff --git a/requirements.txt b/requirements.txt index 355908d..087b590 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,4 @@ pyasn1==0.1.9 pycrypto==2.6.1 requests==2.11.1 Twisted==15.4.0 -zope.interface==4.3.2 +#zope.interface==4.3.2 From 00849a17c3cd20b20e20b563437445dac1410a00 Mon Sep 17 00:00:00 2001 From: "Karl E. Nelson" Date: Thu, 23 Jul 2020 21:36:20 -0700 Subject: [PATCH 3/7] Updated the manhole so it will disconnect properly --- buildozer.spec | 11 ++-- main.py | 40 +++++++++++--- test.py | 139 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+), 11 deletions(-) create mode 100644 test.py diff --git a/buildozer.spec b/buildozer.spec index 11cf07f..4c91fe8 100644 --- a/buildozer.spec +++ b/buildozer.spec @@ -18,18 +18,21 @@ version.regex = __version__ = '(.*)' version.filename = %(source.dir)s/main.py # requirements of the app -requirements = hostpython3==3.7.8,android,cryptography,pyasn1,pyjnius,bcrypt,attrs,twisted,kivy,docutils,pygments,cffi +requirements = hostpython3==3.6.8,android,cryptography,pyasn1,pyjnius,bcrypt,attrs,twisted,kivy,docutils,pygments,cffi # android specific -android.permissions = INTERNET, WAKE_LOCK, CAMERA, VIBRATE, ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, SEND_SMS, CALL_PRIVILEGED, CALL_PHONE +android.permissions = INTERNET, WAKE_LOCK, CAMERA, VIBRATE, ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, SEND_SMS, CALL_PRIVILEGED, CALL_PHONE, BLUETOOTH #android.sdk=21 #android.api=22 android.accept_sdk_license=True - android.wakelock=True -#orientation=all +orientation=portrait +fullscreen=True +p4a.branch = develop + +#presplash.filename= [buildozer] log_level = 2 diff --git a/main.py b/main.py index fc56b3b..46a25dd 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -__version__ = '0.1' +__version__ = '0.2' # install_twisted_rector must be called before importing and using the reactor from kivy.support import install_twisted_reactor @@ -73,15 +73,41 @@ public_rsa="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCu2YF61scgIo8RABiwTvhZLmb0k2cdWaSKMn6yGdVbpAYtwbqZ6i9ZxOISrROLz+vtiPmg2DuCF42MoRyTlAlAkQs0iJVBDyIwM5mvACDCkvEqdCJhb5fgSgiqSVE9C+eDdIv24nZHPlD1OLfncivUIEPkn0SmwhSRjQt+IBeMB0yAzM4waci96m364SdJBHQ6YxjF2lFVMtWfqYFu80JZeklM+bmSwGAZ+QvLIt0sg4hcGci4voWu1EIf2SFbbxzHyjFyyzPl4Q4QRjZZXoJG5P6GmKdME9DPOpANtyRN80ZWpQs+VzjR4X1LBref1isolEvfY/1srfVlQZZYm7PLpdJnQP9Z2tkQb4NPMd7hB7yWLY5/sMrR1Fi8+PnrhAlYtG9AjOlSCMD/CRsCMmrWTILNlJ3ZZjFDPXvlQ1nNPuwdFcYeriSHs6hrnuj15tl/TESt6nXvyU6Dgwhys6UrkBmncclXweR8VDk/RQtVQA1zXnSmMKQ1fQCcbNYqTQM=" - -def getManholeFactory(namespace, **passwords): +class PythonManhole(manhole.ColoredManhole): + def __init__(self): + glob = { + '__name__':'__main__', + '__doc__':None, + '__package__':None, + '__spec__':None, + '__annotations__':{}, + '__builtins__':__builtins__ + } + + super().__init__(glob) + + def makeConnection(self, cxt): + self.transport = cxt.transport + return super().makeConnection(cxt) + + def lineReceived(self, *args): + # Catch exit() + try: + return super().lineReceived(*args) + except SystemExit: + self.transport.loseConnection() + + +def getManholeFactory(**users): + # Create a terminal realm = manhole_ssh.TerminalRealm() - def getManhole(_): - return manhole.ColoredManhole(namespace) - realm.chainedProtocolFactory.protocolFactory = getManhole + realm.chainedProtocolFactory.protocolFactory = PythonManhole + users = {key: value.encode() for key, value in users.items()} p = portal.Portal(realm) p.registerChecker( - checkers.InMemoryUsernamePasswordDatabaseDontUse(**passwords)) + checkers.InMemoryUsernamePasswordDatabaseDontUse(**users)) + + # Create a factory f = manhole_ssh.ConchFactory(p) f.publicKeys[b'ssh-rsa'] = keys.Key.fromString(public_rsa) f.privateKeys[b'ssh-rsa'] = keys.Key.fromString(private_rsa) diff --git a/test.py b/test.py new file mode 100644 index 0000000..6736043 --- /dev/null +++ b/test.py @@ -0,0 +1,139 @@ +__version__ = '0.2' + +import socket +import fcntl +import struct +from twisted.internet import reactor +from twisted.cred import portal, checkers +from twisted.conch import manhole, manhole_ssh +from twisted.conch.ssh import keys +from twisted.conch.insults import insults + +app = None + +#+---[RSA 3072]----+ +#|E .o o=.o.=.. | +#|o...=**=o= = | +#|o.o.+*++= + . . | +#|o+ . ....+ . o +.| +#| o ..S. . . +| +#| o .. | +#| . . | +#| . . | +#| .. | +#+----[SHA256]-----+ +private_rsa="""-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNza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cU/biurucF2GcxHsDciKonYkWDhj9RJr93lMm1A5kvRAR+xH7D0jULAaJAWxD44MxLchsD +vT4m/QjXL/yqAIDmPASVPY5QXfaav3dwAAAMEAyVB6Vcd9f/XfaLN0dqDHmM34xLNTweSJ +mfMEDY8+6dxrGQLzm/iXYI1kAY5DRHliv6cnJSgYER8taKKr2Zv7rq9Gn8TOOgLWRpykr9 +wprxjnrGigtOh745mNzNYPQyl5ezELyPXQWwKRPoWcMYK97Fp1KoNbym01oViW/gjudshR +k2VSfgZ8APPrk3TdAyYVP8q8us8DFvKv+y2TtMHaItkDtRPsUegcLGwKFbuACVeztKA8rz +Et+tV+X6nVLZHVAAAADGtlbmVsc29uQEV2ZQECAwQFBg== +-----END OPENSSH PRIVATE KEY----- +""" + +public_rsa="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCu2YF61scgIo8RABiwTvhZLmb0k2cdWaSKMn6yGdVbpAYtwbqZ6i9ZxOISrROLz+vtiPmg2DuCF42MoRyTlAlAkQs0iJVBDyIwM5mvACDCkvEqdCJhb5fgSgiqSVE9C+eDdIv24nZHPlD1OLfncivUIEPkn0SmwhSRjQt+IBeMB0yAzM4waci96m364SdJBHQ6YxjF2lFVMtWfqYFu80JZeklM+bmSwGAZ+QvLIt0sg4hcGci4voWu1EIf2SFbbxzHyjFyyzPl4Q4QRjZZXoJG5P6GmKdME9DPOpANtyRN80ZWpQs+VzjR4X1LBref1isolEvfY/1srfVlQZZYm7PLpdJnQP9Z2tkQb4NPMd7hB7yWLY5/sMrR1Fi8+PnrhAlYtG9AjOlSCMD/CRsCMmrWTILNlJ3ZZjFDPXvlQ1nNPuwdFcYeriSHs6hrnuj15tl/TESt6nXvyU6Dgwhys6UrkBmncclXweR8VDk/RQtVQA1zXnSmMKQ1fQCcbNYqTQM=" + +class PythonManhole(manhole.ColoredManhole): + def __init__(self): + glob = { + '__name__':'__main__', + '__doc__':None, + '__package__':None, + '__spec__':None, + '__annotations__':{}, + '__builtins__':__builtins__ + } + + super().__init__(glob) + + def makeConnection(self, cxt): + self.transport = cxt.transport + return super().makeConnection(cxt) + + def lineReceived(self, *args): + # Catch exit() + try: + return super().lineReceived(*args) + except SystemExit: + self.transport.loseConnection() + + +def getManholeFactory(**users): + # Create a terminal + realm = manhole_ssh.TerminalRealm() + realm.chainedProtocolFactory.protocolFactory = PythonManhole + users = {key: value.encode() for key, value in users.items()} + p = portal.Portal(realm) + p.registerChecker( + checkers.InMemoryUsernamePasswordDatabaseDontUse(**users)) + + # Create a factory + f = manhole_ssh.ConchFactory(p) + f.publicKeys[b'ssh-rsa'] = keys.Key.fromString(public_rsa) + f.privateKeys[b'ssh-rsa'] = keys.Key.fromString(private_rsa) + return f + + +#class MainScreen: +# +# def __init__(self, **kwargs): +# ip = socket.gethostbyname(socket.gethostname()) +# if ip.startswith('127.'): +# interfaces = ['eth0', 'eth1', 'eth2', 'wlan0', 'wlan1', 'wifi0', +# 'tiwlan0', 'tiwlan1', 'ath0', 'ath1', 'ppp0'] +# for ifname in interfaces: +# try: +# ip = self.get_interface_ip(ifname) +# break +# except IOError: +# pass +# self.lan_ip = ip +# +# def get_interface_ip(self, ifname): +# s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +# return socket.inet_ntoa(fcntl.ioctl( +# s.fileno(), +# 0x8915, # SIOCGIFADDR +# struct.pack('256s', ifname[:15].encode('utf-8')) +# )[20:24]) +# +# +# +# def on_pause(self): +# return True + +if __name__ == '__main__': + # Define the local variables + connection = reactor.listenTCP(8001, getManholeFactory(admin='kivy')) + reactor.run() From 7a7fe8105187aa3dc106378341b1a9d38fcd5e5c Mon Sep 17 00:00:00 2001 From: Gabriel Pettier Date: Fri, 24 Jul 2020 17:15:20 +0200 Subject: [PATCH 4/7] try to build using github actions --- .github/workflows/android.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..c1b8f25 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,35 @@ +on: [push, pull_request] +name: Android +jobs: + Integration: + strategy: + matrix: + os: + - 'ubuntu-latest' + runs-on: ${{ matrix.os }} + steps: + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - uses: actions/checkout@v2 + - name: Setup environment + run: | + pip install buildozer + pip install Cython + - run: buildozer --help + - name: SDK, NDK and p4a download + run: | + sed -i.bak "s/# android.accept_sdk_license = False/android.accept_sdk_license = True/" buildozer.spec + buildozer android p4a -- --help + - name: Install Linux dependencies + if: matrix.os == 'ubuntu-latest' + run: sudo apt -y install automake + - name: buildozer android debug + run: | + touch main.py + buildozer android debug + - uses: actions/upload-artifact@v2 + with: + path: bin/*.apk + From 429b7655006f7aaa52d9441de7e92c9417580f91 Mon Sep 17 00:00:00 2001 From: Gabriel Pettier Date: Fri, 24 Jul 2020 18:26:23 +0200 Subject: [PATCH 5/7] don't force versions of python and others in buildozer.spec also cache stuff for next builds remove globals() from getManholeFactory call --- .github/workflows/android.yml | 7 +++++++ buildozer.spec | 2 +- main.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index c1b8f25..a1baae6 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -13,6 +13,13 @@ jobs: with: python-version: 3.8 - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.buildozer + .buildozer + key: ${{ hashFiles('buildozer.spec') }} + - name: Setup environment run: | pip install buildozer diff --git a/buildozer.spec b/buildozer.spec index 4c91fe8..3c76fc0 100644 --- a/buildozer.spec +++ b/buildozer.spec @@ -18,7 +18,7 @@ version.regex = __version__ = '(.*)' version.filename = %(source.dir)s/main.py # requirements of the app -requirements = hostpython3==3.6.8,android,cryptography,pyasn1,pyjnius,bcrypt,attrs,twisted,kivy,docutils,pygments,cffi +requirements = android,cryptography,pyasn1,bcrypt,attrs,twisted,kivy,docutils,pygments,cffi # android specific android.permissions = INTERNET, WAKE_LOCK, CAMERA, VIBRATE, ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, SEND_SMS, CALL_PRIVILEGED, CALL_PHONE, BLUETOOTH diff --git a/main.py b/main.py index 46a25dd..b0a682b 100644 --- a/main.py +++ b/main.py @@ -146,7 +146,7 @@ def build(self): global app app = self self.connection = reactor.listenTCP(8000, - getManholeFactory(globals(), admin='kivy')) + getManholeFactory(admin='kivy')) def on_pause(self): return True From ca0661b5483eb8291741ed6f39c37f4ad7467bb3 Mon Sep 17 00:00:00 2001 From: Gabriel Pettier Date: Fri, 24 Jul 2020 19:35:50 +0200 Subject: [PATCH 6/7] disable command screen --- remotekivy.kv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remotekivy.kv b/remotekivy.kv index 5610b57..e301b66 100644 --- a/remotekivy.kv +++ b/remotekivy.kv @@ -69,8 +69,8 @@ NavigationDrawer id: manager MainScreen name: 'remote' - CommandScreen - name: 'plyer' + # CommandScreen + # name: 'plyer' ShellScreen name: 'console' From 004c83a666392e8bfca2f3e9dcd03576b3111802 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Mar 2021 04:53:46 +0000 Subject: [PATCH 7/7] Bump twisted from 15.4.0 to 20.3.0 Bumps [twisted](https://github.com/twisted/twisted) from 15.4.0 to 20.3.0. - [Release notes](https://github.com/twisted/twisted/releases) - [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst) - [Commits](https://github.com/twisted/twisted/compare/twisted-15.4.0...twisted-20.3.0) Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 087b590..0d5167f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,5 @@ Kivy-Garden==0.1.4 pyasn1==0.1.9 pycrypto==2.6.1 requests==2.11.1 -Twisted==15.4.0 +Twisted==20.3.0 #zope.interface==4.3.2