An Android app written in C/C++, Java, and Kotlin to run Openpyn remotely through JuiceSSH. Special thanks to NvidiaGpuMonitor, a JuiceSSH plugin written in Kotlin by sds100 which served as a base for this JuiceSSH plugin.
Note: The first public beta has been released.
- add Telnet functionality for connecting to OpenVPN management interface
- apply clean(er) app architecture
- Introduction
- Features
- How it works
- How to use
- Screenshots
- Download
- Requirements
- References
- Libraries used
- Feedback
- Credits
- Built with
- Attributions
- Acknowledgments
The idea all started when I wanted to connect to OpenVPN servers hosted by NordVPN on a Asus RT-AC86U. By default this is possible, but the default firmware including third party firmware Asuswrt-merlin only allow for a maximum of 5 OpenVPN Clients to be saved.
I then stumbled on Openpyn, quickly learned Python, and made a pull request, enabling support for Asuswrt-merlin. Openpyn is a python3 script which can be run on Entware-ng-3x on Asuswrt-merlin. The main feature of Openpyn, is that it automatically connects to the least busy, lowest latency OpenVPN server. NVRAM write support for Asuswrt-merlin in Openpyn is then able to save the least busy, lowest latency OpenVPN server to the NVRAM of a Entware-ng-3x enabled ASUS router.
Now, I had achieved more or less what I desired, but this left me with one last struggle, having to resort to open a SSH connection to the ASUS router and supplying Openpyn with the desired arguments e.g., country, load threshold, server type, and number of pings to be sent to each server to determine quality. I thought that having the ability to do that on my phone instead of my computer would make this a lot easier, and that led me to discovering JuiceSSH.
JuiceSSH supports the use of plugins, which allowed me to create this fantastic app. This app runs on Android, it establishes a connection to a device that has a SSH server running on it, and it is then able to send a Openpyn command to the remote device.
Note: This project is my very first Android project, and as such, it may not follow all the best coding practices yet, regardless of this, I'm committed to make this app a source of inspiration for other developers working on similar based Android apps, especially Google Maps based Android apps.
-
Supports most arguments available in Openpyn with easy to use preferences
-
Allows to use location based filtering in Openpyn
-
Map view displays markers for every country supported by NordVPN
-
Allows to hide countries in the map view
-
Allows to star a country in the map view
-
API keys stored in shared preferences are encrypted ("AES/GCM/NoPadding")
-
On app start, it will use a smart location, to determine the closest country
-
Uses Geolocation APIs to determine the current location based on the current public IP address
Am I missing some essential feature?
- Submit an issue and let's make this app better together!
A lot of components make this app work, I'll cover some of the basics here. Basically on app startup, the map is loaded asynchronously, an MBTile file (SQLite database) located in the assets resource folder within the APK is loaded and then stored and read in memory. The world.mbtiles was generated using a custom python script, generate_tiles_multiprocess.py.
rm ./app/src/main/assets/world.mbtiles
python3 ./generate_tiles_multiprocess.py ./mapfile.xml ./app/src/main/assets/world.mbtiles 4 4 --format webp
After the map is done loading, the NordVPN API is invoked to query all the supported countries, filtering based on preferences such as server type is done here, markers are generated lazily for all the countries (markers are not placed on the map), all tiles (512x512 WebP images) are pre-loaded for the minimum zoom scale specified by the MBTile file. The current location is detected based on the public IP address of the client. The map then animates to the marker closest to this location. After animation completes, only the "lazy" markers whose location are within the visible bounds of the map are made visible (markers are placed on the map once they are made visible for the first time).
- Install JuiceSSH
- Add a new connection to Connections in JuiceSSH
- Install this app
- When prompted, enable/allow the permissions required by this app
- Change any app settings as required
- Select a Country by selecting a marker on the map
- Click the colored floating action button (FAB), to send a Openpyn command to the remote device
Note: You can use this flow with multiple remote devices, as long as that remote device has a SSH server running on it and is configured in Connections in JuiceSSH and is selected in the app toolbar of this app before the colored floating action button (FAB) is clicked!
The public beta is open to anyone.
Please use my test
branch of Openpyn.
git clone --branch 2.2.1 [email protected]:1951FDG/openpyn-nordvpn.git
cd openpyn-nordvpn
pip3 install --upgrade .
To compile and run the project you'll need:
-
- Android
10 (API level 29)
- Android SDK Build-Tools
29.0.2
- CMake
v3.10.2
- Android SDK Platform-Tools
- Android SDK Tools
- NDK
- Android
-
Maps SDK for Android
-
MyStorage.kt inspired by blog post, Save and retrieve ArrayList of Object in SharedPreference: Android from Ready Android.
-
PrintArray.kt inspired by Github repo, PrintArray by Tobibur Rahman.
-
SecurityManager.java inspired by blog post, Making secured version of EditTextPreference by Nikita Ogorodnikov.
- AndroidX
- Anko
- Barista
- BlockCanary
- countryboundaries
- EasyPermissions
- Fuel
- GDPRDialog
- gradle-android-git-version
- JuiceSSH Plugin Library
- Kotlin coroutines
- Kotlin
- Ktor
- LeakCanary
- Minibar
- Moshi
- Moshi: Pristine Models
- MultiSelectDialog
- PreferenceActivityCompat
- ProgressToolbar
- Result
- SLF4J
- SnackProgressBar
- SQLite
- StaticLog
- SVC
- Toasty
- Unused Resources Remover for Android
Feel free to send us feedback by submitting an issue. Bug reports, feature requests, patches, and well-wishes are always welcome.
Note: Pull requests are welcome. For major changes, please submit an issue first to discuss what you would like to change.
This app uses (modified) code from several open source projects.
-
- Modified sqlite3ndk.h
- Modified sqlite3ndk.cpp
-
- Modified LazyMarker.java
-
- Modified CameraUpdateAnimator.java
-
Android Google Maps API v2 Add-ons
- Modified MapBoxOfflineTileProvider.java
-
- Modified CheckableFloatingActionButton.java
- Modified CheckedSavedState.java
Note: Special thanks to Yesy, author of Read SQLite Database from Android Asset Resource
- AX2J
- AdaptiveIconPlayground
- Adobe Illustrator
- Android Studio
- Atom
- Codacy
- DB Browser for SQLite
- Dependabot
- Detekt
- Fastlane
- Firebase Crashlytics
- JSON Schema Tool
- Kotlin Code Sorter
- Maps SDK for Android
- Mobile Export Script for Illustrator
- QuickDemo
- Regex101
- Shape Shifter
- Snyk
- SonarLint
- Sourcetree
- TileMill
Many thanks to Sonelli who made this project possible and painless. Special thanks to Krystian Bigaj, author of SQLite-NDK.