offensive-security / nethunter-app

NetHunter android application
315 stars 155 forks source link

2019.2 dev #201

Closed kimocoder closed 5 years ago

kimocoder commented 5 years ago

Here you got some all over fixes @Re4son Please do a walkthrough before merging and also, test if SearchSploit now works :+1:

kimocoder commented 5 years ago

Don't merge before it is properly tested, need some more time finishing up too

kimocoder commented 5 years ago

Note-to-self..

kimocoder commented 5 years ago

Then do proper testing and debug with Android Studio for some days Also saw possibilities to complete some unfinished "TODO" in deauth fragment, but that may be later on.

"/*TODO: create .sh that executes the commands and puts its output in a file and then read the file in the textview 20/02/17/" in DeauthFragment.java

@nik012003 wanna finish up that one? would have been great :+1:

Write file (from system) example

private void writeToFile(String data,Context context) {
    try {
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(context.openFileOutput("config.txt", Context.MODE_PRIVATE));
        outputStreamWriter.write(data);
        outputStreamWriter.close();
    }
    catch (IOException e) {
        Log.e("Exception", "File write failed: " + e.toString());
    } 
}

Read file (from system) example

private String readFromFile(Context context) {

    String ret = "";

    try {
        InputStream inputStream = context.openFileInput("config.txt");

        if ( inputStream != null ) {
            InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
            String receiveString = "";
            StringBuilder stringBuilder = new StringBuilder();

            while ( (receiveString = bufferedReader.readLine()) != null ) {
                stringBuilder.append(receiveString);
            }

            inputStream.close();
            ret = stringBuilder.toString();
        }
    }
    catch (FileNotFoundException e) {
        Log.e("login activity", "File not found: " + e.toString());
    } catch (IOException e) {
        Log.e("login activity", "Can not read file: " + e.toString());
    }

    return ret;
}
kimocoder commented 5 years ago
nik012003 commented 5 years ago

@kimocoder that TODO Is actually done but I discovered some other bugs in the deAuth code. Will work on that as soon as I can.

Re4son commented 5 years ago

TODO: Nougat and up doesn't allow to install user apps in recovery so how about this:

The inititial run of the nethunter app should pm install each apk in data/data/com.offsec.nethunter/app_cache - I don't think we have to check whether it is installed already because it just won't install with error code "INSTALL_FAILED_ALREADY_EXISTS"

What do you think?

kimocoder commented 5 years ago

Sounds good, would have been awesome to check that off the list too. I'll wrap up the hardcoding leftover this evening and start debug the app :+1:

Re4son commented 5 years ago

Ready for me to review and test @kimocoder ?

kimocoder commented 5 years ago

@Re4son there was too much problems introduced with this, I have to make a totall re-work to make sure the issues doesn't persist. But the SearchSploit fix in the other PR is interessant, If that fixed that issue, I got some other fixes to include. Closng for now, but will re-write my PR shortly