How to change frida server port in android? - android

By default, the frida-server in android, after installing, runs on port 27042 (127.0.0.1:27042). How can I change this port number to something else like 567 (127.0.0.1:567)? Is there any way?

Since Frida version 6.2.6, you can connect to specific IP/port like this :
# connect to specific IP/port
$ frida-trace -H ip:port -i "open*"
Sample :
$ frida-trace -H 192.168.1.1:1234 -i "open*"

Set Frida-Server on Host to all interfaces and non-default port
frida-server -l 0.0.0.0:19999 &
Call Frida-Server from Host
frida-ps -ai -H 192.168.0.38:19999

frida-server -l 127.0.0.1:567 &
where the interface address and port number are as you specified.
You can also use the all-interfaces IP address 0.0.0.0
frida-server -l 0.0.0.0:567 &
and then it will listen on port 567 on all interfaces, including 127.0.0.1

Related

Run frida-script on frida-server with custom port

I'm trying to bypass SSL pinning.
I used this tutorial:
https://httptoolkit.com/blog/frida-certificate-pinning/
Create frida-server and run it:
adb shell "/data/local/tmp/sus_app -l 0.0.0.0:11124"
And then run frida-script:
frida -H 127.0.0.1:11124 -l agulaguglag.js -f "com.someApp.android"
Get:
Also trying hosts from this question (How to change frida server port in android?).
Same result.
Which host should i use?
On the PC side you try to connect 127.0.0.1:11124, this means you are trying to connect to a local server port.
As frida-server is running on the Android device and not on your PC you need something that connects both sides.
The easiest way would be to forward TCP port 11124 from Android to TCP port 11124 on the PC use adb:
adb forward tcp:11124 tcp:11124

Adb: How to setup dns servers?

I need to configure network on an android automotive though the usb0 interface in static ip so I configured the network like that:
ifconfig usb0 192.168.1.137
ifconfig usb0 down
iptables --flush
iptables -A OUTPUT -o usb0 -p all -j ACCEPT
iptables -A INPUT -o usb0 -p all -j ACCEPT
ifconfig usb0 up
ip route add default via 192.168.1.1
and with that I can ping my devices in LAN and also 8.8.8.8 who respond in ping but I cannot for example ping google.com because of an DNS issue (I think). I found setprop net.dns1 8.8.8.8 on internet but that does not work. Also I don't have a /system/etc/resolv.conf. So if you have any idea tell me. Thanks.

RPI3 PIXEL Jessie - usb0 interface

Greetings to everyone!
I have a project on RPI but I have 1 problem.
Project description: RPI (server, connected to LAN DHCP with internet access) + Android Tablet (connects on USB0 static interface on RPI via USB Tethering).
Android App: Made an android APP to connect to server and manage RPI as client via sockets and ajax requests.
Problem: I have made five examples of same thing with 5 tablets and 5 RPI-i and USB0 is being seen by LAN Router and the problem is that I want nobody from LAN (not even another tablet) can connect to USB0 but that tablet connected to RPI with USB Tethering. Now how 5 devices is connected to LAN sometimes happens that tablet from RPI1 connects via LAN to RPI2 beacuse USB0 can be seen on LAN.
I want that USB0 is not seen on LAN but can give internet to tablet via eth0.
Currently I'm giving USB0 internet like this:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && sudo iptables -A FORWARD -i eth0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT && sudo iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT
I would really be glad if somebody could help me I'm not so good in configuring network interfaces
Check out this project. parts of it are probably quite useful for you.
https://github.com/samyk/poisontap/blob/master/pi_startup.sh

Not able to get reverse tethering working in android via usb

I went through this tutorial http://blog.mathieu.carbou.me/post/60454997009/reverse-usb-tethering-with-android-2-2 to reverse tether my android phone to use PC internet via USB.
Using following commands I am successfully able to create bridge br0.
sudo ifconfig eth0 0.0.0.0
sudo ifconfig usb0 0.0.0.0
sudo brctl addbr br0
sudo brctl addif br0 eth0
sudo brctl addif br0 usb0
sudo ifconfig br0 up
sudo dhclient br0
br0 has ip address : 172.16.138.102
My android phone is showing rndis0. I used following command using adb shell as root.
netcfg rndis0 dhcp
rndis0 was assigned ip : 172.16.138.109/24
Then I added default gateway for rndis0 interface.
route add default gw 172.16.138.102 dev rndis0
Still internet was not working on android. I tried several other tutorials but same info was mentioned everywhere. Am I missing something or I need to do something more for running internet?
Try to use Reverse Tethering tool.
Its in beta version so Android Browser will not know that Internet is working but you can surf internet.
Use gnirehtet.
Note: After getting connected to gnirehtet server, just keep the data connection ON, although your data will not be used, only your PC internet will be used on android.

