How to block specific urls in Android - android

I am developing a parental kind of App in which there is a requirement to block specific urls from all the browsers in the Device. I think this is an old question but couldn't find any solution yet on stack.
Do you have any working solutions. Assumption - The device is rooted.
Regards,
sha

I have two resources for you:
Since the device is rooted you can work directly with iptables. iptables will give you very precise control over all coming and going data packets. Check out open source projects like AFWall+ on GitHub for iptables in action.
If you want to be able to run your app on unrooted devices look into creating a fake VPN. You don't send any data to an actual VPN server, you simply use the VPN API to filter all the information coming and going. Check out Disconnect (whenever they actually share their open source code...) or OpenVPN which is what Disconnect builds on.

Related

Log all user and network activities Android

I would like to create logfiles of the activities on my Android phone.
The goal is to be able to trace back any suspicious activities of apps and check if the phone's been hacked.
In this question someone suggested using a proxy server.
But using a proxy changes the ip used and a lot of services (i.e. Netflix) block mobile traffic coming from either server ip's or home ip's when making mobile requests.
The question is already 3.5 years old so maybe the options have changed.
As for the network traffic an option to setup a local proxy on the device itself with a possibility to set logging rules would work though.
How could you setup a local proxy on an Android device?
However this is only the first part as to find possible suspicious activities. But without logging the actual phone activities it will be difficult (or impossible) to actually find out which malicious code or app is doing this.
How can we log activities on Android?
I think when loggin all user activities like touch events etc. and all calls between apps would suffice.
Can this be done without rooting the device? And if not how would one do this on a rooted device?
I would prefer to have this device independent, but I use an Oneplus 6 with Oxygen OS.

connect to android devices using wifi direct without prompt

i am trying to connect two android devices using WIFI direct and i was successful. But the problem is the second device has to accept the a connection prompt after the other device initiates the connection. It is undesirable for what i am trying to achieve. I saw a few post here in stack overflow itself saying that currently its not possible. But came across an app called SUPERBEAM which user WIFI direct but without the prompt. A search in google gave me the following link from xda forum which says
SuperBeam creates an access point using Android's WiFi direct API's.
This essentially works like hotspot mode in old devices, but it is
guaranteed to work on newer devices like Nexus 7. Moreover, this mode
allows older devices to connect and receive files without having to
support WiFi direct's peer-to-peer connections and, more importantly, it
gets rid of the annoying "accept connection" prompt.
But no where i found information on how to implement this. Can anybody help me. Here is the link
http://forum.xda-developers.com/showthread.php?t=2177133
You could indeed simply use the createGroup function from the API to create a group, which also makes the access point. The first problem here is that the access point name & password are set automatically, and you can not change them.
So, you do need to pass the info to the connecting party, and for this, I would suggest using the local service advertising, and using the instance name there.
Did make simple test app for this and you can find it from Github under DrJukka/MyWifiMesh, also some discussions on the topic can be found from my blog
This can be achieve using Xposed framework. You need add the code and install the App. The phone needs to be rooted in order for it to work. I have tested it on multiple Samsung phones and it works.
Check this answer for details: How to auto-accept Wi-Fi Direct connection requests in Android

how to create an app which monitors what ip's my android phone access ?

I'm not sure how to phrase the title of the question.
But the question is pretty simple, there is an app called openVpn for android (which allows a user to connect to vpn server).
I don't want the user to open the app when he want's to access my service, i want it to be seamless, meaning : when some app tries to access my service IP address, i want to catch that event, load openvpn and only then allow the user to access my service.
I wrote few android apps, but never something like this, where do i start ?
Is it possible to monitor where other apps are going (to which IP address) without rooting the device ?
Maybe some kind of driver ?
I searched around the web, and couldn't find anything helpful.
Thanks,
In a unrooted device, you shouldn't be able to monitor the connections made by other apps and in fact, you can't.
As an workaround, I guess you can just launch OpenVPN from you app (if OpenVPN registers itself for any Intent). So, the user doesn't have to remember about it.
Else, you have no more choice than integrating OpenVPN inside your app (the source code, I mean) or just telling your users that they have to launch it.

Sending and receiving packets over the internet securely

I'm new to any sort of programming for networks, and would like a little advice before I start.
I would like to run a server (Raspberry Pi) at home, which I would like to be able to contact to run particular programs/scripts and to trigger other events on my home network (WoL, home automation stuff etc)
I would like to be able to contact it independently of the platform - i.e. from Android & Windows primarily, iOS and Linux perhaps.
I would like to have some sort of security, in that I don't want anyone else to be able to contact my RPi and operate it.
Is there some sort of standard interface that is used for this sort of thing? I was thinking of running Apache, but thought I'd check there aren't more targeted solutions available first.
Cheers
Secure Socket Shell (ssh) would be my suggestion. It's already installed under RPi AFAIK, but you probably want to generate a public/private keypair and only permit login to your server using the keypair (i.e. disable password authentication). Also restrict the allowed users to you alone. Don't do this as root; instead create some setuid scripts to perform any admin-only tasks within the server and restrict the access control on those scripts.
One more tip to avoid constant crack attempts: move the port from 22 to 422 (which could be done using the NAT config of your internet router).
You could probably use libssh, however for some client platforms you might be able to get away with a shell script implementation.

Is there a way to make an android device answer to icmp pings addressed to the broadcast address?

I would like to programatically make my device answer to broadcast pings (i.e pinging 192.178.1.255) while connected to a wifi network.
Is there a way i can do that ? Maybe a listener that will ping back, or a flag to set somewhere?
Thanks.
Is there a way i can do that ?
In short: Yes. But it will take some good effort to integrate the necessary components.
The key problem is that you need to listen for ICMP network packets. Such functionality is not accessible from Java and would require either JNI code or an external program. (To my knowledge, it also requires a rooted device.)
You will need a library or program that can process network traffic, such as Jpcap (which would require some modification to work on Android). You could also install and run an instance of tcpdump in the background and parse its output.
It's not possible for an app to send/receive ICMP Echo Requests on Android. (Maybe there is a way on rooted devices)
But if your basic goal is to implement some kind of local device discovery functionality (and your code runs on all devices), you can use UDP broad/multicast messages instead.
I know this question is quite old now, but I came across this looking to for an answer and managed to work it out myself.
What I did was download a root file explorer (I used Root Browser from JRummy Apps) and navigate to /proc/sys/net/ipv4 edit icmp_echo_ignore_all so that it is a 1-line, 1-character file that simply says 0 (when I opened the file, it was set to 1)
No reboot, ICMP requests started working upon saving.

Categories

Resources