diff --git a/build.gradle b/build.gradle
index c0bd27756b..dea94eb99c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.4.0-beta6'
+ classpath 'com.android.tools.build:gradle:1.5.0'
}
}
diff --git a/cSploit/build.gradle b/cSploit/build.gradle
index 1271813146..2c5d5117ed 100644
--- a/cSploit/build.gradle
+++ b/cSploit/build.gradle
@@ -4,7 +4,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.4.0-beta6'
+ classpath 'com.android.tools.build:gradle:1.5.0'
}
}
@@ -52,8 +52,8 @@ android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 22
- versionCode 3
- versionName "1.6.1"
+ versionCode 6
+ versionName "1.6.5"
if(System.getenv("NIGHTLY_BUILD")) {
versionName += "+" + System.getenv("NIGHTLY_BUILD_COMMIT").substring(0, 7)
}
diff --git a/cSploit/res/layout/plugin_inspector.xml b/cSploit/res/layout/plugin_inspector.xml
index 1c9ee175ef..026735c44a 100644
--- a/cSploit/res/layout/plugin_inspector.xml
+++ b/cSploit/res/layout/plugin_inspector.xml
@@ -6,19 +6,6 @@
android:paddingTop="16sp"
android:id="@+id/whatever">
-
-
+
+
+
\ No newline at end of file
diff --git a/cSploit/res/values/strings.xml b/cSploit/res/values/strings.xml
index d03780c5c9..43af23b7c5 100644
--- a/cSploit/res/values/strings.xml
+++ b/cSploit/res/values/strings.xml
@@ -529,4 +529,5 @@
Select %s ?
https://github.com/cSploit/android/issues
Before opening a new issue, please, take the time to read the already open issues, probably it\' s already open. If it\' s not open we\'ll need as much information as you can get, so please, read this guide in order to know how to report a bug properly.
]]>
+ must be empty or an old installation directory.
diff --git a/cSploit/src/org/csploit/android/MainActivity.java b/cSploit/src/org/csploit/android/MainActivity.java
index 157d8ad230..0d1a076b98 100644
--- a/cSploit/src/org/csploit/android/MainActivity.java
+++ b/cSploit/src/org/csploit/android/MainActivity.java
@@ -1130,7 +1130,7 @@ public void onReceive(Context context, Intent intent) {
mUpdateStatus.setText(UPDATE_MESSAGE.replace(
"#STATUS#", getString(R.string.no_updates_available)));
- if (!System.isCoreInitialized()) {
+ if (!System.isCoreInstalled()) {
onInitializationError(getString(R.string.no_core_found));
}
break;
diff --git a/cSploit/src/org/csploit/android/SettingsActivity.java b/cSploit/src/org/csploit/android/SettingsActivity.java
index 4a64f9787a..dbb71f2026 100644
--- a/cSploit/src/org/csploit/android/SettingsActivity.java
+++ b/cSploit/src/org/csploit/android/SettingsActivity.java
@@ -214,14 +214,84 @@ public void onEnd(int exitCode) {
}
}
+ private boolean isDirectoryEmptyOrWithVersion(File folder) {
+ String[] files = folder.list();
+
+ if(files.length > 0) {
+ for(String fname : files) {
+ if("VERSION".equals(fname)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ private ExecChecker getCheckerForKey(String key) {
+ switch (key) {
+ case "RUBY_DIR":
+ return ExecChecker.ruby();
+ case "MSF_DIR":
+ return ExecChecker.msf();
+ }
+ return null;
+ }
+
+ private String getCurrentPathForKey(String key) {
+ switch (key) {
+ case "RUBY_DIR":
+ return System.getRubyPath();
+ case "MSF_DIR":
+ return System.getMsfPath();
+ }
+ return null;
+ }
+
+ private boolean shallAskForDelete(String key) {
+ return key.equals("RUBY_DIR") || key.equals("MSF_DIR");
+ }
+
+ /**
+ * check if selected directory is valid for the given key.
+ * @param key to be updated
+ * @param path of the chosen directory
+ * @return true if {@code path} is valid, false otherwise
+ */
+ private boolean canChangeDirectoryTo(String key, String path) {
+ File folder = new File(path);
+ ExecChecker checker = getCheckerForKey(key);
+ String oldPath = getCurrentPathForKey(key);
+ String toastMessage = null;
+ boolean valid = false;
+ boolean checkEmptyOrVersion = shallAskForDelete(key);
+
+ if (!folder.exists()) {
+ toastMessage = getString(R.string.pref_folder) + " " + path + " " + getString(R.string.pref_err_exists);
+ } else if (!folder.canWrite()) {
+ toastMessage = getString(R.string.pref_folder) + " " + path + " " + getString(R.string.pref_err_writable);
+ } else if (checker != null && !checker.canExecuteInDir(path)) {
+ toastMessage = getString(R.string.pref_folder) + " " + path + " " + getString(R.string.pref_err_executable);
+ } else if (checkEmptyOrVersion && !isDirectoryEmptyOrWithVersion(folder)) {
+ toastMessage = getString(R.string.pref_folder) + " " + path + " " + getString(R.string.pref_err_empty_or_old);
+ } else if (oldPath == null || !oldPath.equals(path)) {
+ valid = true;
+ }
+
+ if(toastMessage != null) {
+ Toast.makeText(getContext(), toastMessage, Toast.LENGTH_LONG).show();
+ }
+
+ return valid;
+ }
+
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == DirectoryPicker.PICK_DIRECTORY && resultCode != RESULT_CANCELED) {
Bundle extras = intent.getExtras();
String path;
String key;
- File folder;
- String oldPath = null;
if (extras == null) {
Logger.debug("null extra: " + intent);
@@ -236,35 +306,18 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
return;
}
- folder = new File(path);
- ExecChecker checker = null;
-
-
- if (key.equals("RUBY_DIR")) {
- oldPath = System.getRubyPath();
- checker = ExecChecker.ruby();
- } else if (key.equals("MSF_DIR")) {
- oldPath = System.getMsfPath();
- checker = ExecChecker.msf();
- }
-
- if (!folder.exists())
- Toast.makeText(getActivity(), getString(R.string.pref_folder) + " " + path + " " + getString(R.string.pref_err_exists), Toast.LENGTH_SHORT).show();
-
- else if (!folder.canWrite())
- Toast.makeText(getActivity(), getString(R.string.pref_folder) + " " + path + " " + getString(R.string.pref_err_writable), Toast.LENGTH_SHORT).show();
+ if(canChangeDirectoryTo(key, path)) {
- else if (checker != null && !checker.canExecuteInDir(path))
- Toast.makeText(getActivity(), getString(R.string.pref_folder) + " " + path + " " + getString(R.string.pref_err_executable), Toast.LENGTH_LONG).show();
- else {
- //noinspection ConstantConditions
getPreferenceManager().getSharedPreferences().edit().putString(key, path).commit();
- if (oldPath != null && !oldPath.equals(path)) {
- File current = new File(oldPath);
- if (current.exists() && current.isDirectory() && current.listFiles().length > 2) {
- wipe_prompt_older(current);
+ if(shallAskForDelete(key)) {
+ String oldPath = getCurrentPathForKey(key);
+ if(oldPath != null) {
+ File current = new File(oldPath);
+ if(current.exists() && current.isDirectory() && current.list().length > 0) {
+ wipe_prompt_older(current);
+ }
}
}
}
diff --git a/cSploit/src/org/csploit/android/services/receivers/MsfRpcdServiceReceiver.java b/cSploit/src/org/csploit/android/services/receivers/MsfRpcdServiceReceiver.java
index d832e90f62..63dacf81ac 100644
--- a/cSploit/src/org/csploit/android/services/receivers/MsfRpcdServiceReceiver.java
+++ b/cSploit/src/org/csploit/android/services/receivers/MsfRpcdServiceReceiver.java
@@ -2,6 +2,7 @@
import android.app.Activity;
import android.app.NotificationManager;
+import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -68,7 +69,7 @@ private void showToastForStatus(Context context, MsfRpcdService.Status status) {
}
private void updateNotificationForStatus(Context context, MsfRpcdService.Status status) {
- NotificationCompat.Builder mBuilder =
+ NotificationCompat.Builder builder =
new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.exploit_msf)
.setContentTitle(context.getString(R.string.msf_status))
@@ -76,8 +77,13 @@ private void updateNotificationForStatus(Context context, MsfRpcdService.Status
.setContentText(context.getString(status.getText()))
.setColor(ContextCompat.getColor(context, status.getColor()));
+ PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
+ new Intent(), PendingIntent.FLAG_UPDATE_CURRENT);
+
+ builder.setContentIntent(pendingIntent);
+
NotificationManager mNotificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
- mNotificationManager.notify(MSF_NOTIFICATION, mBuilder.build());
+ mNotificationManager.notify(MSF_NOTIFICATION, builder.build());
}
}