From ef01d48ef2cc0d49abc060feb6763e44c09c2058 Mon Sep 17 00:00:00 2001 From: Dither Dude <88754523+DitherDude@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:32:24 +1100 Subject: [PATCH 01/13] modernize workspace, fix bugs/typos --- README.md | 33 ++++++++---------- .../{app-release.apk => app-release_old.apk} | Bin .../RemoteLinuxUnlocker/app/build.gradle | 23 ++++++------ .../app/src/main/AndroidManifest.xml | 12 +++---- .../RemoteLinuxUnlocker/build.gradle | 8 +++-- .../gradle/wrapper/gradle-wrapper.properties | 2 +- linux-daemon/keys.db | 2 ++ linux-daemon/remote-linux-pair | 19 +++++----- linux-daemon/unlocker-daemon.py | 30 ++++++++-------- ...deamon.service => unlocker-daemon.service} | 0 10 files changed, 65 insertions(+), 64 deletions(-) rename android-application/RemoteLinuxUnlocker/app/{app-release.apk => app-release_old.apk} (100%) mode change 100644 => 100755 linux-daemon/unlocker-daemon.py rename linux-daemon/{unlocker-deamon.service => unlocker-daemon.service} (100%) diff --git a/README.md b/README.md index 75caea7..45b2546 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,23 @@ # Remote-Linux-Unlocker -Remote Linux Unlocker is an android application paired with a linux daemon that allows users to unlock and lock the Ubuntu Unity lock screen. - -### How to install the android application -Install the android application from the [Google Play Store](https://play.google.com/store/apps/details?id=com.maxchehab.remotelinuxunlocker) or download the source from this repository. -### How to install the linux daemon +Remote Linux Unlocker is an android application paired with a linux daemon that allows users to unlock and lock the Ubuntu Unity lock screen. -```sh -$ wget https://github.com/maxchehab/remote-linux-unlocker/raw/master/linux-daemon/linux-daemon.zip +## How to install the android application -$ unzip linux-daemon.zip +Install the android application from the [Google Play Store](https://play.google.com/store/apps/details?id=com.maxchehab.remotelinuxunlocker) or download the source from this repository. -$ cd linux-daemon +## How to install the linux daemon +```console +user@machine:~/Downloads$ wget https://github.com/maxchehab/remote-linux-unlocker/raw/master/linux-daemon/linux-daemon.zip +user@machine:~/Downloads$ unzip linux-daemon.zip +user@machine:~/Downloads$ cd linux-daemon #edit `unlocker-daemon.service` so that the absolute path to unlocker-daemon.py is correct +#run the below commands as sudo! +root@machine:.../linux-daemon# mv unlocker-daemon.service /etc/systemd/system/unlocker-daemon.service +root@machine:~# systemctl daemon-reload +root@machine:~# systemctl enable unlocker-daemon +root@machine:~# systemctl start unlocker-daemon -$ mv unlocker-daemon.service /etc/systemd/system/unlocker-daemon - -$ sudo systemctl daemon-reload - -$ sudo systemctl enable unlocker-daemon - -$ sudo systemctl start unlocker-daemon - -$ ./remote-linux-pair +user@machine:.../linux-daemon$ ./remote-linux-pair ``` - diff --git a/android-application/RemoteLinuxUnlocker/app/app-release.apk b/android-application/RemoteLinuxUnlocker/app/app-release_old.apk similarity index 100% rename from android-application/RemoteLinuxUnlocker/app/app-release.apk rename to android-application/RemoteLinuxUnlocker/app/app-release_old.apk diff --git a/android-application/RemoteLinuxUnlocker/app/build.gradle b/android-application/RemoteLinuxUnlocker/app/build.gradle index a2b793e..7dfd9fc 100644 --- a/android-application/RemoteLinuxUnlocker/app/build.gradle +++ b/android-application/RemoteLinuxUnlocker/app/build.gradle @@ -2,11 +2,11 @@ apply plugin: 'com.android.application' android { compileSdkVersion 25 - buildToolsVersion "25.0.3" + // buildToolsVersion "25.0.3" defaultConfig { applicationId "com.maxchehab.remotelinuxunlocker" minSdkVersion 15 - targetSdkVersion 25 + targetSdkVersion 36 vectorDrawables.useSupportLibrary = true versionCode 1 versionName "1.0" @@ -18,18 +18,19 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + namespace = "com.maxchehab.remotelinuxunlocker" } dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + implementation fileTree(include: ['*.jar'], dir: 'libs') + androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - compile 'com.android.support:appcompat-v7:25.3.1' - compile 'com.google.code.gson:gson:2.8.1' - compile 'com.android.support.constraint:constraint-layout:1.0.2' - compile 'com.android.support:cardview-v7:25.3.1' - compile 'com.android.support:design:25.3.1' - compile 'de.hdodenhof:circleimageview:2.1.0' - testCompile 'junit:junit:4.12' + implementation 'com.android.support:appcompat-v7:25.3.1' + implementation 'com.google.code.gson:gson:2.8.1' + implementation 'com.android.support.constraint:constraint-layout:1.0.2' + implementation 'com.android.support:cardview-v7:25.3.1' + implementation 'com.android.support:design:25.3.1' + implementation 'de.hdodenhof:circleimageview:2.1.0' + testImplementation 'junit:junit:4.12' } diff --git a/android-application/RemoteLinuxUnlocker/app/src/main/AndroidManifest.xml b/android-application/RemoteLinuxUnlocker/app/src/main/AndroidManifest.xml index a27b742..347992b 100644 --- a/android-application/RemoteLinuxUnlocker/app/src/main/AndroidManifest.xml +++ b/android-application/RemoteLinuxUnlocker/app/src/main/AndroidManifest.xml @@ -1,7 +1,5 @@ - - + @@ -14,16 +12,16 @@ android:theme="@style/AppTheme"> + android:label="Remote Linux Unlocker" + android:exported="true"> - - + @@ -31,7 +29,7 @@ - + diff --git a/android-application/RemoteLinuxUnlocker/build.gradle b/android-application/RemoteLinuxUnlocker/build.gradle index d0aa704..1886a13 100644 --- a/android-application/RemoteLinuxUnlocker/build.gradle +++ b/android-application/RemoteLinuxUnlocker/build.gradle @@ -2,10 +2,11 @@ buildscript { repositories { - jcenter() + google() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.2' + classpath 'com.android.tools.build:gradle:8.13.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -14,7 +15,8 @@ buildscript { allprojects { repositories { - jcenter() + google() + mavenCentral() } } diff --git a/android-application/RemoteLinuxUnlocker/gradle/wrapper/gradle-wrapper.properties b/android-application/RemoteLinuxUnlocker/gradle/wrapper/gradle-wrapper.properties index ad11cb9..770d454 100644 --- a/android-application/RemoteLinuxUnlocker/gradle/wrapper/gradle-wrapper.properties +++ b/android-application/RemoteLinuxUnlocker/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip \ No newline at end of file diff --git a/linux-daemon/keys.db b/linux-daemon/keys.db index 1240cab..483726e 100644 --- a/linux-daemon/keys.db +++ b/linux-daemon/keys.db @@ -1,2 +1,4 @@ 5743704979839069563839512692265820549527076999492449313315050835 6912957806010502767906158581762725597848101883591337724546592587 +2019891348015311394374135656449485766600560133806280440431172113 +5442672082223686760072323450995977760483866293191676888539121251 diff --git a/linux-daemon/remote-linux-pair b/linux-daemon/remote-linux-pair index ca80187..0cfdcb5 100755 --- a/linux-daemon/remote-linux-pair +++ b/linux-daemon/remote-linux-pair @@ -1,12 +1,13 @@ #!/usr/bin/env python import socket, sys, json, struct, os -from pprint import pprint +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) def is_json(myjson): try: json_object = json.loads(myjson) - except ValueError, e: + except (ValueError, e): return False return True @@ -32,7 +33,7 @@ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect((str(get_default_gateway_linux()), 0)) IP = s.getsockname()[0] -print >>sys.stderr, "You are about to pair a new device to this computer.\nIf you have not done so already, please open the Remote Linux Unlocker app. You can download it here: https://play.google.com/store/apps/details?id=com.maxchehab.remotelinuxunlocker\nWhen you are ready, please type the following IP address into the required field on your device.\n\nIP Address: " + IP +eprint("You are about to pair a new device to this computer.\nIf you have not done so already, please open the Remote Linux Unlocker app. You can download it here: https://play.google.com/store/apps/details?id=com.maxchehab.remotelinuxunlocker\nWhen you are ready, please type the following IP address into the required field on your device.\n\nIP Address: " + IP) sock.bind(server_address) # Listen for incoming connections @@ -40,16 +41,16 @@ sock.listen(1) while True: # Wait for a connection - print >>sys.stderr, '\nAwaiting your response...' + eprint('\nAwaiting your response...') connection, client_address = sock.accept() try: - print >>sys.stderr, 'Connection received...' + eprint('Connection received...') # Receive the data in small chunks and retransmit it while True: data = connection.recv(256).strip() - print >>sys.stderr, 'Processing request...' + eprint('Processing request...') if is_json(data): data = json.loads(data) if data["command"] == "pair" and len(data["key"]) == 64: @@ -59,12 +60,12 @@ while True: append_write = 'w' # make a new file if not with open(os.path.dirname(os.path.realpath(__file__)) + '/keys.db', append_write) as file: file.write(data["key"] + "\n") - connection.sendall('{"status":"success"}') - print >> sys.stderr, 'Pairing was successful!' + connection.sendall(b'{"status":"success"}') + eprint('Pairing was successful!') sys.exit() else: - print >>sys.stderr, 'Invalid request!' + eprint('Invalid request!') sys.exit() break diff --git a/linux-daemon/unlocker-daemon.py b/linux-daemon/unlocker-daemon.py old mode 100644 new mode 100755 index 28f6e4a..34e2442 --- a/linux-daemon/unlocker-daemon.py +++ b/linux-daemon/unlocker-daemon.py @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- import socket, sys, json, subprocess, os -from pprint import pprint + +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) def is_json(myjson): try: json_object = json.loads(myjson) - except ValueError, e: + except (ValueError, e): return False return True @@ -38,7 +40,7 @@ def authenticate_key(key): # Bind the socket to the port server_address = ('', 61599) -print >>sys.stderr, 'starting up on %s port %s' % server_address +eprint('starting up on %s port %s' % server_address) sock.bind(server_address) # Listen for incoming connections @@ -46,37 +48,37 @@ def authenticate_key(key): while True: # Wait for a connection - print >>sys.stderr, 'waiting for a connection' + eprint('waiting for a connection') connection, client_address = sock.accept() try: - print >>sys.stderr, 'connection from', client_address + eprint('connection from', client_address) # Receive the data in small chunks and retransmit it while True: data = connection.recv(256).strip() - print >>sys.stderr, 'received "%s"' % data + eprint('received "%s"' % data) if is_json(data): data = json.loads(data) if data["command"] == "lock" and data["key"] and authenticate_key(data["key"]): - print >>sys.stderr, 'client requesting lock' + eprint('client requesting lock') subprocess.call(["loginctl", "lock-sessions"]) - connection.sendall('{"status":"success"') + connection.sendall(b'{"status":"success"') break elif data["command"] == "unlock" and data["key"] and authenticate_key(data["key"]): - print >>sys.stderr, 'client requesting unlock' + eprint('client requesting unlock') subprocess.call(["loginctl", "unlock-sessions"]) - connection.sendall('{"status":"success"') + connection.sendall(b'{"status":"success"') break elif data["command"] == "status" and data["key"] and authenticate_key(data["key"]): - print >>sys.stderr, 'client requesting echo' + eprint('client requesting echo') response = '{"status":"success","hostname":"' + socket.gethostname() + '","isLocked":"' + str(is_locked()) + '"}'; - print >> sys.stderr, response - connection.sendall(response) + eprint( response) + connection.sendall(response.encode("utf-8")) break else: - print >>sys.stderr, 'no more data from', client_address + eprint('no more data from', client_address) break finally: diff --git a/linux-daemon/unlocker-deamon.service b/linux-daemon/unlocker-daemon.service similarity index 100% rename from linux-daemon/unlocker-deamon.service rename to linux-daemon/unlocker-daemon.service From 13f9be386421bac4f805f5ca57ede51080953ba9 Mon Sep 17 00:00:00 2001 From: Dither Dude <88754523+DitherDude@users.noreply.github.com> Date: Sun, 14 Dec 2025 02:30:28 +1100 Subject: [PATCH 02/13] DeleteMenu --- .gitignore | 1 + .../RemoteLinuxUnlocker/.idea/.gitignore | 3 + .../.idea/AndroidProjectSystem.xml | 6 + .../.idea/caches/deviceStreaming.xml | 1138 +++++++++++++++++ .../RemoteLinuxUnlocker/.idea/compiler.xml | 18 +- .../.idea/deploymentTargetSelector.xml | 13 + .../RemoteLinuxUnlocker/.idea/gradle.xml | 9 +- .../RemoteLinuxUnlocker/.idea/migrations.xml | 10 + .../RemoteLinuxUnlocker/.idea/misc.xml | 14 +- .../RemoteLinuxUnlocker/.idea/modules.xml | 9 - .../.idea/runConfigurations.xml | 8 + .../ComputerListActivity.java | 74 +- .../remotelinuxunlocker/DeleteLayout.java | 89 ++ .../res/layout/activity_computer_list.xml | 28 +- .../res/layout/activity_lock_computer.xml | 4 +- .../app/src/main/res/layout/delete_layout.xml | 75 ++ linux-daemon/keys.db | 4 - linux-daemon/remote-linux-pair | 16 +- linux-daemon/unlocker-daemon.py | 48 +- 19 files changed, 1484 insertions(+), 83 deletions(-) create mode 100644 .gitignore create mode 100644 android-application/RemoteLinuxUnlocker/.idea/.gitignore create mode 100644 android-application/RemoteLinuxUnlocker/.idea/AndroidProjectSystem.xml create mode 100644 android-application/RemoteLinuxUnlocker/.idea/caches/deviceStreaming.xml create mode 100644 android-application/RemoteLinuxUnlocker/.idea/deploymentTargetSelector.xml create mode 100644 android-application/RemoteLinuxUnlocker/.idea/migrations.xml delete mode 100644 android-application/RemoteLinuxUnlocker/.idea/modules.xml create mode 100644 android-application/RemoteLinuxUnlocker/app/src/main/java/com/maxchehab/remotelinuxunlocker/DeleteLayout.java create mode 100644 android-application/RemoteLinuxUnlocker/app/src/main/res/layout/delete_layout.xml delete mode 100644 linux-daemon/keys.db diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..38156aa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +keys \ No newline at end of file diff --git a/android-application/RemoteLinuxUnlocker/.idea/.gitignore b/android-application/RemoteLinuxUnlocker/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/android-application/RemoteLinuxUnlocker/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/android-application/RemoteLinuxUnlocker/.idea/AndroidProjectSystem.xml b/android-application/RemoteLinuxUnlocker/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/android-application/RemoteLinuxUnlocker/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/android-application/RemoteLinuxUnlocker/.idea/caches/deviceStreaming.xml b/android-application/RemoteLinuxUnlocker/.idea/caches/deviceStreaming.xml new file mode 100644 index 0000000..97cf2b8 --- /dev/null +++ b/android-application/RemoteLinuxUnlocker/.idea/caches/deviceStreaming.xml @@ -0,0 +1,1138 @@ + + + + + + \ No newline at end of file diff --git a/android-application/RemoteLinuxUnlocker/.idea/compiler.xml b/android-application/RemoteLinuxUnlocker/.idea/compiler.xml index 96cc43e..b86273d 100644 --- a/android-application/RemoteLinuxUnlocker/.idea/compiler.xml +++ b/android-application/RemoteLinuxUnlocker/.idea/compiler.xml @@ -1,22 +1,6 @@ - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/android-application/RemoteLinuxUnlocker/.idea/deploymentTargetSelector.xml b/android-application/RemoteLinuxUnlocker/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..5394967 --- /dev/null +++ b/android-application/RemoteLinuxUnlocker/.idea/deploymentTargetSelector.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/android-application/RemoteLinuxUnlocker/.idea/gradle.xml b/android-application/RemoteLinuxUnlocker/.idea/gradle.xml index 7ac24c7..88e9c3c 100644 --- a/android-application/RemoteLinuxUnlocker/.idea/gradle.xml +++ b/android-application/RemoteLinuxUnlocker/.idea/gradle.xml @@ -1,17 +1,18 @@ + diff --git a/android-application/RemoteLinuxUnlocker/.idea/migrations.xml b/android-application/RemoteLinuxUnlocker/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/android-application/RemoteLinuxUnlocker/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/android-application/RemoteLinuxUnlocker/.idea/misc.xml b/android-application/RemoteLinuxUnlocker/.idea/misc.xml index f1c4621..da3439f 100644 --- a/android-application/RemoteLinuxUnlocker/.idea/misc.xml +++ b/android-application/RemoteLinuxUnlocker/.idea/misc.xml @@ -1,8 +1,8 @@ - + - - - - - - - - - - - + diff --git a/android-application/RemoteLinuxUnlocker/.idea/modules.xml b/android-application/RemoteLinuxUnlocker/.idea/modules.xml deleted file mode 100644 index 0d01919..0000000 --- a/android-application/RemoteLinuxUnlocker/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/android-application/RemoteLinuxUnlocker/.idea/runConfigurations.xml b/android-application/RemoteLinuxUnlocker/.idea/runConfigurations.xml index 7f68460..72f00ed 100644 --- a/android-application/RemoteLinuxUnlocker/.idea/runConfigurations.xml +++ b/android-application/RemoteLinuxUnlocker/.idea/runConfigurations.xml @@ -3,6 +3,14 @@