Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle:3.2.0-alpha04'
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
Expand Down
55 changes: 27 additions & 28 deletions cSploit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle:3.2.0-alpha04'
}
}

def getDate() {
return Calendar.getInstance().getTimeInMillis();
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
apply plugin: 'com.android.application'

dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:preference-v7:23.1.1'
compile 'org.apache.commons:commons-compress:1.10'
compile 'commons-net:commons-net:3.3'
compile 'com.github.zafarkhaja:java-semver:0.9.0'
compile 'org.unbescape:unbescape:1.1.1.RELEASE'
compile 'org.msgpack:msgpack:0.6.12'
compile 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
compile 'org.tukaani:xz:1.5'
compile 'ch.acra:acra:4.6.2'
testCompile 'junit:junit:4.12'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:preference-v7:27.0.2'
implementation 'org.apache.commons:commons-compress:1.16.1'
implementation 'commons-net:commons-net:3.6'
implementation 'com.github.zafarkhaja:java-semver:0.9.0'
implementation 'org.unbescape:unbescape:1.1.5.RELEASE'
implementation 'org.msgpack:msgpack:0.6.12'
implementation 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
implementation 'org.tukaani:xz:1.8'
implementation 'ch.acra:acra-http:5.1.1'
implementation 'ch.acra:acra-notification:5.1.1'
testImplementation 'junit:junit:4.12'
}

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
compileSdkVersion 27
buildToolsVersion '27.0.3'

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
Expand All @@ -51,8 +50,8 @@ android {
}

defaultConfig {
minSdkVersion 9
targetSdkVersion 22
minSdkVersion 14
targetSdkVersion 27
versionCode 4
versionName "1.7.0-unstable"
if(System.getenv("NIGHTLY_BUILD")) {
Expand Down Expand Up @@ -81,8 +80,8 @@ android {

buildTypes {
debug {
buildConfigField "java.util.Date", "BUILD_TIME", "new java.util.Date(" + getDate() + "L)"
buildConfigField "String", "BUILD_NAME", "\"" + System.getenv("USER") + "\"";
buildConfigField "java.util.Date", "BUILD_TIME", "new java.util.Date(" + Calendar.getInstance().getTimeInMillis() + "L)"
buildConfigField "String", "BUILD_NAME", "\"" + System.getenv("USER") + "\""
minifyEnabled false
shrinkResources false
debuggable true
Expand All @@ -91,8 +90,8 @@ android {
multiDexEnabled true
}
release {
buildConfigField "java.util.Date", "BUILD_TIME", "new java.util.Date(" + getDate() + "L)"
buildConfigField "String", "BUILD_NAME", "\"" + System.getenv("USER") + "\"";
buildConfigField "java.util.Date", "BUILD_TIME", "new java.util.Date(" + Calendar.getInstance().getTimeInMillis() + "L)"
buildConfigField "String", "BUILD_NAME", "\"" + System.getenv("USER") + "\""
if (System.getenv("KEYSTORE_FILE") != null) {
signingConfig signingConfigs.release
}
Expand Down
15 changes: 7 additions & 8 deletions cSploit/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<uses-permission android:name="android.permission.READ_LOGS" />

<application
android:name=".CSploitApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:resizeableActivity="true">

<meta-data
android:name="android.max_aspect"
android:value="2.1" />

<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize"
Expand All @@ -34,12 +39,6 @@
</intent-filter>
</activity>

<activity android:name="org.acra.CrashReportDialog"
android:theme="@style/Theme.Dialog"
android:launchMode="singleInstance"
android:excludeFromRecents="true"
android:finishOnTaskLaunch="true" />

<!-- suppress AndroidDomInspection -->
<service
android:name=".services.UpdateService"
Expand Down
50 changes: 36 additions & 14 deletions cSploit/src/main/java/org/csploit/android/CSploitApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@
package org.csploit.android;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.multidex.MultiDex;

import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import org.acra.annotation.AcraCore;
import org.acra.annotation.AcraHttpSender;
import org.acra.annotation.AcraNotification;
import org.acra.config.CoreConfigurationBuilder;
import org.acra.config.HttpSenderConfigurationBuilder;
import org.acra.config.NotificationConfigurationBuilder;
import org.acra.data.StringFormat;
import org.acra.sender.HttpSender;
import org.csploit.android.core.Logger;
import org.csploit.android.core.System;
import org.csploit.android.plugins.ExploitFinder;
import org.csploit.android.plugins.Inspector;
Expand All @@ -40,19 +46,24 @@

import java.net.NoRouteToHostException;

@ReportsCrashes(
@AcraHttpSender(
httpMethod = HttpSender.Method.PUT,
reportType = HttpSender.Type.JSON,
formUri = "http://csploit.iriscouch.com/acra-csploit/_design/acra-storage/_update/report",
formUriBasicAuthLogin = "android",
formUriBasicAuthPassword = "DEADBEEF",
mode = ReportingInteractionMode.DIALOG,
resDialogText = R.string.crash_dialog_text,
resDialogIcon = R.drawable.dsploit_icon,
resDialogTitle = R.string.crash_dialog_title,
resDialogCommentPrompt = R.string.crash_dialog_comment
uri = "http://csploit.iriscouch.com/acra-csploit/_design/acra-storage/_update/report",
basicAuthLogin = "android",
basicAuthPassword = "DEADBEEF"
)
@AcraNotification (
resChannelName = R.string.csploitChannelId,
resText = R.string.crash_dialog_text,
resIcon = R.drawable.dsploit_icon,
resTitle = R.string.crash_dialog_title,
resCommentPrompt = R.string.crash_dialog_comment
)

@AcraCore(applicationLogFile = "/cSploitd.log")

public class CSploitApplication extends Application {

@Override
public void onCreate() {
SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
Expand All @@ -76,7 +87,11 @@ public void onCreate() {
System.errorLogging(e);
}

ACRA.setConfig(ACRA.getConfig().setApplicationLogFile(System.getCorePath() + "/cSploitd.log"));
CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this);
builder.setBuildConfigClass(BuildConfig.class).setReportFormat(StringFormat.JSON);
builder.getPluginConfigurationBuilder(HttpSenderConfigurationBuilder.class);
builder.getPluginConfigurationBuilder(NotificationConfigurationBuilder.class);
ACRA.init(this, builder);

// load system modules even if the initialization failed
System.registerPlugin(new RouterPwn());
Expand All @@ -89,4 +104,11 @@ public void onCreate() {
System.registerPlugin(new MITM());
System.registerPlugin(new PacketForger());
}

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
ACRA.init(this);
}
}
50 changes: 47 additions & 3 deletions cSploit/src/main/java/org/csploit/android/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,35 @@
*/
package org.csploit.android;

import android.Manifest;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

MainFragment f;
final static int MY_PERMISSIONS_WANTED = 1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationChannel mChannel = new NotificationChannel(getString(R.string.csploitChannelId),
getString(R.string.cSploitChannelDescription), NotificationManager.IMPORTANCE_DEFAULT);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (mNotificationManager != null) {
mNotificationManager.createNotificationChannel(mChannel);
}
}
SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
if (themePrefs.getBoolean("isDark", false))
setTheme(R.style.DarkTheme);
Expand All @@ -44,9 +62,35 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportFragmentManager().beginTransaction()
.add(R.id.mainframe, f).commit();
}
verifyPerms();
}

public void onBackPressed() {
f.onBackPressed();
}
public void verifyPerms() {
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this,
Manifest.permission.READ_PHONE_STATE)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_PHONE_STATE},
MY_PERMISSIONS_WANTED);
}
}

