RoganDawes / P4wnP1_aloa

P4wnP1 A.L.O.A. by MaMe82 is a framework which turns a Rapsberry Pi Zero W into a flexible, low-cost platform for pentesting, red teaming and physical engagements ... or into "A Little Offensive Appliance".
GNU General Public License v3.0
3.79k stars 508 forks source link

quick HOWTO for linux: USB networking + internet access for the p4wnp1 aloa #64

Open xorr0 opened 5 years ago

xorr0 commented 5 years ago

quick HOWTO for linux: USB networking + internet access for the p4wnp1 aloa

after connecting the p4wnp1 aloa to your computer via USB, setup your linux host computer to forward IP packets

$ echo "1" | sudo tee /proc/sys/net/ipv4/ip_forward

$ sudo iptables -A POSTROUTING -t nat -j MASQUERADE -s 172.16.0.0/30

bring up the usb# interface (usb0 in my case) on your linux host computer

$ sudo ifconfig usb0 172.16.0.2 netmask 255.255.255.252

test connectivity, ping the p4wnp1 aloa at 172.16.0.1, and you should get a successful response

$ ping 172.16.0.1

ssh to the p4wnp1 aloa at 172.16.0.1 (DEFAULT SSH PASSWORD: toor)

$ ssh root@172.16.0.1

setup a default route on the p4wnp1 aloa back to the linux host device:

root@kali:~# route add default gw 172.16.0.2 usbeth

test connectivity via ping to the internet, you should get a successful response

root@kali:~# ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=57 time=15.0 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=57 time=17.3 ms
^C
--- 1.1.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 3ms
rtt min/avg/max/mdev = 15.021/16.177/17.333/1.156 ms
xorr0 commented 5 years ago

nop4wnp1 () { sshpass -p "toor" ssh -f root@172.16.0.1 "route del default gw 172.16.0.2 usbeth" sleep 2 echo "0" | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null sudo iptables -t nat -F POSTROUTING if [ $? -eq 0 ]; then echo "[+] SUCCESS: P4wnP1 connectivity removed" else echo "[!] FAILURE, something went wrong" fi }

quesodipesto commented 5 years ago

Wow, good joob! We can connect us P4wnP1 to internet and works like ever? If us host is windows, what we have to do?

Thanks men :)

mame82 commented 5 years ago

For Windows:

1) Enable RNDIS on P4wnP1 2) Reconfigure usbeth to use DHCP client instead of DHCP server 3) On the Windows host enable Internet Connection Sharing (ICS) for the Network adapter which provides Internet access 4) Configure ICS to share the connection with the RNDIS adapter deployed by P4wnP1 (after attaching via USB)

quesodipesto commented 5 years ago

imagen

Ok, i connect with my phone to 172.24.0.1, acced the web interface, goes to "Networking", selected "usbeth" and changed DHCP-SERVER to DCHP-CLIENT, pressed "DEPLOY" but...

In my W10 i can't find the network interface "Red no identificada" (spanish) --> "Unidentified network" (english). With this error we can't ICS us real w10 connection (Wifi).

I have enabled the RNDIS "USB SETTINGS"--> RNDIS (by default)

EDIT:

Ok, it works!!

When y press "DEPLOY" in your web interface, the P4wnP1 don't "tell us" nothing, but if we send a ping (P4wnP1 ssh 172.24.0.1 --> ping 8.8.8.8) we can see the packets 💃

THANKS!

poritz commented 5 years ago

Hi, I'm having a Problem with sshing into my p4wnp1 after getting dynamic ip (in my case 192.168.137.1). What i tried without success so far: -sshing into 172.16/24.0.1 couldn't reach it, neither via phone nor putty from targetmachine -sshing into 192.168.137.1 connection refused (via putty and phone) -using the discribed method on a vm ware kali linux distro -using a ethernet to usb adapter directly plugged into my router and sshing into p4p1 via phone network unreachable/ temporary nameressolve error Looking forward to hear some suggetsions on what to try next :)

btw I also tried to install software (ettercap) manually but cmake is missing and installing cmake is not working due to make not working properly XD

anduril-glitch commented 4 years ago

Hi, I'm having a Problem with sshing into my p4wnp1 after getting dynamic ip (in my case 192.168.137.1). What i tried without success so far: -sshing into 172.16/24.0.1 couldn't reach it, neither via phone nor putty from targetmachine -sshing into 192.168.137.1 connection refused (via putty and phone) -using the discribed method on a vm ware kali linux distro -using a ethernet to usb adapter directly plugged into my router and sshing into p4p1 via phone network unreachable/ temporary nameressolve error Looking forward to hear some suggetsions on what to try next :)

btw I also tried to install software (ettercap) manually but cmake is missing and installing cmake is not working due to make not working properly XD

I have the same problem.

Could you find a solution?

Thank you

A +