Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nexmon crashes on fresh install on Kali Nethunter Nexus 5 #397

Open
2fst4u opened this issue Apr 30, 2020 · 8 comments
Open

Nexmon crashes on fresh install on Kali Nethunter Nexus 5 #397

2fst4u opened this issue Apr 30, 2020 · 8 comments

Comments

@2fst4u
Copy link

2fst4u commented Apr 30, 2020

I'm not sure if I'm doing something wrong but this is a completely fresh install on Kali Nethunter on a Nexus 5 (which I've done several times before and is otherwise working).

When I install Nexmon from the Kali store version and attempt the "start" phase on first opening, root is granted and then the app just crashes giving the error "Unfortunately, Nexmon has stopped". After opening a second time (in case the lack of initial root was the issue) it does it again and every time after.

Should I be using a different version?

@hva314
Copy link

hva314 commented May 6, 2020

I'm having the same issue on my Nexus 5. Here's a bit more context for my case.

Device model: Nexus 5, D821
Android version: 6.0.1
CyanogenMod version: 13.0
Magisk and Nethunter 2020.2-rc3 installed

adb logcat when the crash happen:

05-06 17:20:23.748   857   975 D AudioService: Stream muted, skip playback
05-06 17:20:23.925 30549 30549 D AndroidRuntime: Shutting down VM
05-06 17:20:23.926 30549 30549 E AndroidRuntime: FATAL EXCEPTION: main
05-06 17:20:23.926 30549 30549 E AndroidRuntime: Process: de.tu_darmstadt.seemoo.nexmon, PID: 30549
05-06 17:20:23.926 30549 30549 E AndroidRuntime: Theme: themes:{default=overlay:org.cyanogenmod.hexolibre, iconPack:org.cyanogenmod.hexolibre, fontPkg:org.cyanogenmod.hexolibre, com.android.systemui=overlay:org.cyanogenmod.hexolibre, com.android.systemui.navbar=overlay:org.cyanogenmod.hexolibre}
05-06 17:20:23.926 30549 30549 E AndroidRuntime: java.nio.BufferUnderflowException
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at java.nio.ByteArrayBuffer.getInt(ByteArrayBuffer.java:196)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at de.tu_darmstadt.seemoo.nexmon.utils.Nexutil.getIntIoctl(Nexutil.java:194)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at de.tu_darmstadt.seemoo.nexmon.utils.FirmwareUtil.isBroadcomChip(FirmwareUtil.java:27)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at de.tu_darmstadt.seemoo.nexmon.gui.StartFragment$1.onClick(StartFragment.java:123)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at android.view.View.performClick(View.java:5204)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at android.view.View$PerformClick.run(View.java:21158)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:739)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:148)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5461)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
05-06 17:20:23.926 30549 30549 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-06 17:20:23.927   857  1801 W ActivityManager:   Force finishing activity de.tu_darmstadt.seemoo.nexmon/.gui.MyActivity

@ctrl-freak
Copy link

ctrl-freak commented May 8, 2020

I too am having this problem; though on a different device and OS.

Device: Nexus 7 2012 (tilapia)
Unlegacy Android 7.1.2
SuperSU and Nethunter 2020.2-rc3
Kernel: 3.4.113

Nexmon crashes when pressing the 'GRANT ROOT, PERMISSIONS & CHECK INSTALLATION' button and the same BufferUnderflowException appears in logcat.

I can't claim to know Android development, but I traced the code back for isBroadcomChip:

public static boolean isBroadcomChip() {
Shell.SU.run("ifconfig wlan0 up");
return Nexutil.getInstance().getIntIoctl(0) == 0x14e46c77;
}

