[Q] Binding applications to a specific IP - Android Q&A, Help & Troubleshooting

Hi,
These days many systems are multi-homed in the sense that they have more than one IP address bound at the same time. I.e. Wifi and VPN,
There are are at least 3 solutions to help bind an application to a specific ip.
1) Lennart Poettering has a IPv4 only version of a shim and a rather good readme available at his site.
2) Catalin M. Boie wrote another LD_PRELOAD shim, force_bind. I have not tested this one. It's capable of handling IPv6 binds.
3) Daniel Ryde has solved the problem via a LD_PRELOAD shim. With his code you can run
$ BIND_ADDR="192.0.2.100" LD_PRELOAD=/usr/lib/bind.so firefox (*)
and happily surf away.
Sorry for not providing direct links but "ALL new users prevented from posting outside links in their messages."
However a faked url with all relevant information is here:
Start by http then add daniel-lange.com/archives/53-Binding-applications-to-a-specific-IP add .html to the end of the url
Can someone provide instructions on how to build an android version of any of the given solutions (or a binary maybe) ??
Thank you

Related

[Q] Error in establishing openvpn connection on Toshiba Thrive (Android 3.2.1)

Hello All,
I have been searching for a solution to the below mentioned issue all over the net since last one month and finally referred to this forum by my vpn service provider 'cyberghostvpn'.
I am enclosing my config file (test.ovpn.txt), log file(log.txt) & sample password file for 'auth-user-pass' (pass.txt).
Following are the highlighted points regarding this issue :
While the same config file is working fine on my linux machine on android the same is stopping at the prompt "Enter Auth Username :". After entering username the connection sequence continues but the prompt "Enter Auth Password :" never comes like linux.
Hence my analysis is that the openvpn binary is unable to pass my the username-passowrd combination to my vpn server in the console input mode and an auth-failure control message is received shortly later terminating the connection.
If I pass the username-passord combination through the password file as 'auth-user-pass pass.txt' then also the same thing happens (an auth-failure control message is received terminating the connection).
In linux both of these methods are working successfully in establishing the connection proving that there is nothing wrong with cyberghostvpn.
One important point is though on android the openvpn binary is unable to read the config from the .ovpn file, it runs when the options are given as command line arguments as shown below and the enclosed log file is generated in this method.
# openvpn --client --ca ca.crt --cert my_user_name.crt --key my_user_name.key --remote ch.openvpn.cyberghostvpn.com 9081 ..........--tun-mtu 1500 --fragment 1300 --mssfix > log.txt
Anyone who can either help me resolving this issue or refer it to some expert developer on openvpn will be very much appreciated.
Kind regards,
kingsukm

[Q] hacking the netd daemon to disable "IPv6 privacy extensions"

