Merge branch 'nethunter-dev' into 'nethunter'

Nethunter dev

See merge request kalilinux/nethunter/apps/kali-nethunter-term!4
This commit is contained in:
Re4son 2020-01-09 08:29:13 +00:00
commit cd1672a4d9
11 changed files with 35 additions and 21 deletions

View File

@ -7,7 +7,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.android.tools.build:gradle:3.5.3'
}
}
@ -20,11 +20,11 @@ allprojects {
}
ext {
compileSdkVersion=28
compileSdkVersion=29
minSdkVersion=14
targetSdkVersion=28
targetSdkVersion=29
//version=YYYYMMVVRR (Either "VV" for stable version OR "RR" for pre-release candidate (e.g. 0001 for rc1)
versionCode=2020010100
versionCode=2020010200
versionName="2020.1"
}

View File

@ -247,6 +247,7 @@ public class TermSession {
public void initializeEmulator(int columns, int rows) {
mTranscriptScreen = new TranscriptScreen(columns, TRANSCRIPT_ROWS, rows, mColorScheme);
mEmulator = new TerminalEmulator(this, mTranscriptScreen, columns, rows, mColorScheme);
mDefaultUTF8Mode = true;
mEmulator.setDefaultUTF8Mode(mDefaultUTF8Mode);
mEmulator.setKeyListener(mKeyListener);

View File

@ -388,9 +388,9 @@ class TerminalEmulator {
* UTF-8 support
*/
private static final int UNICODE_REPLACEMENT_CHAR = 0xfffd;
private boolean mDefaultUTF8Mode = false;
private boolean mUTF8Mode = false;
private boolean mUTF8EscapeUsed = false;
private boolean mDefaultUTF8Mode = true;
private boolean mUTF8Mode = true;
private boolean mUTF8EscapeUsed = true;
private int mUTF8ToFollow = 0;
private ByteBuffer mUTF8ByteBuffer;
private CharBuffer mInputCharBuffer;

View File

@ -1,6 +1,6 @@
#Thu Feb 14 02:14:00 CST 2019
#Thu Jan 09 00:45:43 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

View File

@ -4,7 +4,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.android.tools.build:gradle:3.5.3'
}
}
apply plugin: 'com.android.library'

View File

@ -103,7 +103,7 @@ public class TermExec {
{
final int integerFd;
if (Build.VERSION.SDK_INT >= 12)
if (Build.VERSION.SDK_INT >= 14)
integerFd = FdHelperHoneycomb.getFd(masterFd);
else {
try {

View File

@ -180,7 +180,7 @@ static int create_subprocess(JNIEnv *env, const char *cmd, char *const argv[], c
extern "C" {
JNIEXPORT void JNICALL Java_com_offsec_nhterm_TermExec_sendSignal(JNIEnv *env, jobject clazz,
JNIEXPORT void JNICALL Java_com_offsec_nhterm_TermExec_sendSignal(JNIEnv *env, jclass clazz,
jint procId, jint signal)
{
kill(procId, signal);

View File

@ -10,6 +10,21 @@ android {
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
def nh_app_name = 'com.offsec.nethunter'
def nh_app_script_path = '/data/data/' + nh_app_name + '/files/scripts'
def nh_app_script_bin_path = '/data/data/' + nh_app_name + '/files/scripts/bin'
buildConfigField("String",
"NH_APP_NAME",
"\"${nh_app_name}\"")
buildConfigField("String",
"NH_APP_SCRIPT_PATH",
"\"${nh_app_script_path}\"")
buildConfigField("String",
"NH_APP_SCRIPT_BIN_PATH",
"\"${nh_app_script_bin_path}\"")
ndk {
moduleName "libjackpal-androidterm5nhj1"
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86'
@ -46,5 +61,5 @@ android {
dependencies {
implementation project(':emulatorview')
implementation project(':libtermexec')
implementation 'com.android.support:support-v4:+'
implementation 'com.android.support:support-v4:28.0.0'
}

View File

@ -96,10 +96,11 @@ public class ShellTermSession extends GenericTermSession {
if (settings.verifyPath()) {
path = checkPath(path);
}
String[] env = new String[3];
String[] env = new String[4];
env[0] = "TERM=" + settings.getTermType();
env[1] = "PATH=" + path + ":/data/data/com.offsec.nethunter/files/scripts/";
env[1] = "PATH=" + path + ":" + BuildConfig.NH_APP_SCRIPT_PATH + ":" + BuildConfig.NH_APP_SCRIPT_BIN_PATH;
env[2] = "HOME=" + settings.getHomePath();
env[3] = "PWD=" + "/";
// Log.d("Initialize Sess", settings.getShell());
mProcId = createSubprocess(mShell, env);
}

View File

@ -11,9 +11,9 @@ import java.io.InputStreamReader;
class ShellType {
static final String ANDROID_SHELL = whichCMD("sh") + " -";
static final String ANDROID_SU_SHELL = whichCMD("su");
static final String KALI_SHELL = whichCMD("su") + " -c /data/data/com.offsec.nethunter/files/scripts/bootkali";
static final String KALI_LOGIN_SHELL = whichCMD("su") +" -c /data/data/com.offsec.nethunter/files/scripts/bootkali_login";
static final String ANDROID_SU_SHELL = whichCMD("su") + " -mm";
static final String KALI_SHELL = whichCMD("su") + " -mm -c bootkali";
static final String KALI_LOGIN_SHELL = whichCMD("su") + " -mm -c bootkali_login";
private static String whichCMD(String theCmd){
String output = null;

View File

@ -596,9 +596,6 @@ public class Term extends Activity implements UpdateCallback, SharedPreferences.
}
protected static TermSession createTermSession(Context context, TermSettings settings, String initialCommand, String _mShell) throws IOException {
Log.d("MM createTermSession", _mShell + "cmd: " + initialCommand);
GenericTermSession session = new ShellTermSession(settings, initialCommand, _mShell); // called from intents
// XXX We should really be able to fetch this from within TermSession