public int getIntIoctl(int cmd) {
List<String> out = Shell.SU.run(nexutilPath + " -R -g" + cmd);

if (nexutilPath == null) {
nexutilPath = Assets.getAssetsPath(MyApplication.getAppContext(), "nexutil");
}

public static String getAssetsPath(Context context, String filename) {
byte[] buff = new byte[1024];
int len;
InputStream in;
OutputStream out;
String filesPath = context.getFilesDir().getPath();
if (new File(filesPath + "/" + filename).isFile() && upToDateFiles.contains(filename)) {
Log.d("ASSETS", filename + " found");
return filesPath + "/" + filename;
} else {
try {
in = context.getAssets().open("nexmon/" + filename);
File outFile = new File(filesPath, filename);
out = new FileOutputStream(outFile);
// write file
while ((len = in.read(buff)) != -1) {
out.write(buff, 0, len);
}
in.close();
out.flush();
out.close();
Shell.SU.run("chmod 777 " + filesPath + "/" + filename);
upToDateFiles.add(filename);
Log.d("ASSETS", filename + " extracted");
return filesPath + "/" + filename;
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
}

It seems like it isn't able to find nexutil in the apps assets/ directory.

I also get 'Permission denied' errors in logcat when attempting Menu > Tools > tick nexutil > Install Binaries and Libraries. May be worth checking that too.

I pulled the APK and unzipped it and couldn't find any binaries/executables in the assets folder. After finding an old APK at seemoo-lab/bcm-public/tree/master/androidstudioprojects/Nexmon/app I unzipped that and did find a assets/nexmon folder containing nexutil and the other binaries/libraries/firmware.

I don't know if Nexmon downloads these files or similar in the newer version of the app, so can't say this is the actual issue. How is this just an issue now, seeing the APK from the Nethunter Store was released 2019-07-01?

This may all be completely off the mark, I don't know enough.

Edit

After copying the nexmon files from the old APK back onto my device and chmod 755, I was able to get the output it was expecting:

tilapia:/data/local/nexmon # ./nexutil -g0
0x000000: 77 6c e4 14             wl..

Attempting a ./nexutil -r -g0 outputs characters the terminal doesn't like, but 77 6c e4 14 == 0x14e46c77 so I'm assuming it is the same. The arguments are slightly different (lowercase 'r' vs uppercase) in the older version of nexutil.

@Jeklah
Copy link

Jeklah commented May 26, 2020

I am also having this issue on Nexus 7 2013 Android 6.0.1.
What's the fix? Is there one?

@ctrl-freak
Copy link

Previous issues indicate that it's probably best to go all out and build from source:

#195

I grabbed a copy of the 2.1.3 APK from the web and unzipped it. I put the assets/nexmon contents into the context.getFilesDir().getPath(); directory (in my case /data/data/de.tu_darmstadt.seemo.nexmon/files) and the app is still crashing when attempting to 'Grant Root, Permission & Check Installation' with the same error. I'm considering repackaging the APK, resigning and zipaligning but that effort would probably be best spent setting up a build environment.

Installing the older version from downloaded APK didn't have these issues, but I wasn't able to get it to install the correct firmware for my device.

Considering this is distributed in the Nethunter Store and the changelog on the app page says "Built for the NetHunter App Store" I'm guessing this is actually a build issue on the NetHunter side of things and building from source straight from this repository would get better support.

I've also got a Alfa AWUS036NEH on the way, so will not likely pursue this any further.

@e2002e
Copy link
Contributor

e2002e commented Oct 12, 2020

@ctrl-freak
You said: "Previous issues indicate that it's probably best to go all out and build from source:"
Not true, doesn't work either with the same exact issue.

@jeancaffou
Copy link

Trying an old APK (2.1.3) kind of works, but it makes compatibility issues with other tools because of different versions of FW and tools.

@Jeklah
Copy link

Jeklah commented Oct 12, 2020

@ctrl-freak
You said: "Previous issues indicate that it's probably best to go all out and build from source:"
Not true, doesn't work either with the same exact issue.

Thanks for testing what I didn't have time to verify.

Trying an old APK (2.1.3) kind of works, but it makes compatibility issues with other tools because of different versions of FW and tools.

Kind of works is better than not at all! I will try this if I ever get some spare time again.

@e2002e
Copy link
Contributor

e2002e commented Dec 31, 2020

This is still unsolved ?
I tried to run my branch 'notrack' but dependencies are no longer availables...
Maybe this would be fixed by not upgrading gradle ?
Anyway official master needs to be investigated upon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants