Compare commits
11 Commits
ab82c025b7
...
2e7072a486
Author | SHA1 | Date |
---|---|---|
Alan SCHNEIDER | 2e7072a486 | |
Alan SCHNEIDER | 777fe0f767 | |
Alan SCHNEIDER | b29bca2eea | |
Alan SCHNEIDER | d7737ae256 | |
Alan SCHNEIDER | b943a751dc | |
Alan SCHNEIDER | b979eb95ed | |
Alan SCHNEIDER | 3902a6067d | |
Alan SCHNEIDER | ca6da244fb | |
Alan SCHNEIDER | 008efa9c17 | |
Alan SCHNEIDER | 51ddf370da | |
Alan SCHNEIDER | 66f440db8f |
|
@ -2,8 +2,8 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="me.shkschneider.dropbearserver"
|
||||
android:installLocation="preferExternal"
|
||||
android:versionCode="170"
|
||||
android:versionName="1.7.0" >
|
||||
android:versionCode="171"
|
||||
android:versionName="1.7.1" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="7"
|
||||
|
|
BIN
market/about.png
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 131 KiB |
|
@ -3,10 +3,10 @@ It allows you to easily install, configure and run a Secured SHell on your Andro
|
|||
SSH is a secured (encrypted) protocol that is used on millions of GNU/Linux servers to issue commands remotely.
|
||||
|
||||
THIS REQUIRES ROOT PERMISSIONS
|
||||
If you don't know what 'root' or 'ssh' means, you should not install this!
|
||||
If you don't know what 'root' or 'ssh' means, you probably don't need this!
|
||||
|
||||
* You will be able to gain shell access, just like 'adb shell'
|
||||
* You will be able to put and pull files via 'scp' or similar
|
||||
* You will be able to pull files via 'scp' or similar
|
||||
|
||||
This rich front-end to DropBear allows you to easily configure tons of things:
|
||||
|
||||
|
@ -33,4 +33,8 @@ MacOS:
|
|||
* Terminal: scp
|
||||
* Cyberduck
|
||||
|
||||
Next to come
|
||||
* Working SSH/SCP from phone
|
||||
* Proper detection of PID
|
||||
|
||||
Now you will have full control of your device!
|
||||
|
|
After Width: | Height: | Size: 245 KiB |
|
@ -0,0 +1,6 @@
|
|||
* Many fixes (thanks to A. Davidson, J. Spatschil, D. Kahl, L. Weller and M. Sefi):
|
||||
- Does not conflict with other dropbear binaries
|
||||
- Properly detects server startup with all systems
|
||||
- Fixed FC concerning rotation
|
||||
* Slight interface redesign for ICS
|
||||
* New logo (thanks to Johanna Nizard)
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 97 KiB |
|
@ -1 +1 @@
|
|||
DropBear Server
|
||||
DropBear SSH Server
|
||||
|
|
|
@ -58,7 +58,6 @@ public class MainActivity extends Activity implements CheckerCallback<Boolean> {
|
|||
appVersion = packageInfo.versionName.toString();
|
||||
}
|
||||
catch (Exception e) {
|
||||
appVersion = "1.0";
|
||||
Log.e(TAG, "MainActivity: onCreate(): " + e.getMessage());
|
||||
}
|
||||
Log.i(TAG, appName + " v" + appVersion + " (" + packageName + ") Android " + Build.VERSION.RELEASE + " (API-" + Build.VERSION.SDK + ")");
|
||||
|
|
|
@ -62,7 +62,7 @@ public class DropbearInstaller extends AsyncTask<Void, String, Boolean> {
|
|||
Log.i(TAG, "DropbearInstaller: doInBackground()");
|
||||
|
||||
int step = 0;
|
||||
int steps = 22;
|
||||
int steps = 14;
|
||||
|
||||
String dropbear = ServerUtils.getLocalDir(mContext) + "/dropbear";
|
||||
String dropbearkey = ServerUtils.getLocalDir(mContext) + "/dropbearkey";
|
||||
|
@ -72,12 +72,6 @@ public class DropbearInstaller extends AsyncTask<Void, String, Boolean> {
|
|||
String host_dss = ServerUtils.getLocalDir(mContext) + "/host_dss";
|
||||
String authorized_keys = ServerUtils.getLocalDir(mContext) + "/authorized_keys";
|
||||
String lock = ServerUtils.getLocalDir(mContext) + "/lock";
|
||||
|
||||
// system rw
|
||||
publishProgress("" + step++, "" + steps, "/system Read-Write");
|
||||
if (ShellUtils.remountReadWrite("/system") == false) {
|
||||
return falseWithError("/system");
|
||||
}
|
||||
|
||||
// dropbear
|
||||
publishProgress("" + step++, "" + steps, "Dropbear binary");
|
||||
|
@ -85,16 +79,8 @@ public class DropbearInstaller extends AsyncTask<Void, String, Boolean> {
|
|||
return falseWithError(dropbear);
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "Dropbear binary");
|
||||
if (ShellUtils.lnSymbolic(dropbear, "/system/xbin/dropbear") == false) {
|
||||
return falseWithError("/system/xbin/dropbear");
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "Dropbear binary");
|
||||
if (ShellUtils.chown("/system/xbin/dropbear", "0:0") == false) {
|
||||
return falseWithError("/system/xbin/dropbear");
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "Dropbear binary");
|
||||
if (ShellUtils.chmod("/system/xbin/dropbear", "755") == false) {
|
||||
return falseWithError("/system/xbin/dropbear");
|
||||
if (ShellUtils.chmod(dropbear, "755") == false) {
|
||||
return falseWithError(dropbear);
|
||||
}
|
||||
|
||||
// dropbearkey
|
||||
|
@ -103,16 +89,8 @@ public class DropbearInstaller extends AsyncTask<Void, String, Boolean> {
|
|||
return falseWithError(dropbearkey);
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "Dropbearkey binary");
|
||||
if (ShellUtils.lnSymbolic(dropbearkey, "/system/xbin/dropbearkey") == false) {
|
||||
return falseWithError("/system/xbin/dropbearkey");
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "Dropbearkey binary");
|
||||
if (ShellUtils.chown("/system/xbin/dropbearkey", "0:0") == false) {
|
||||
return falseWithError("/system/xbin/dropbearkey");
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "Dropbearkey binary");
|
||||
if (ShellUtils.chmod("/system/xbin/dropbearkey", "755") == false) {
|
||||
return falseWithError("/system/xbin/dropbearkey");
|
||||
if (ShellUtils.chmod(dropbearkey, "755") == false) {
|
||||
return falseWithError(dropbearkey);
|
||||
}
|
||||
|
||||
// scp
|
||||
|
@ -121,16 +99,8 @@ public class DropbearInstaller extends AsyncTask<Void, String, Boolean> {
|
|||
return falseWithError(scp);
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "SCP binary");
|
||||
if (ShellUtils.lnSymbolic(scp, "/system/xbin/scp") == false) {
|
||||
return falseWithError("/system/xbin/scp");
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "SCP binary");
|
||||
if (ShellUtils.chown("/system/xbin/scp", "0:0") == false) {
|
||||
return falseWithError("/system/xbin/scp");
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "SCP binary");
|
||||
if (ShellUtils.chmod("/system/xbin/scp", "755") == false) {
|
||||
return falseWithError("/system/xbin/scp");
|
||||
if (ShellUtils.chmod(scp, "755") == false) {
|
||||
return falseWithError(scp);
|
||||
}
|
||||
|
||||
// banner
|
||||
|
@ -174,12 +144,6 @@ public class DropbearInstaller extends AsyncTask<Void, String, Boolean> {
|
|||
if (ShellUtils.echoToFile("0", lock) == false) {
|
||||
return falseWithError(lock);
|
||||
}
|
||||
|
||||
// system ro
|
||||
publishProgress("" + step++, "" + steps, "/system Read-Only");
|
||||
if (ShellUtils.remountReadOnly("/system") == false) {
|
||||
return falseWithError("/system");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class DropbearRemover extends AsyncTask<Void, String, Boolean> {
|
|||
Log.i(TAG, "DropbearRemover: doInBackground()");
|
||||
|
||||
int step = 0;
|
||||
int steps = 13;
|
||||
int steps = 8;
|
||||
|
||||
String dropbear = ServerUtils.getLocalDir(mContext) + "/dropbear";
|
||||
String dropbearkey = ServerUtils.getLocalDir(mContext) + "/dropbearkey";
|
||||
|
@ -77,38 +77,20 @@ public class DropbearRemover extends AsyncTask<Void, String, Boolean> {
|
|||
String authorized_keys = ServerUtils.getLocalDir(mContext) + "/authorized_keys";
|
||||
String lock = ServerUtils.getLocalDir(mContext) + "/lock";
|
||||
|
||||
// system rw
|
||||
publishProgress("" + step++, "" + steps, "/system Read-Write");
|
||||
if (ShellUtils.remountReadWrite("/system") == false) {
|
||||
return falseWithError("/system");
|
||||
}
|
||||
|
||||
// dropbear
|
||||
publishProgress("" + step++, "" + steps, "Dropbear binary");
|
||||
if (ShellUtils.rm("/system/xbin/dropbear") == false) {
|
||||
return falseWithError("/system/xbin/dropbear");
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "Dropbear binary");
|
||||
if (ShellUtils.rm(dropbear) == false) {
|
||||
return falseWithError(dropbear);
|
||||
}
|
||||
|
||||
// dropbearkey
|
||||
publishProgress("" + step++, "" + steps, "Dropbearkey binary");
|
||||
if (ShellUtils.rm("/system/xbin/dropbearkey") == false) {
|
||||
return falseWithError("/system/xbin/dropbearkey");
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "Dropbearkey binary");
|
||||
if (ShellUtils.rm(dropbearkey) == false) {
|
||||
return falseWithError(dropbearkey);
|
||||
}
|
||||
|
||||
// scp
|
||||
publishProgress("" + step++, "" + steps, "SCP binary");
|
||||
if (ShellUtils.rm("/system/xbin/scp") == false) {
|
||||
return falseWithError("/system/xbin/scp");
|
||||
}
|
||||
publishProgress("" + step++, "" + steps, "SCP binary");
|
||||
if (ShellUtils.rm(scp) == false) {
|
||||
return falseWithError(scp);
|
||||
}
|
||||
|
@ -142,12 +124,6 @@ public class DropbearRemover extends AsyncTask<Void, String, Boolean> {
|
|||
if (ShellUtils.rm(lock) == false) {
|
||||
return falseWithError(lock);
|
||||
}
|
||||
|
||||
// system ro
|
||||
publishProgress("" + step++, "" + steps, "/system Read-Only");
|
||||
if (ShellUtils.remountReadOnly("/system") == false) {
|
||||
return falseWithError("/system");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -52,17 +52,17 @@ public abstract class RootUtils {
|
|||
File file = null;
|
||||
|
||||
file = new File(ServerUtils.getLocalDir(context) + "/dropbear");
|
||||
if (file.exists() == false || file.isFile() == false) {
|
||||
if (file.exists() == false || file.isFile() == false || file.canExecute() == false) {
|
||||
Log.w(TAG, "RootUtils: checkDropear(): dropbear");
|
||||
return false;
|
||||
}
|
||||
file = new File(ServerUtils.getLocalDir(context) + "/dropbearkey");
|
||||
if (file.exists() == false || file.isFile() == false) {
|
||||
if (file.exists() == false || file.isFile() == false || file.canExecute() == false) {
|
||||
Log.w(TAG, "RootUtils: checkDropear(): dropbearkey");
|
||||
return false;
|
||||
}
|
||||
file = new File(ServerUtils.getLocalDir(context) + "/scp");
|
||||
if (file.exists() == false || file.isFile() == false) {
|
||||
if (file.exists() == false || file.isFile() == false || file.canExecute() == false) {
|
||||
Log.w(TAG, "RootUtils: checkDropear(): scp");
|
||||
return false;
|
||||
}
|
||||
|
@ -77,38 +77,21 @@ public abstract class RootUtils {
|
|||
return false;
|
||||
}
|
||||
file = new File(ServerUtils.getLocalDir(context) + "/authorized_keys");
|
||||
if (file.exists() == false || file.isFile() == false || file.canRead() == false) {
|
||||
if (file.exists() == false || file.isFile() == false) {
|
||||
Log.w(TAG, "RootUtils: checkDropear(): authorized_keys");
|
||||
return false;
|
||||
}
|
||||
file = new File(ServerUtils.getLocalDir(context) + "/banner");
|
||||
if (file.exists() == false || file.isFile() == false || file.canRead() == false) {
|
||||
if (file.exists() == false || file.isFile() == false) {
|
||||
Log.w(TAG, "RootUtils: checkDropear(): banner");
|
||||
return false;
|
||||
}
|
||||
file = new File(ServerUtils.getLocalDir(context) + "/lock");
|
||||
if (file.exists() == false || file.isFile() == false || file.canRead() == false) {
|
||||
if (file.exists() == false || file.isFile() == false) {
|
||||
Log.w(TAG, "RootUtils: checkDropear(): lock");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
file = new File("/system/xbin/dropbear");
|
||||
if (file.exists() == false || file.isFile() == false) {
|
||||
Log.w(TAG, "RootUtils: checkDropear(): dropbear");
|
||||
return false;
|
||||
}
|
||||
file = new File("/system/xbin/dropbearkey");
|
||||
if (file.exists() == false || file.isFile() == false) {
|
||||
Log.w(TAG, "RootUtils: checkDropear(): dropbearkey");
|
||||
return false;
|
||||
}
|
||||
file = new File("/system/xbin/scp");
|
||||
if (file.exists() == false || file.isFile() == false) {
|
||||
Log.w(TAG, "RootUtils: checkDropear(): scp");
|
||||
return false;
|
||||
}
|
||||
|
||||
hasDropbear = true;
|
||||
|
||||
return hasDropbear;
|
||||
|
|
|
@ -23,12 +23,6 @@ import java.util.Enumeration;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.http.conn.util.InetAddressUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
@ -51,26 +45,27 @@ public abstract class ServerUtils {
|
|||
// WARNING: this is not threaded
|
||||
public static final String getExternalIpAddress () {
|
||||
if (externalIpAddress == null) {
|
||||
Process suProcess;
|
||||
try {
|
||||
HttpClient httpclient = new DefaultHttpClient();
|
||||
HttpGet httpget = new HttpGet("http://ifconfig.me/ip");
|
||||
HttpResponse response = httpclient.execute(httpget);
|
||||
HttpEntity entity = response.getEntity();
|
||||
Log.d(TAG, "=1=");
|
||||
suProcess = Runtime.getRuntime().exec("su");
|
||||
|
||||
if (entity != null) {
|
||||
Log.d(TAG, "=2=");
|
||||
long len = entity.getContentLength();
|
||||
if (len != -1 && len < 1024) {
|
||||
Log.d(TAG, "=3=");
|
||||
externalIpAddress = EntityUtils.toString(entity);
|
||||
Log.d(TAG, "ServerUtils: getExternalIpAddress(): " + externalIpAddress);
|
||||
return externalIpAddress;
|
||||
}
|
||||
// stdin
|
||||
DataOutputStream stdin = new DataOutputStream(suProcess.getOutputStream());
|
||||
Log.d(TAG, "ServerUtils: getExternalIpAddress(): # busybox wget -qO - http://ifconfig.me/ip");
|
||||
stdin.writeBytes("busybox wget -qO - http://ifconfig.me/ip\n");
|
||||
stdin.flush();
|
||||
stdin.writeBytes("exit\n");
|
||||
stdin.flush();
|
||||
|
||||
// stdout
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(suProcess.getInputStream()));
|
||||
String line = reader.readLine();
|
||||
if (line != null) {
|
||||
externalIpAddress = line;
|
||||
return externalIpAddress;
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.e(TAG, "ServerUtils: getExternalIpAddress(): " + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "ServerUtils: getLocalIpAddress(): " + e.getMessage());
|
||||
}
|
||||
externalIpAddress = null;
|
||||
}
|
||||
|
@ -163,13 +158,13 @@ public abstract class ServerUtils {
|
|||
|
||||
// WARNING: this is not threaded
|
||||
public static final Boolean generateRsaPrivateKey(String path) {
|
||||
ShellUtils.commands.add("/system/xbin/dropbearkey -t rsa -f " + path);
|
||||
ShellUtils.commands.add(ServerUtils.getLocalDir(null) + "/dropbearkey -t rsa -f " + path);
|
||||
return ShellUtils.execute();
|
||||
}
|
||||
|
||||
// WARNING: this is not threaded
|
||||
public static final Boolean generateDssPrivateKey(String path) {
|
||||
ShellUtils.commands.add("/system/xbin/dropbearkey -t dss -f " + path);
|
||||
ShellUtils.commands.add(ServerUtils.getLocalDir(null) + "/dropbearkey -t dss -f " + path);
|
||||
return ShellUtils.execute();
|
||||
}
|
||||
|
||||
|
@ -312,7 +307,7 @@ public abstract class ServerUtils {
|
|||
// stdin
|
||||
DataOutputStream stdin = new DataOutputStream(suProcess.getOutputStream());
|
||||
Log.d(TAG, "ServerUtils: getDropbearVersion(): # dropbear -h");
|
||||
stdin.writeBytes("dropbear -h 2>&1 | busybox head -1\n");
|
||||
stdin.writeBytes(ServerUtils.getLocalDir(null) + "/dropbear -h 2>&1 | busybox head -1\n");
|
||||
stdin.flush();
|
||||
stdin.writeBytes("exit\n");
|
||||
stdin.flush();
|
||||
|
|