Reverse tethering of several Android devices via USB

I'm trying to setup a testing environment for my android app where the separate devices need an Internet connection, but don't have wireless capabilities.
So I decided on using usb reverse tethering. My host machine is running Ubuntu. I already managed to setup reverse tethering for one device, the connection is working and I can ping google.com from this device's adb shell.
When I connect a second device, the first tethering stops working.
Both devices have the same IP adress configured on their internal usb0 interface.
Here's what I have so far:
Port forwarding on host is activated
echo 1 > /proc/sys/net/ipv4/ip_forward
Iptables rule on host to route traffic:
iptables -t nat -A POSTROUTING -s 169.254.255.2/24 -j MASQUERADE
Plugin first device:
ifconfig shows the device on usb0 # ip 169.254.255.2/30
On first device (with adb shell)
> route add default gw 169.254.255.2 dev usb0
> setprop net.dns1 8.8.8.8
> ping google.com --> is giving results
Plugin second device
ifconfig shows this device on usb1 # ip 169.254.255.2/30
On second device
Add gw, set DNS like above
Now the second device can ping google.com, but the first one not.
When I change the internal IP or the IPs assigned to the hosts usb0, usb1 interfaces I am not able to connect to the devices via adb anymore.
I suspect this to be a networking problem, rather than a problem with ADB? Any Ideas?
After a lot of googling and trial and error I finally found the solution for my particular setup.
What I did in the end, and what I missed in my first attempts, was to put each connected usb device into a separate subnet (see this answer on serverfault).
To put it clearly, the setup is now like following:
iptables contains the following rule
iptables -t nat -A POSTROUTING -j MASQUERADE
the host's usb0 and usb1 interface, now in separate subnets
usb0: inet addr:169.254.0.1 Bcast:169.254.15.255 Mask:255.255.240.0
usb1: inet addr:169.254.16.1 Bcast:169.254.31.255 Mask:255.255.240.0
internal usb0 iface of Android device connected on host's usb0:
- usb0 169.254.0.2/20
- default gw 169.254.0.1 (so the host's usb0 iface)
internal usb0 iface of Android device connected on host's usb1:
- usb0 169.254.16.2/20
- default gw 169.254.16.1 (so the host's usb1 iface)
That way I now have Internet access (after adb shell setprop net.dns1 8.8.8.8) from each android device connected to the usb interfaces on my host.
You need a linux system with root access, rooted android phone and usb cable.
Steps
Install adb and fastboot in your linux system.
sudo apt-get install android-tools-adb android-tools-fastboot
Connect your android phone to your PC via USB and enable USB tethering from the settings on your phone.
Open terminal in your PC and type the commands given below.
Find out the new network interface that was created on your PC.
ifconfig
Generally the new network interface will be usb0 or usb1. Let us consider usb0.
Now make some static IP address for this new interface usb0.
sudo ifconfig usb0 10.42.0.1 netmask 255.255.255.0
Now make this new interface usb0 as shared connection.
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
Now make some changes iptables firewall.
sudo iptables -t nat -F
sudo iptables -t nat -A POSTROUTING -j MASQUERADE
Now we have to enter some commands in the android phone. We can use either adb or directly typing the commands in the android phone through a terminal emulator installed in the phone. I am using the adb way.
Find the network interface in the android phone.
adb shell busybox ifconfig
Mine was rndis0.
Set the static IP, netmask and gateway.
adb shell ifconfig rndis0 10.42.0.2 netmask 255.255.255.0
adb shell route add default gw 10.42.0.1 dev rndis0
Verify Internet connectivity on your phone.
adb shell ping 8.8.8.8
If it is pinging, then the Internet in your mobile is working.
This Internet connection will not work with the apps like opera mini and paytm, but works well with whatsapp.

Categories

Resources