|
|
@ -214,6 +214,7 @@ public class SimpleSSHD extends Activity
|
|
|
|
|
|
|
|
|
|
|
|
public static String get_ip(boolean pretty) {
|
|
|
|
public static String get_ip(boolean pretty) {
|
|
|
|
String ret = "";
|
|
|
|
String ret = "";
|
|
|
|
|
|
|
|
int num_ips = 0;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
|
|
|
|
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
|
|
|
|
for (NetworkInterface intf : interfaces) {
|
|
|
|
for (NetworkInterface intf : interfaces) {
|
|
|
@ -226,14 +227,16 @@ public class SimpleSSHD extends Activity
|
|
|
|
if (i != -1) {
|
|
|
|
if (i != -1) {
|
|
|
|
ip = ip.substring(0,i);
|
|
|
|
ip = ip.substring(0,i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pretty) {
|
|
|
|
if (!pretty) {
|
|
|
|
if (!ret.equals("")) {
|
|
|
|
|
|
|
|
ret += "\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ret += "IP: "+ ip;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return ip;
|
|
|
|
return ip;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (num_ips++ >= 5) {
|
|
|
|
|
|
|
|
return ret+"...";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (num_ips > 1) {
|
|
|
|
|
|
|
|
ret += "\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ret += "IP: " + ip;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|