1

I have dnsmasq available on my Android (stock ROM 4.4.2 Note2) and would like to know how I can tell if it's running and what settings its currently using?

eldarerathis
  • 36,787
  • 16
  • 144
  • 175
warsong
  • 970
  • 2
  • 12
  • 22

2 Answers2

1

If you're rooted, go to /system/bin/ and find dnsmasq if it's in there. Alternatively, you can also check /xbin (but, that's unlikely to be there).

If you managed to find one in either path - you now use a terminal emulator and type su first and enter, then type dnsmasq -d to see if the process will be invoked properly. It should also run with its default settings depending on how it was compiled.

Andrew T.
  • 15,988
  • 10
  • 74
  • 123
0

I can't tell you exactly for the settings, but here's an approach that basically should work for any app:

What you will need

Either a app, or an connection to the device. Be able to work with the .

Alternatively, for parts of the tasks there are apps available to monitor system resources.

What to do

At the shell prompt, you can check for active processes using the ps command. You can filter the output using grep. Assuming you know the package name (you can find it in the app's Playstore URL, right after the id=), and let's say it's com.foobar:

ps | grep "com.foobar"

would either show all processes of the com.foobar app – or nothing (if it's not running).

As for the settings, that's not that easy to determine. Depending on the app, these are either stored in a database, in the apps "shared preferences", or in both – all those stored below /data/data/com.foobar in our example case, which only root or the app itself has access to.

So if the device is rooted, you could try to directly access the corresponding files in /data/data/com.foobar/database/* and /data/data/com.foobar/shared_prefs/*, and investigate the files – using SQLite3 (or one of its GUIs) for the database files, and some XML viewer for the shared preferences.

Izzy
  • 91,166
  • 73
  • 343
  • 943
  • that doesn't work in this case, dnsmasq is not a typical installed app, it seems to have been supplied with the ROM. – warsong Dec 23 '14 at 17:45
  • If you know how the process calls itself, it works the very same way. Everything running a process shows up in ps. – Izzy Dec 23 '14 at 21:22
  • I've looked for it already using ps dnsmasq. Nothing showed up. – warsong Dec 24 '14 at 00:35
  • I have no idea how the process itself is named. While the application is DNSMasq, the process could e.g. be "dnsd". I'd take the full process list when I'm sure it's running, redirect that to a file (ps > ps.txt), and investigate that for what might be the one. I'm not sure whether the -f and -F parameters are available (full/extra full output) for additional details, but you might try. – Izzy Dec 24 '14 at 09:50
  • I've tried 'ps dns', 'ps dnsd', it's not showing up, I think I've tried all the obvious names. I have a feeling it's not working in which case, I probably need to do another question about how to get it running, because I don't know how/never tried before. – warsong Dec 26 '14 at 19:50
  • It might help to include where you've obtained it from and how you've installed it. Also, with ps dns (if you've meant that literally), 'dns' would have been understood as options to ps – not a "parameter to look for". See my previous comment: either redirect the output of ps to a file (which you then can investigate), or pipe it to grep (e.g. ps | grep dns). – Izzy Dec 26 '14 at 20:04
  • that's not quite true about dns being understood as a parameter, for example I tried 'ps dhcp' and it picked up the dhcp daemon. It must have either come installed with my ROM or with the kernel I flashed, I will find out, but in any case it's not running. Also I came across a question that said there is no OS-level DNS caching on Android, not sure how true this is though, it seems to contradict other things I've heard. https://android.stackexchange.com/questions/18002/is-there-a-way-to-list-the-local-dns-cache – warsong Dec 26 '14 at 20:50
  • Strange. If I try that, I get an error: "unsupported option". OK, sorry then – I know no further... – Izzy Dec 26 '14 at 20:55
  • Are you using busybox? – warsong Dec 26 '14 at 20:56
  • I stay corrected: At the device with busybox, this indeed works :puzzled: Looks like I was to much thinking of the BSD-style ps on my Linux machine. Sorry for the confusion! – Izzy Dec 26 '14 at 20:58