@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_WANTED: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, R.string.permissions_succeed, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, R.string.permissions_fail, Toast.LENGTH_LONG).show();
finish();
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public static class PrefsFrag extends PreferenceFragmentCompat implements Shared

@Override
public void onViewCreated(View v, Bundle savedInstanceState) {
super.onViewCreated(v, savedInstanceState);
SharedPreferences themePrefs = getActivity().getSharedPreferences("THEME", 0);
Boolean isDark = themePrefs.getBoolean("isDark", false);
if (isDark) {
Expand Down Expand Up @@ -140,7 +141,7 @@ public void onCreate(Bundle savedInstanceState) {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
SharedPreferences themePrefs = getActivity().getBaseContext().getSharedPreferences("THEME", 0);
themePrefs.edit().putBoolean("isDark", (Boolean) newValue).commit();
themePrefs.edit().putBoolean("isDark", (Boolean) newValue).apply();
Toast.makeText(getActivity().getBaseContext(), getString(R.string.please_restart), Toast.LENGTH_LONG).show();
return true;
}
Expand Down Expand Up @@ -276,7 +277,7 @@ else if (checker != null && !checker.canExecuteInDir(path))

else {
//noinspection ConstantConditions
getPreferenceManager().getSharedPreferences().edit().putString(key, path).commit();
getPreferenceManager().getSharedPreferences().edit().putString(key, path).apply();
if (oldPath != null && !oldPath.equals(path)) {
File current = new File(oldPath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.csploit.android.tools.NMap;

import java.util.List;
import java.util.Locale;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Expand Down Expand Up @@ -84,8 +85,9 @@ public void run() {

synchronized (MultiAttackService.this) {
completedTargets++;
mBuilder.setContentInfo(String.format("%d/%d",
completedTargets, totalTargets));
mBuilder.setContentInfo(String.format(Locale.getDefault(), "%d/%d",
completedTargets, totalTargets))
.setChannelId(getBaseContext().getString(R.string.csploitChannelId));
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}

Expand Down Expand Up @@ -199,7 +201,7 @@ private void setupNotification() {
// get notification manager
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// get notification builder
mBuilder = new NotificationCompat.Builder(this);
mBuilder = new NotificationCompat.Builder(this, getBaseContext().getString(R.string.csploitChannelId));
// create a broadcast receiver to get actions
// performed on the notification by the user
mReceiver = new BroadcastReceiver() {
Expand Down Expand Up @@ -237,7 +239,8 @@ private void finishNotification() {
mBuilder.setContentIntent(PendingIntent.getActivity(this, CLICK_CODE, mContentIntent, 0))
.setProgress(0,0,false)
.setAutoCancel(true)
.setDeleteIntent(PendingIntent.getActivity(this, 0, new Intent(), 0));
.setDeleteIntent(PendingIntent.getActivity(this, 0, new Intent(), 0))
.setChannelId(getBaseContext().getString(R.string.csploitChannelId));
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
if(mReceiver!=null)
Expand Down
Loading