Starting of monitor interface before systemd P4wnP1 service

This commit is contained in:
MaMe82 2018-10-17 12:04:18 +02:00
parent 6120c51818
commit 7155a70d58
3 changed files with 22 additions and 2 deletions

View File

@ -9,7 +9,7 @@ Before=sysinit.target
Type=simple
#Type=forking
#RemainAfterExit=yes
ExecStartPre=/usr/sbin/iw phy phy0 interface add wlan0mon type monitor
ExecStartPre=/usr/bin/monstart
ExecStart=/usr/local/bin/P4wnP1_service
#StandardOutput=journal+console
#StandardError=journal+console

View File

@ -8,7 +8,7 @@ P4wnP1_cli USB set --rndis 1 --cdc-ecm 1
# - disable DHCP option 3 (router) by passing an empty value
# - disable DHCP option 6 (DNS) by passing an empty value
# - add a DHCP range from 172.16.0.2 to 172.16.0.2 (single IP) with a lease time of 1 minute
P4wnP1_cli NET set server -i usbeth -a 172.16.0.1 -m 255.255.255.248 -o "3:" -o "6:" -r "172.16.0.2|172.16.0.2|1m"
P4wnP1_cli NET set server -i usbeth -a 172.16.0.1 -m 255.255.255.248 -o "3:" -o "6:" -r "172.16.0.2|172.16.0.2|5m"
# Enable WiFi AP (reg US, channel 6, SSID/AP name: "P4wnP1", pre shared key: "MaMe82-P4wnP1", don't use nexmon firmware)
# Note: As a pre-shared key is given, P4wnP1 assume the AP should use WPA2-PSK

20
dist/usr/bin/monstart vendored Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
interface=wlan0mon
echo -n "Create monitor mode interface ${interface}... "
iw phy phy0 interface add ${interface} type monitor 2> /dev/null 1> /dev/null
if [ $? -eq 0 ]; then
echo "success"
else
echo "failed, already created ?"
fi
echo -n "Trying to enable ${interface}... "
ifconfig ${interface} up 2> /dev/null
if [ $? -eq 0 ]; then
echo "success, ${interface} is up"
exit 0
else
echo "failed"
exit 1
fi