Android's netd daemon, by default, enables something known as "IPv6 privacy extensions" (this means that the IPv6 address, instead of being generated from the device's MAC address, will be randomized — but this is irrelevant for my question).
In a nutshell, my problem is this: how can I hack, or communicate with, the netd daemon to force it to disable this feature?
(Android offers no configuration for this. I bug-reported the issue to Google ad android bug #31102 aka http : / / code.google.com/p/android/issues/detail?id=31102 (sorry I'm not allowed to post links) but they, of course, ignored it. Please note that there are lots of pages dealing with the question of how to enable IPv6 privacy extensions, because old versions of Android did not enable them: my question is how to disable them, permanently.)
What the netd daemon actually does is that when a network interface $IFACE is brought up, it opens the file /proc/sys/net/ipv6/conf/$IFACE/use_tempaddr and writes "2" there (this asks the Linux kernel to enable the feature). Up to Android 4.2, what I did was binary patch netd to replace the string "/proc/sys/net/ipv6/conf/%s/use_tempaddr" by "/dev/null\000" so the daemon would simply write that "2" to /dev/null and nothing would happen. But in Android 4.3 that part of the code has been slightly refactored, see InterfaceController.cpp from the netd source code, around line 134 (https : / / android.googlesource.com/platform/system/netd/+/android-4.3.1_r1/InterfaceController.cpp — again I'm not allowed to put links, what a pain), so a binary patch is not so trivial. (I could probably replace "use_tempaddr" by "hfr_grzcnqqe", but it would cause an error message in the logs and I'd like to avoid that.)
(Changing netd's source would be absolutely trivial. But I want to avoid recompiling it, because I'd probably spend many sleepless nights getting the correct native toolchain and convincing the Android makefiles to recompile just this bit: I don't have the resources to do a full Android build. Maybe I'm being pessimistic.)
In principle, it seems that netd reacts to commands that are sent to it (see https : / / android.googlesource.com/platform/system/netd/+/android-4.3.1_r1/CommandListener.cpp starting from around line 434). What I don't know is how to communicate with it to send it such commands, let alone do it precisely when a new interface is brought up. I know that at the other end of the line there is, for example, android.net.wifi.WifiStateMachine (see https : / / android.googlesource.com/platform/frameworks/base/+/android-4.3.1_r1/wifi/java/android/net/wifi/WifiStateMachine.java around line 2104). I'm a Linux dev, not so familiar with the Android IPC mechanisms or daemons, so I was hoping someone more knowledgeable could think of a way to pass a command at the right time.
PS: I'm aware that there's an app called to.doc.android.ipv6config which claims to solve the problem I'm talking about. But, looking at the code (https : / / gitorious.org/android-ipv6config/android-ipv6config/source/58e2060162485b54d4f8c147a558aeed708fa4b4:src/to/doc/android/ipv6config/LinuxIPCommandHelper.java around line 103), it's obvious that it does so in a completely wrong way, namely by talking to the kernel, bypassing netd's role as the network gatekeeper altogether.
PPS: I'm using CyanogenMod (currently 10.1.3, and this issue is preventing me from upgrading to 10.2), but I don't think this is relevant at all (I must admit I didn't check to see if CyanogenMod patched netd and/or android.net.wifi.WifiStateMachine in any way).
Meta-question: Is this the right place to ask? Apparently I have to ask 10 stupid questions before I'm allowed to post anywhere else.
Did you ever find a permanent solution? I've been tackling the issue on my new Galaxy S6 using the steps as outlined in this link:
https://www.reddit.com/r/Android/comments/2z1gyo/fix_lollipop_wifi_issues_and_coincidentally_the/
On the chance that someone has this issue and finds this thread ..
As far as I have seen (< 5.0), communication with the network daemon, netd, is done through unix-domain socket IPC on /dev/socket/netd. The commands are of the form:
Code:
interface setcfg [iface name] [options]
Where 'options' includes 'up' and 'down', among others. I have not verified this, but you may be able to do this from the console -- see 'netcfg'. As far as the specific command to do what you are requesting, I would either pull the netcfg executable into IDA or start by looking at the WifiStateMachine. The state machine set sets this option at line 2092 in the source:
Code:
mNwService.setInterfaceIpv6PrivacyExtensions(mInterfaceName, true);
Additionally, you could just pull in the apk for the WifiStateMachine and modify the smali to send false, rather than true, at the line above and you'll have your permanent disable. For this, see /system/framework/*.apk, or equivalent. The WSM implementation should be there somewhere.
-----------
From the source you posted, I found this too ..
Code:
"Usage: interface ipv6privacyextensions <interface> <enable|disable>"

[Q] Make a private Caldav server work

Hi, I recently purchased the ZTE Open C and want to synchronize its calendar with my own Caldav server.
Firefox rejects the connection tough, because the server has an invalid (self signed) certificate.
So i tried adding my certificate to firefox.
I found this guide:
http : // wiki . mozfr . org / Adding_CA_to_FirefoxOS
(Sorry for inserted spaces, won't let me post a link in first post.)
However I fail in the very first steps.
Code:
adb shell ls /data/b2g/mozilla/
Returns: /data/b2g/mozilla/: Permission denied
This means I dont have reading rights in this directory.
How do I get those rights, or alternativeley is there a better way to achieve my Caldav-Server goal?
Mathews123 said:
Hi, I recently purchased the ZTE Open C and want to synchronize its calendar with my own Caldav server.
Firefox rejects the connection tough, because the server has an invalid (self signed) certificate.
So i tried adding my certificate to firefox.
I found this guide:
http : // wiki . mozfr . org / Adding_CA_to_FirefoxOS
(Sorry for inserted spaces, won't let me post a link in first post.)
However I fail in the very first steps.
Code:
adb shell ls /data/b2g/mozilla/
Returns: /data/b2g/mozilla/: Permission denied
This means I dont have reading rights in this directory.
How do I get those rights, or alternativeley is there a better way to achieve my Caldav-Server goal?
Click to expand...
Click to collapse
You cannot use that method unless your phone is rooted, BUT...
I had the same problem and solved it a lot easier. Just launch the browser and input your server's URL. Then you will be warned about the not valid cert, add a permanent exception and that's all, now calendars should sync over HTTPS.
BTW this worked for me until FFOS v1.4. Today I updated to FFOS 2.1 and this trick stopped working, so you have been warned.
Thank you for the suggestion.
I am not running v2.0, so I tried it.
I could add the certificate.
However, when trying to connect, I get:
"Unknown Error. Please try again later."
Any way to figure out what's wrong now?
Seems to be a problem with the server I used. (Baikal)
Using a different one (Owncloud - sadly quite a lot bigger), it works with your tip.
So thanks for the help.
to ged rid of the "unknown error" in Caldav (etc.?)
doragasu said:
I had the same problem and solved it a lot easier. Just launch the browser and input your server's URL. Then you will be warned about the not valid cert, add a permanent exception and that's all, now calendars should sync over HTTPS.
Click to expand...
Click to collapse
thank you so much :victory:

[Q&A] [DEV] AndroidLib - .NET Android Device Communication and Management Library 01

[Q&A] [DEV] AndroidLib - .NET Android Device Communication and Management Library 01
Q&A for [DEV] AndroidLib - .NET Android Device Communication and Management Library 01.20.13
Some developers prefer that questions remain separate from their main development thread to help keep things organized. Placing your question within this thread will increase its chances of being answered by a member of the community or by the developer.
Before posting, please use the forum search and read through the discussion thread for [DEV] AndroidLib - .NET Android Device Communication and Management Library 01.20.13. If you can't find an answer, post it here, being sure to give as much information as possible (firmware version, steps to reproduce, logcat if available) so that you can get help.
Thanks for understanding and for helping to keep XDA neat and tidy!
where's the link to download
I and finding only code everywhere but where's the link to download the latest androidLib in which RegawMOD.Android is included
How to send sms
how to send
download link for androidlib.dll
hi,
could anyone show the link to download androidlib.dll? many thanks!!!
regards
Lim
---------- Post added at 05:02 PM ---------- Previous post was at 04:45 PM ----------
Hi
does anyone has the download link for androidlib? thanks!!
LESLIE
Best way to communicate between c# and android app
I would like to communicate data between c# and my java app. 2 variables nothing fancy, I think of an idea to use Preferences file and read it via adb using androidlib. My phone is rooted, but i want to it work without root. I know sharedprefs file permissions are only for the app itself. Any ideas?
I wanna make a function "Flashall"
I try make a "flashall function"..
use a "ExecuteFastbootCommand("flashall", "-w");
but, result message "error: neither -p product specified nor ANDROID_PRODUCT_OUT set"
How to excute command (set ANDROID_PRODUCT_OUT=~) & "fastboot flashall -w "?
Question for AndroidLib Developer
First of all, I am using your Android library and I think it is a great tool. My application that I am using it for is a wrapper class to manage testing of some android based handsets. I require the ability to query the phones IMEI. Is there any method you have in your library that I can easily use for this requirment?
Thanks in advance!!
device.pushfile need help with parameters, thanks
hi, this is my code load the phone and after want a sent a file contactos.sqlite, I need help with parameters because I cant send, thanks for help me.
*************************************
Public Sub phone()
Dim serial As String
'Always call UpdateDeviceList() before using AndroidController on devices to get the most updated list
android.UpdateDeviceList()
If (android.HasConnectedDevices) Then
serial = android.ConnectedDevices(0)
device = android.GetConnectedDevice(serial)
txtphone.Text = serial
Else
MsgBox("Error - No Devices Connected", MsgBoxStyle.Exclamation)
End If
End Sub
*****************************************
Private Sub btncopy_Click(sender As Object, e As EventArgs) Handles btncopy.Click
Dim filepath As String = "C:\Visual Studio 2013\Projects\prueba\prueba\bin\Debug\contactos1.sqlite"
Dim destinationfilepath As String = "\data\data\yo\databases\contactos1.sqlite"
device.PushFile(filepath, destinationfilepath)
End Sub
*********************************************
help
hello
Documentation link notwork for me
please other link for Documentation
i need all commands help file for vb.net androidlib
Where to download the compiled DLL?
Looks like the website is down... I downloaded the source from github but I'd prefer to save some time and use the compiled binary.
Is there a working download link?
I was looking for documentation, but the site is offline. What I want know for is like copying a database from my PC to my Android phone and the other way round via USB, so if anyone has documentation to guide me.
Thank You
Postscript: Sorry, my english is poor and i work with vb.net 2013
usman14903usa said:
I and finding only code everywhere but where's the link to download the latest androidLib in which RegawMOD.Android is included
Click to expand...
Click to collapse
The idea is that you fork, clone and compile the library yourself. This isn't an application, it is a wrapper library containing code to make writing applications for use with Android devices easier.
leslielin71 said:
hi,
could anyone show the link to download androidlib.dll? many thanks!!!
regards
Lim
---------- Post added at 05:02 PM ---------- Previous post was at 04:45 PM ----------
Hi
does anyone has the download link for androidlib? thanks!!
LESLIE
Click to expand...
Click to collapse
It's all here: http://forum.xda-developers.com/showthread.php?t=1512685
The idea is that you fork, clone and compile the library yourself.
Flopik2 said:
I would like to communicate data between c# and my java app. 2 variables nothing fancy, I think of an idea to use Preferences file and read it via adb using androidlib. My phone is rooted, but i want to it work without root. I know sharedprefs file permissions are only for the app itself. Any ideas?
Click to expand...
Click to collapse
Have you thought of writing a service for the device that checks for changes in a folder in the shared mass storage, and then handles accordingly?
That might be something to think about before considering going places you shouldn't be with a host computer.
hwiri said:
I try make a "flashall function"..
use a "ExecuteFastbootCommand("flashall", "-w");
but, result message "error: neither -p product specified nor ANDROID_PRODUCT_OUT set"
How to excute command (set ANDROID_PRODUCT_OUT=~) & "fastboot flashall -w "?
Click to expand...
Click to collapse
Code:
Fastboot.ExecuteFastbootCommand(Fastboot.FormFastbootCommand("flashall", "-w"));
cjdelgross said:
First of all, I am using your Android library and I think it is a great tool. My application that I am using it for is a wrapper class to manage testing of some android based handsets. I require the ability to query the phones IMEI. Is there any method you have in your library that I can easily use for this requirment?
Thanks in advance!!
Click to expand...
Click to collapse
No, there is no property or method to get the IMEI, but that's a good idea, and seeming as I'm doing some work on AndroidLib for a project of mine (of course the changes will be uploaded to GitHub), I'll add that, too.
The ADB command is: adb shell dumpsys iphonesubinfo
GonzaloCimma said:
hi, this is my code load the phone and after want a sent a file contactos.sqlite, I need help with parameters because I cant send, thanks for help me.
*************************************
Public Sub phone()
Dim serial As String
'Always call UpdateDeviceList() before using AndroidController on devices to get the most updated list
android.UpdateDeviceList()
If (android.HasConnectedDevices) Then
serial = android.ConnectedDevices(0)
device = android.GetConnectedDevice(serial)
txtphone.Text = serial
Else
MsgBox("Error - No Devices Connected", MsgBoxStyle.Exclamation)
End If
End Sub
*****************************************
Private Sub btncopy_Click(sender As Object, e As EventArgs) Handles btncopy.Click
Dim filepath As String = "C:\Visual Studio 2013\Projects\prueba\prueba\bin\Debug\contactos1.sqlite"
Dim destinationfilepath As String = "\data\data\yo\databases\contactos1.sqlite"
device.PushFile(filepath, destinationfilepath)
End Sub
*********************************************
Click to expand...
Click to collapse
Even if I were to help with your specific problem, you have hardcoded the paths. That's a bad practice. Maybe you should gather some more basic knowledge about programming.
astarali said:
hello
Documentation link notwork for me
please other link for Documentation
i need all commands help file for vb.net androidlib
Click to expand...
Click to collapse
That's what IntelliSense is for - It's built in to the IDE. Also, you can check the code files. They're all there.
cfsmp3 said:
Looks like the website is down... I downloaded the source from github but I'd prefer to save some time and use the compiled binary.
Is there a working download link?
Click to expand...
Click to collapse
There hasn't been a compiled binary for quite some time. The idea is you fork, clone, and compile the lib yourself so that you always have the latest updates and changes.
Ferel94 said:
I was looking for documentation, but the site is offline. What I want know for is like copying a database from my PC to my Android phone and the other way round via USB, so if anyone has documentation to guide me.
Thank You
Postscript: Sorry, my english is poor and i work with vb.net 2013
Click to expand...
Click to collapse
The documentation wouldn't really help. You're looking for the push command: adb push <local> <remote>.
The wrapper method is in the Device class.
You might, however, need to do some shell work beforehand.
Hey, I am trying to get Androidlib to work with Genymotion. (Another emulator). I first tried to point Genymotion to the ADB that comes with the Android-sdk, but when I tried to use Androidlib to find devices it never found any. I where able to find it using command line adb, but after running androidlib, not even that worked.
My second attempt was to change the adb file used it androidlib. Changed the md5 hash and copied the right file where it should go. but it still would not find my device.
Anyone been working on Genymotion and Androidlib before and have gotten this problem? Or just anyone that have any suggestions?
Can i get progress with push command on AndroidLib.dll?
i am looking for document, to get progress with '"RegawMOD.Android.Adb.FormAdbCommand" (push command) on AndroidLib.dll?
Help!
Erase my quote please
Hi guys, i just wanted to know where is the documentation of this project (since the website is down).
Best regards!
hi
i do not know how to download adriodLib.dll
Pushing files
I'm having trouble with the adb command pushing files, does anyone have an example preferable in vb because i keep getting errors.
I'm getting Type 'RegawMOD.Android.AndroidController' has no constructors.
Code:
Private _android As AndroidController
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Form1
CheckFor_()
txtBody.AppendText("Starting adb server..." & NewLine)
_android = New AndroidController()
txtBody.Text = txtBody.Text.Replace("Starting adb server..." & NewLine, "")
timerCursor.Enabled = True
timerPhone.Enabled = True
timerCursor.Start()
timerPhone.Start()
End Sub
Device "minimizes" Activity after App started
Hello,
I'm usind AndroidLib in my project and encountered a strange behaviour. When I start an App via "shell am start -n [PackageName]/[ActivityName] -a android.intent.action.MAIN -c android.intent.category.LAUNCHER", the main Activity shows up on screen. A second later, the activity gets "minimized" and the previous Activity (Home, other App,...) is shown again.
I know the App starts, as it launches some background Threads, which are running and doing, what they're supposed to do. So how can I stop the Activity from disappearing? When starting my App from Android Studio or running the command manually via CMD, everything works.
For everyone asking: I have created my own branch of AndroidLib, and I have documentation for it on my webserver.
Some of the documentation is specifically for my branch of the library, however most of the docs are from the core git and haven't changed.
http://team-m4gkbeatz.eu/androidlib/documentation/

Android Q Beta 5 and ARP table

Hi,
I have a question.
In the android developers site I can read this:
Access to /proc/net filesystem
Android Q removes access to /proc/net, which includes information about a device's network state. Apps that need access to this information, such as VPNs, should refer to the NetworkStatsManager and ConnectivityManager classes.
Someone knows if it's possible to have the IP and MAC addresses without read the ARP table?
Thanks

Categories

Resources