mirror of
https://github.com/xchwarze/wifi-pineapple-cloner.git
synced 2025-01-22 11:28:59 +00:00
Standarize files folder with dos2unix
This commit is contained in:
parent
844a1a4d41
commit
cea8e88106
@ -1,64 +1,64 @@
|
||||
#!/bin/bash
|
||||
# this script fix the nano mechanism of usb\30-sd -> block\20-sd - by DSR!
|
||||
|
||||
device=`basename $DEVPATH`
|
||||
devNum=$(echo $device | awk -F "" '{print $4}')
|
||||
|
||||
[[ $ACTION == "add" ]] && {
|
||||
mkdir -p /dev/sdcard
|
||||
mkdir -p /sd
|
||||
|
||||
[[ $devNum == "" ]] && {
|
||||
rm -rf /dev/sdcard/sd
|
||||
ln -s /dev/$device /dev/sdcard/sd
|
||||
} || {
|
||||
rm -rf /dev/sdcard/sd$devNum
|
||||
ln -s /dev/$device /dev/sdcard/sd$devNum
|
||||
|
||||
[[ $devNum == "1" ]] && {
|
||||
logger "== Add pendrive as SD"
|
||||
umount /sd
|
||||
mount /dev/sdcard/sd$devNum /sd && {
|
||||
[[ -e "/sd/etc" ]] || {
|
||||
sleep 5
|
||||
ln -s /etc/ /sd/etc
|
||||
}
|
||||
}
|
||||
|
||||
if [[ -e "/sd/modules/" ]]; then
|
||||
logger "== Link modules in /sd/modules/"
|
||||
for module in `ls /sd/modules/`; do
|
||||
if [[ ! -d "/pineapple/modules/$module" ]]; then
|
||||
ln -s /sd/modules/$module /pineapple/modules/$module
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# autoinstall python in universal flavor
|
||||
if [[ ! -d "/usr/lib/python2.7" && ! -d "/sd/usr/lib/python2.7" ]]; then
|
||||
/usr/bin/wpc-tools missing_packages
|
||||
fi
|
||||
}
|
||||
|
||||
[[ $devNum == "2" ]] && {
|
||||
logger "== Add swap"
|
||||
swapoff /dev/sdcard/sd$devNum
|
||||
swapon /dev/sdcard/sd$devNum
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[[ $ACTION == "remove" ]] && {
|
||||
[[ $devNum == "" ]] && {
|
||||
umount /sd
|
||||
rm -rf /dev/sdcard/sd
|
||||
}
|
||||
|
||||
[[ $devNum == "1" ]] && {
|
||||
rm -rf /dev/sdcard/sd$devNum
|
||||
}
|
||||
|
||||
[[ $devNum == "2" ]] && {
|
||||
swapoff /dev/sdcard/sd$devNum
|
||||
}
|
||||
}
|
||||
#!/bin/bash
|
||||
# this script fix the nano mechanism of usb\30-sd -> block\20-sd - by DSR!
|
||||
|
||||
device=`basename $DEVPATH`
|
||||
devNum=$(echo $device | awk -F "" '{print $4}')
|
||||
|
||||
[[ $ACTION == "add" ]] && {
|
||||
mkdir -p /dev/sdcard
|
||||
mkdir -p /sd
|
||||
|
||||
[[ $devNum == "" ]] && {
|
||||
rm -rf /dev/sdcard/sd
|
||||
ln -s /dev/$device /dev/sdcard/sd
|
||||
} || {
|
||||
rm -rf /dev/sdcard/sd$devNum
|
||||
ln -s /dev/$device /dev/sdcard/sd$devNum
|
||||
|
||||
[[ $devNum == "1" ]] && {
|
||||
logger "== Add pendrive as SD"
|
||||
umount /sd
|
||||
mount /dev/sdcard/sd$devNum /sd && {
|
||||
[[ -e "/sd/etc" ]] || {
|
||||
sleep 5
|
||||
ln -s /etc/ /sd/etc
|
||||
}
|
||||
}
|
||||
|
||||
if [[ -e "/sd/modules/" ]]; then
|
||||
logger "== Link modules in /sd/modules/"
|
||||
for module in `ls /sd/modules/`; do
|
||||
if [[ ! -d "/pineapple/modules/$module" ]]; then
|
||||
ln -s /sd/modules/$module /pineapple/modules/$module
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# autoinstall python in universal flavor
|
||||
if [[ ! -d "/usr/lib/python2.7" && ! -d "/sd/usr/lib/python2.7" ]]; then
|
||||
/usr/bin/wpc-tools missing_packages
|
||||
fi
|
||||
}
|
||||
|
||||
[[ $devNum == "2" ]] && {
|
||||
logger "== Add swap"
|
||||
swapoff /dev/sdcard/sd$devNum
|
||||
swapon /dev/sdcard/sd$devNum
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[[ $ACTION == "remove" ]] && {
|
||||
[[ $devNum == "" ]] && {
|
||||
umount /sd
|
||||
rm -rf /dev/sdcard/sd
|
||||
}
|
||||
|
||||
[[ $devNum == "1" ]] && {
|
||||
rm -rf /dev/sdcard/sd$devNum
|
||||
}
|
||||
|
||||
[[ $devNum == "2" ]] && {
|
||||
swapoff /dev/sdcard/sd$devNum
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ $ACTION == "remove" ]] && exit
|
||||
[[ $DEVTYPE == "usb_interface" ]] || exit
|
||||
|
||||
wifi config >> /etc/config/wireless
|
||||
WIFIDEV=$(uci show wireless | grep "${DEVPATH:9}" | awk -F'.' '{print $2}')
|
||||
|
||||
[[ ! -z $WIFIDEV ]] && {
|
||||
wifi reload $WIFIDEV
|
||||
wifi up $WIFIDEV
|
||||
}
|
||||
#!/bin/bash
|
||||
|
||||
[[ $ACTION == "remove" ]] && exit
|
||||
[[ $DEVTYPE == "usb_interface" ]] || exit
|
||||
|
||||
wifi config >> /etc/config/wireless
|
||||
WIFIDEV=$(uci show wireless | grep "${DEVPATH:9}" | awk -F'.' '{print $2}')
|
||||
|
||||
[[ ! -z $WIFIDEV ]] && {
|
||||
wifi reload $WIFIDEV
|
||||
wifi up $WIFIDEV
|
||||
}
|
||||
|
@ -1,94 +1,94 @@
|
||||
# -- Setup firewall configuration
|
||||
uci set firewall.@defaults[0].syn_flood=1
|
||||
uci set firewall.@defaults[0].input=ACCEPT
|
||||
uci set firewall.@defaults[0].output=ACCEPT
|
||||
uci set firewall.@defaults[0].forward=ACCEPT
|
||||
|
||||
uci add firewall zone
|
||||
uci set firewall.@zone[-1]=zone
|
||||
uci set firewall.@zone[-1].name=usb
|
||||
uci add_list firewall.@zone[-1].network='usb'
|
||||
uci set firewall.@zone[-1].input=ACCEPT
|
||||
uci set firewall.@zone[-1].output=ACCEPT
|
||||
uci set firewall.@zone[-1].forward=ACCEPT
|
||||
uci set firewall.@zone[-1].masq=1
|
||||
uci set firewall.@zone[-1].mtu_fix=1
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=lan
|
||||
uci set firewall.@forwarding[-1].dest=usb
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=usb
|
||||
uci set firewall.@forwarding[-1].dest=lan
|
||||
|
||||
uci add firewall zone
|
||||
uci set firewall.@zone[-1]=zone
|
||||
uci set firewall.@zone[-1].name=wwan
|
||||
uci add_list firewall.@zone[-1].network=wwan
|
||||
uci add_list firewall.@zone[-1].network=wwan6
|
||||
uci set firewall.@zone[-1].input=ACCEPT
|
||||
uci set firewall.@zone[-1].output=ACCEPT
|
||||
uci set firewall.@zone[-1].forward=ACCEPT
|
||||
uci set firewall.@zone[-1].masq=1
|
||||
uci set firewall.@zone[-1].mtu_fix=1
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=lan
|
||||
uci set firewall.@forwarding[-1].dest=wwan
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=wwan
|
||||
uci set firewall.@forwarding[-1].dest=lan
|
||||
|
||||
uci add firewall zone
|
||||
uci set firewall.@zone[-1].name=wan
|
||||
uci add_list firewall.@zone[-1].network='wan'
|
||||
uci add_list firewall.@zone[-1].network='wan6'
|
||||
uci set firewall.@zone[-1].input=ACCEPT
|
||||
uci set firewall.@zone[-1].output=ACCEPT
|
||||
uci set firewall.@zone[-1].forward=ACCEPT
|
||||
uci set firewall.@zone[-1].masq=1
|
||||
uci set firewall.@zone[-1].mtu_fix=1
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=lan
|
||||
uci set firewall.@forwarding[-1].dest=wan
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=wan
|
||||
uci set firewall.@forwarding[-1].dest=lan
|
||||
|
||||
uci add firewall allowssh
|
||||
uci set firewall.allowssh=rule
|
||||
uci set firewall.allowssh.name='Allow-SSH'
|
||||
uci set firewall.allowssh.src='wan'
|
||||
uci set firewall.allowssh.proto='tcp'
|
||||
uci set firewall.allowssh.dest_port='22'
|
||||
uci set firewall.allowssh.target='ACCEPT'
|
||||
uci set firewall.allowssh.family='ipv4'
|
||||
uci set firewall.allowssh.enabled='0'
|
||||
|
||||
uci add firewall allowui
|
||||
uci set firewall.allowui=rule
|
||||
uci set firewall.allowui.name='Allow-WEB'
|
||||
uci set firewall.allowui.src='wan'
|
||||
uci set firewall.allowui.proto='tcp'
|
||||
uci set firewall.allowui.dest_port='1471'
|
||||
uci set firewall.allowui.target='ACCEPT'
|
||||
uci set firewall.allowui.family='ipv4'
|
||||
uci set firewall.allowui.enabled='0'
|
||||
|
||||
uci add firewall allowws
|
||||
uci set firewall.allowws=rule
|
||||
uci set firewall.allowws.name='Allow-WEB-WS'
|
||||
uci set firewall.allowws.src='wan'
|
||||
uci set firewall.allowws.proto='tcp'
|
||||
uci set firewall.allowws.dest_port='1337'
|
||||
uci set firewall.allowws.target='ACCEPT'
|
||||
uci set firewall.allowws.family='ipv4'
|
||||
uci set firewall.allowws.enabled='1'
|
||||
|
||||
uci commit firewall
|
||||
|
||||
exit 0
|
||||
# -- Setup firewall configuration
|
||||
uci set firewall.@defaults[0].syn_flood=1
|
||||
uci set firewall.@defaults[0].input=ACCEPT
|
||||
uci set firewall.@defaults[0].output=ACCEPT
|
||||
uci set firewall.@defaults[0].forward=ACCEPT
|
||||
|
||||
uci add firewall zone
|
||||
uci set firewall.@zone[-1]=zone
|
||||
uci set firewall.@zone[-1].name=usb
|
||||
uci add_list firewall.@zone[-1].network='usb'
|
||||
uci set firewall.@zone[-1].input=ACCEPT
|
||||
uci set firewall.@zone[-1].output=ACCEPT
|
||||
uci set firewall.@zone[-1].forward=ACCEPT
|
||||
uci set firewall.@zone[-1].masq=1
|
||||
uci set firewall.@zone[-1].mtu_fix=1
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=lan
|
||||
uci set firewall.@forwarding[-1].dest=usb
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=usb
|
||||
uci set firewall.@forwarding[-1].dest=lan
|
||||
|
||||
uci add firewall zone
|
||||
uci set firewall.@zone[-1]=zone
|
||||
uci set firewall.@zone[-1].name=wwan
|
||||
uci add_list firewall.@zone[-1].network=wwan
|
||||
uci add_list firewall.@zone[-1].network=wwan6
|
||||
uci set firewall.@zone[-1].input=ACCEPT
|
||||
uci set firewall.@zone[-1].output=ACCEPT
|
||||
uci set firewall.@zone[-1].forward=ACCEPT
|
||||
uci set firewall.@zone[-1].masq=1
|
||||
uci set firewall.@zone[-1].mtu_fix=1
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=lan
|
||||
uci set firewall.@forwarding[-1].dest=wwan
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=wwan
|
||||
uci set firewall.@forwarding[-1].dest=lan
|
||||
|
||||
uci add firewall zone
|
||||
uci set firewall.@zone[-1].name=wan
|
||||
uci add_list firewall.@zone[-1].network='wan'
|
||||
uci add_list firewall.@zone[-1].network='wan6'
|
||||
uci set firewall.@zone[-1].input=ACCEPT
|
||||
uci set firewall.@zone[-1].output=ACCEPT
|
||||
uci set firewall.@zone[-1].forward=ACCEPT
|
||||
uci set firewall.@zone[-1].masq=1
|
||||
uci set firewall.@zone[-1].mtu_fix=1
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=lan
|
||||
uci set firewall.@forwarding[-1].dest=wan
|
||||
|
||||
uci add firewall forwarding
|
||||
uci set firewall.@forwarding[-1].src=wan
|
||||
uci set firewall.@forwarding[-1].dest=lan
|
||||
|
||||
uci add firewall allowssh
|
||||
uci set firewall.allowssh=rule
|
||||
uci set firewall.allowssh.name='Allow-SSH'
|
||||
uci set firewall.allowssh.src='wan'
|
||||
uci set firewall.allowssh.proto='tcp'
|
||||
uci set firewall.allowssh.dest_port='22'
|
||||
uci set firewall.allowssh.target='ACCEPT'
|
||||
uci set firewall.allowssh.family='ipv4'
|
||||
uci set firewall.allowssh.enabled='0'
|
||||
|
||||
uci add firewall allowui
|
||||
uci set firewall.allowui=rule
|
||||
uci set firewall.allowui.name='Allow-WEB'
|
||||
uci set firewall.allowui.src='wan'
|
||||
uci set firewall.allowui.proto='tcp'
|
||||
uci set firewall.allowui.dest_port='1471'
|
||||
uci set firewall.allowui.target='ACCEPT'
|
||||
uci set firewall.allowui.family='ipv4'
|
||||
uci set firewall.allowui.enabled='0'
|
||||
|
||||
uci add firewall allowws
|
||||
uci set firewall.allowws=rule
|
||||
uci set firewall.allowws.name='Allow-WEB-WS'
|
||||
uci set firewall.allowws.src='wan'
|
||||
uci set firewall.allowws.proto='tcp'
|
||||
uci set firewall.allowws.dest_port='1337'
|
||||
uci set firewall.allowws.target='ACCEPT'
|
||||
uci set firewall.allowws.family='ipv4'
|
||||
uci set firewall.allowws.enabled='1'
|
||||
|
||||
uci commit firewall
|
||||
|
||||
exit 0
|
||||
|
@ -1,8 +1,8 @@
|
||||
# -- Setup system configuration
|
||||
|
||||
# Change the hostname
|
||||
uci set system.@system[0].hostname=Pineapple
|
||||
uci commit system
|
||||
echo $(uci get system.@system[0].hostname) > /proc/sys/kernel/hostname
|
||||
|
||||
exit 0
|
||||
# -- Setup system configuration
|
||||
|
||||
# Change the hostname
|
||||
uci set system.@system[0].hostname=Pineapple
|
||||
uci commit system
|
||||
echo $(uci get system.@system[0].hostname) > /proc/sys/kernel/hostname
|
||||
|
||||
exit 0
|
||||
|
@ -1,24 +1,24 @@
|
||||
# -- Set up Networking configuration
|
||||
uci set network.lan.type='bridge'
|
||||
uci set network.lan.proto='static'
|
||||
uci set network.lan.ipaddr='172.16.42.1'
|
||||
uci set network.lan.netmask='255.255.255.0'
|
||||
uci set network.lan.gateway='172.16.42.42'
|
||||
uci set network.lan.dns='8.8.8.8, 8.8.4.4'
|
||||
|
||||
uci set network.usb=interface
|
||||
uci set network.usb.ifname='usb0'
|
||||
uci set network.usb.proto='dhcp'
|
||||
uci set network.usb.dns='8.8.8.8, 8.8.4.4'
|
||||
|
||||
uci set network.wwan=interface
|
||||
uci set network.wwan.proto='dhcp'
|
||||
uci set network.wwan.dns='8.8.8.8, 8.8.4.4'
|
||||
|
||||
uci set network.wan.proto='dhcp'
|
||||
uci set network.wan.dns='8.8.8.8, 8.8.4.4'
|
||||
|
||||
uci set network.wan6.proto='dhcpv6'
|
||||
uci commit network
|
||||
|
||||
# -- Set up Networking configuration
|
||||
uci set network.lan.type='bridge'
|
||||
uci set network.lan.proto='static'
|
||||
uci set network.lan.ipaddr='172.16.42.1'
|
||||
uci set network.lan.netmask='255.255.255.0'
|
||||
uci set network.lan.gateway='172.16.42.42'
|
||||
uci set network.lan.dns='8.8.8.8, 8.8.4.4'
|
||||
|
||||
uci set network.usb=interface
|
||||
uci set network.usb.ifname='usb0'
|
||||
uci set network.usb.proto='dhcp'
|
||||
uci set network.usb.dns='8.8.8.8, 8.8.4.4'
|
||||
|
||||
uci set network.wwan=interface
|
||||
uci set network.wwan.proto='dhcp'
|
||||
uci set network.wwan.dns='8.8.8.8, 8.8.4.4'
|
||||
|
||||
uci set network.wan.proto='dhcp'
|
||||
uci set network.wan.dns='8.8.8.8, 8.8.4.4'
|
||||
|
||||
uci set network.wan6.proto='dhcpv6'
|
||||
uci commit network
|
||||
|
||||
exit 0
|
@ -1,51 +1,51 @@
|
||||
# Make SSH banner have the correct version and device
|
||||
version=$(cat /pineapple/pineapple_version | head -c 5)
|
||||
eval "sed -i s/VERSION/$version/g /etc/banner"
|
||||
|
||||
# Configure PATH with SD card directories
|
||||
echo "export PATH=/usr/bin/pineapple:/bin:/sbin:/usr/bin:/usr/sbin:/sd/bin:/sd/sbin:/sd/usr/sbin:/sd/usr/bin" >> /etc/profile
|
||||
echo "export LD_LIBRARY_PATH=/lib:/usr/lib:/sd/lib:/sd/usr/lib" >> /etc/profile
|
||||
|
||||
# Touch known hosts
|
||||
mkdir -p /root/.ssh/
|
||||
touch /root/.ssh/known_hosts
|
||||
|
||||
# "Temporarily" soft-link libpcap.so.1 to libpcap.so.1.3
|
||||
ln -s /usr/lib/libpcap.so.1 /usr/lib/libpcap.so.1.3
|
||||
|
||||
# Disable AutoSSH
|
||||
/etc/init.d/autossh stop
|
||||
/etc/init.d/autossh disable
|
||||
|
||||
# Correct opkg sources
|
||||
sed -i "s/src\/gz openwrt_freifunk/#src\/gz openwrt_freifunk/" /etc/opkg/distfeeds.conf
|
||||
sed -i "s/src\/gz openwrt_luci/#src\/gz openwrt_luci/" /etc/opkg/distfeeds.conf
|
||||
sed -i "s/src\/gz openwrt_telephony/#src\/gz openwrt_telephon/" /etc/opkg/distfeeds.conf
|
||||
|
||||
# Get valid led value
|
||||
PINE_LED=""
|
||||
LED_TYPES="wps status system wan"
|
||||
LED_LIST=$(ls "/sys/class/leds/")
|
||||
for LED_TYPE in $LED_TYPES; do
|
||||
for LED_NAME in $LED_LIST; do
|
||||
if expr match "$LED_NAME" "\(.*:$LED_TYPE\)"; then
|
||||
PINE_LED="$LED_NAME"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $PINE_LED != "" ]]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $PINE_LED == "" && $LED_LIST != "" ]]; then
|
||||
PINE_LED=$(ls "/sys/class/leds/" | tail -1)
|
||||
fi
|
||||
|
||||
if [[ $PINE_LED != "" ]]; then
|
||||
sed -i "s/wifi-pineapple-nano:blue:system/$PINE_LED/" /sbin/led
|
||||
echo 255 > "/sys/class/leds/$PINE_LED/brightness"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
# Make SSH banner have the correct version and device
|
||||
version=$(cat /pineapple/pineapple_version | head -c 5)
|
||||
eval "sed -i s/VERSION/$version/g /etc/banner"
|
||||
|
||||
# Configure PATH with SD card directories
|
||||
echo "export PATH=/usr/bin/pineapple:/bin:/sbin:/usr/bin:/usr/sbin:/sd/bin:/sd/sbin:/sd/usr/sbin:/sd/usr/bin" >> /etc/profile
|
||||
echo "export LD_LIBRARY_PATH=/lib:/usr/lib:/sd/lib:/sd/usr/lib" >> /etc/profile
|
||||
|
||||
# Touch known hosts
|
||||
mkdir -p /root/.ssh/
|
||||
touch /root/.ssh/known_hosts
|
||||
|
||||
# "Temporarily" soft-link libpcap.so.1 to libpcap.so.1.3
|
||||
ln -s /usr/lib/libpcap.so.1 /usr/lib/libpcap.so.1.3
|
||||
|
||||
# Disable AutoSSH
|
||||
/etc/init.d/autossh stop
|
||||
/etc/init.d/autossh disable
|
||||
|
||||
# Correct opkg sources
|
||||
sed -i "s/src\/gz openwrt_freifunk/#src\/gz openwrt_freifunk/" /etc/opkg/distfeeds.conf
|
||||
sed -i "s/src\/gz openwrt_luci/#src\/gz openwrt_luci/" /etc/opkg/distfeeds.conf
|
||||
sed -i "s/src\/gz openwrt_telephony/#src\/gz openwrt_telephon/" /etc/opkg/distfeeds.conf
|
||||
|
||||
# Get valid led value
|
||||
PINE_LED=""
|
||||
LED_TYPES="wps status system wan"
|
||||
LED_LIST=$(ls "/sys/class/leds/")
|
||||
for LED_TYPE in $LED_TYPES; do
|
||||
for LED_NAME in $LED_LIST; do
|
||||
if expr match "$LED_NAME" "\(.*:$LED_TYPE\)"; then
|
||||
PINE_LED="$LED_NAME"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $PINE_LED != "" ]]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $PINE_LED == "" && $LED_LIST != "" ]]; then
|
||||
PINE_LED=$(ls "/sys/class/leds/" | tail -1)
|
||||
fi
|
||||
|
||||
if [[ $PINE_LED != "" ]]; then
|
||||
sed -i "s/wifi-pineapple-nano:blue:system/$PINE_LED/" /sbin/led
|
||||
echo 255 > "/sys/class/leds/$PINE_LED/brightness"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@ -1,23 +1,23 @@
|
||||
.NN,
|
||||
.cxxdl' xMMO 'cdxxl'
|
||||
.c0WMNk;,NMMW:,xXMMKo.
|
||||
...:KMMMWMMMMWMMMXc... .
|
||||
, .l0NMMMNXMMMMMMMMMMMMXNMMMWKl' xWd
|
||||
,0Wd .':xNMMMMMMMMMMMMMMMMNkc'. ;KM0'
|
||||
lWMo .;dNMMMMMMMMMMMMMMWx:. .l. dMWc
|
||||
:WWo oNd .;xKWMMMMMMMMMMMMMMMMMMMMWXx:. dWX: dMW;
|
||||
,NWo oMW: .. ..,lOXWMMMMMMMMMMWN0o;.. .. cWMl dMN'
|
||||
.XMx oWN; lc .loooolcooclooool. cXl oMWc kMK.
|
||||
oMW' ,WMl cMW: lWMW0d:;cdd:;:o0WMWl lMW: OMW' ,WMl
|
||||
0M0 xMX. .XMd .lo:.,dXMMMMMMXd,.:ol. kMK. 'NMd KMO
|
||||
NMd KMk lMN. .;:xOxollccddcclloxOx:;. 'WM: OM0 xMX
|
||||
WMo .XMx dMK oNMMMMWOc;;ol;;cOWMMMMNo .XMl kMK dMN
|
||||
NMx 0MO :Kd. .lllcl;.:0WMMMMW0:.;lclll. .xK; 0MO kMX
|
||||
__ ___ ______ _ _____ _.:W0;,oxl:::oOOo:::lxo,;0W: _ .ONo KMk
|
||||
\ \ / (_| ____(_) | __ (_);cKMMMMWk:.;,.;kWMMMMKc;. | | .OX:
|
||||
\ \ /\ / / _| |__ _ | |__) _ _ __ ___ __ _ _ __ _ __ | | ___ DEVICE
|
||||
\ \/ \/ / | | __| | | | ___| | '_ \ / _ \/ _` | '_ \| '_ \| |/ _ \ VERSION
|
||||
\ /\ / | | | | | | | | | | | | __| (_| | |_) | |_) | | __/ by DSR!
|
||||
\/ \/ |_|_| |_| |_| |_|_| |_|\___|\__,_| .__/| .__/|_|\___|
|
||||
web: github.com/xchwarze/wifi-pineapple-cloner | | | |
|
||||
------------------------------ |_| |_|
|
||||
.NN,
|
||||
.cxxdl' xMMO 'cdxxl'
|
||||
.c0WMNk;,NMMW:,xXMMKo.
|
||||
...:KMMMWMMMMWMMMXc... .
|
||||
, .l0NMMMNXMMMMMMMMMMMMXNMMMWKl' xWd
|
||||
,0Wd .':xNMMMMMMMMMMMMMMMMNkc'. ;KM0'
|
||||
lWMo .;dNMMMMMMMMMMMMMMWx:. .l. dMWc
|
||||
:WWo oNd .;xKWMMMMMMMMMMMMMMMMMMMMWXx:. dWX: dMW;
|
||||
,NWo oMW: .. ..,lOXWMMMMMMMMMMWN0o;.. .. cWMl dMN'
|
||||
.XMx oWN; lc .loooolcooclooool. cXl oMWc kMK.
|
||||
oMW' ,WMl cMW: lWMW0d:;cdd:;:o0WMWl lMW: OMW' ,WMl
|
||||
0M0 xMX. .XMd .lo:.,dXMMMMMMXd,.:ol. kMK. 'NMd KMO
|
||||
NMd KMk lMN. .;:xOxollccddcclloxOx:;. 'WM: OM0 xMX
|
||||
WMo .XMx dMK oNMMMMWOc;;ol;;cOWMMMMNo .XMl kMK dMN
|
||||
NMx 0MO :Kd. .lllcl;.:0WMMMMW0:.;lclll. .xK; 0MO kMX
|
||||
__ ___ ______ _ _____ _.:W0;,oxl:::oOOo:::lxo,;0W: _ .ONo KMk
|
||||
\ \ / (_| ____(_) | __ (_);cKMMMMWk:.;,.;kWMMMMKc;. | | .OX:
|
||||
\ \ /\ / / _| |__ _ | |__) _ _ __ ___ __ _ _ __ _ __ | | ___ DEVICE
|
||||
\ \/ \/ / | | __| | | | ___| | '_ \ / _ \/ _` | '_ \| '_ \| |/ _ \ VERSION
|
||||
\ /\ / | | | | | | | | | | | | __| (_| | |_) | |_) | | __/ by DSR!
|
||||
\/ \/ |_|_| |_| |_| |_|_| |_|\___|\__,_| .__/| .__/|_|\___|
|
||||
web: github.com/xchwarze/wifi-pineapple-cloner | | | |
|
||||
------------------------------ |_| |_|
|
||||
|
@ -1,5 +1,5 @@
|
||||
root:$1$3DBtk82B$6EPlkFc9GQrtDwmzKsUn31:18739:0:99999:7:::
|
||||
daemon:*:0:0:99999:7:::
|
||||
ftp:*:0:0:99999:7:::
|
||||
network:*:0:0:99999:7:::
|
||||
nobody:*:0:0:99999:7:::
|
||||
root:$1$3DBtk82B$6EPlkFc9GQrtDwmzKsUn31:18739:0:99999:7:::
|
||||
daemon:*:0:0:99999:7:::
|
||||
ftp:*:0:0:99999:7:::
|
||||
network:*:0:0:99999:7:::
|
||||
nobody:*:0:0:99999:7:::
|
||||
|
@ -1,14 +1,14 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2022 DSR!
|
||||
|
||||
START=99
|
||||
|
||||
start() {
|
||||
wpc-tools correct_sd_mount
|
||||
wpc-tools missing_packages
|
||||
wpc-tools handle_lost_phys
|
||||
}
|
||||
|
||||
boot() {
|
||||
start
|
||||
}
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2022 DSR!
|
||||
|
||||
START=99
|
||||
|
||||
start() {
|
||||
wpc-tools correct_sd_mount
|
||||
wpc-tools missing_packages
|
||||
wpc-tools handle_lost_phys
|
||||
}
|
||||
|
||||
boot() {
|
||||
start
|
||||
}
|
||||
|
@ -1,84 +1,84 @@
|
||||
#!/bin/sh
|
||||
|
||||
wps_catch_credentials() {
|
||||
local iface ifaces ifc ifname ssid encryption key radio radios
|
||||
local found=0
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
ubus -S -t 30 listen wps_credentials | while read creds; do
|
||||
json_init
|
||||
json_load "$creds"
|
||||
json_select wps_credentials || continue
|
||||
json_get_vars ifname ssid key encryption
|
||||
local ifcname="$ifname"
|
||||
json_init
|
||||
json_load "$(ubus -S call network.wireless status)"
|
||||
json_get_keys radios
|
||||
for radio in $radios; do
|
||||
json_select $radio
|
||||
json_select interfaces
|
||||
json_get_keys ifaces
|
||||
for ifc in $ifaces; do
|
||||
json_select $ifc
|
||||
json_get_vars ifname
|
||||
[ "$ifname" = "$ifcname" ] && {
|
||||
ubus -S call uci set "{\"config\":\"wireless\", \"type\":\"wifi-iface\", \
|
||||
\"match\": { \"device\": \"$radio\", \"encryption\": \"wps\" }, \
|
||||
\"values\": { \"encryption\": \"$encryption\", \
|
||||
\"ssid\": \"$ssid\", \
|
||||
\"key\": \"$key\" } }"
|
||||
ubus -S call uci commit '{"config": "wireless"}'
|
||||
ubus -S call uci apply
|
||||
}
|
||||
json_select ..
|
||||
done
|
||||
json_select ..
|
||||
json_select ..
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# from mk6 reset script
|
||||
#########################
|
||||
if [ -f "/etc/pineapple/setupRequired" ]; then
|
||||
if [ -f /etc/pineapple/init ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -f /tmp/button_setup ]; then
|
||||
if [ "$SEEN" -lt 2 ]; then
|
||||
logger "First Setup: Disable WiFi"
|
||||
wifi down
|
||||
ifconfig wlan0 down && ifconfig wlan0-1 down
|
||||
/sbin/led blue on
|
||||
else
|
||||
logger "First Setup: Keep WiFi On"
|
||||
fi
|
||||
touch /tmp/button_setup
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
#########################
|
||||
|
||||
if [ "$ACTION" = "pressed" -a "$BUTTON" = "wps" ]; then
|
||||
wps_done=0
|
||||
ubusobjs="$( ubus -S list hostapd.* )"
|
||||
for ubusobj in $ubusobjs; do
|
||||
ubus -S call $ubusobj wps_start && wps_done=1
|
||||
done
|
||||
[ $wps_done = 0 ] || return 0
|
||||
wps_done=0
|
||||
ubusobjs="$( ubus -S list wpa_supplicant.* )"
|
||||
for ubusobj in $ubusobjs; do
|
||||
ifname="$(echo $ubusobj | cut -d'.' -f2 )"
|
||||
multi_ap=""
|
||||
if [ -e "/var/run/wpa_supplicant-${ifname}.conf.is_multiap" ]; then
|
||||
ubus -S call $ubusobj wps_start '{ "multi_ap": true }' && wps_done=1
|
||||
else
|
||||
ubus -S call $ubusobj wps_start && wps_done=1
|
||||
fi
|
||||
done
|
||||
[ $wps_done = 0 ] || wps_catch_credentials &
|
||||
fi
|
||||
|
||||
return 0
|
||||
#!/bin/sh
|
||||
|
||||
wps_catch_credentials() {
|
||||
local iface ifaces ifc ifname ssid encryption key radio radios
|
||||
local found=0
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
ubus -S -t 30 listen wps_credentials | while read creds; do
|
||||
json_init
|
||||
json_load "$creds"
|
||||
json_select wps_credentials || continue
|
||||
json_get_vars ifname ssid key encryption
|
||||
local ifcname="$ifname"
|
||||
json_init
|
||||
json_load "$(ubus -S call network.wireless status)"
|
||||
json_get_keys radios
|
||||
for radio in $radios; do
|
||||
json_select $radio
|
||||
json_select interfaces
|
||||
json_get_keys ifaces
|
||||
for ifc in $ifaces; do
|
||||
json_select $ifc
|
||||
json_get_vars ifname
|
||||
[ "$ifname" = "$ifcname" ] && {
|
||||
ubus -S call uci set "{\"config\":\"wireless\", \"type\":\"wifi-iface\", \
|
||||
\"match\": { \"device\": \"$radio\", \"encryption\": \"wps\" }, \
|
||||
\"values\": { \"encryption\": \"$encryption\", \
|
||||
\"ssid\": \"$ssid\", \
|
||||
\"key\": \"$key\" } }"
|
||||
ubus -S call uci commit '{"config": "wireless"}'
|
||||
ubus -S call uci apply
|
||||
}
|
||||
json_select ..
|
||||
done
|
||||
json_select ..
|
||||
json_select ..
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# from mk6 reset script
|
||||
#########################
|
||||
if [ -f "/etc/pineapple/setupRequired" ]; then
|
||||
if [ -f /etc/pineapple/init ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -f /tmp/button_setup ]; then
|
||||
if [ "$SEEN" -lt 2 ]; then
|
||||
logger "First Setup: Disable WiFi"
|
||||
wifi down
|
||||
ifconfig wlan0 down && ifconfig wlan0-1 down
|
||||
/sbin/led blue on
|
||||
else
|
||||
logger "First Setup: Keep WiFi On"
|
||||
fi
|
||||
touch /tmp/button_setup
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
#########################
|
||||
|
||||
if [ "$ACTION" = "pressed" -a "$BUTTON" = "wps" ]; then
|
||||
wps_done=0
|
||||
ubusobjs="$( ubus -S list hostapd.* )"
|
||||
for ubusobj in $ubusobjs; do
|
||||
ubus -S call $ubusobj wps_start && wps_done=1
|
||||
done
|
||||
[ $wps_done = 0 ] || return 0
|
||||
wps_done=0
|
||||
ubusobjs="$( ubus -S list wpa_supplicant.* )"
|
||||
for ubusobj in $ubusobjs; do
|
||||
ifname="$(echo $ubusobj | cut -d'.' -f2 )"
|
||||
multi_ap=""
|
||||
if [ -e "/var/run/wpa_supplicant-${ifname}.conf.is_multiap" ]; then
|
||||
ubus -S call $ubusobj wps_start '{ "multi_ap": true }' && wps_done=1
|
||||
else
|
||||
ubus -S call $ubusobj wps_start && wps_done=1
|
||||
fi
|
||||
done
|
||||
[ $wps_done = 0 ] || wps_catch_credentials &
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
@ -1,5 +1,5 @@
|
||||
/etc/pineape
|
||||
/etc/pineapple
|
||||
/pineapple/css
|
||||
/pineapple/img/logo.png
|
||||
/pineapple/img/throbber.gif
|
||||
/etc/pineape
|
||||
/etc/pineapple
|
||||
/pineapple/css
|
||||
/pineapple/img/logo.png
|
||||
/pineapple/img/throbber.gif
|
||||
|
@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
class DeviceConfig
|
||||
{
|
||||
// third party modules can change the options based on this
|
||||
// the allowed values are: "nano" or "tetra"
|
||||
const DEVICE_TYPE = 'nano';
|
||||
|
||||
const USE_INTERNAL_STORAGE = false;
|
||||
|
||||
const USE_USB_STORAGE = true;
|
||||
|
||||
const SHOW_FIREWALL_CONFIG = false;
|
||||
|
||||
// third party modules do not have this flag implemented
|
||||
const SHOW_SCAN_TYPE = false;
|
||||
|
||||
// hide wlan0 in getClientInterfaces() enumeration
|
||||
const HIDE_WLAN0_CLIENT = true;
|
||||
}
|
||||
<?php
|
||||
|
||||
class DeviceConfig
|
||||
{
|
||||
// third party modules can change the options based on this
|
||||
// the allowed values are: "nano" or "tetra"
|
||||
const DEVICE_TYPE = 'nano';
|
||||
|
||||
const USE_INTERNAL_STORAGE = false;
|
||||
|
||||
const USE_USB_STORAGE = true;
|
||||
|
||||
const SHOW_FIREWALL_CONFIG = false;
|
||||
|
||||
// third party modules do not have this flag implemented
|
||||
const SHOW_SCAN_TYPE = false;
|
||||
|
||||
// hide wlan0 in getClientInterfaces() enumeration
|
||||
const HIDE_WLAN0_CLIENT = true;
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
class DeviceConfig
|
||||
{
|
||||
// third party modules can change the options based on this
|
||||
// the allowed values are: "nano" or "tetra"
|
||||
const DEVICE_TYPE = 'tetra';
|
||||
|
||||
const USE_INTERNAL_STORAGE = true;
|
||||
|
||||
const USE_USB_STORAGE = true;
|
||||
|
||||
const SHOW_FIREWALL_CONFIG = true;
|
||||
|
||||
// third party modules do not have this flag implemented
|
||||
const SHOW_SCAN_TYPE = true;
|
||||
|
||||
// hide wlan0 in getClientInterfaces() enumeration
|
||||
const HIDE_WLAN0_CLIENT = true;
|
||||
}
|
||||
<?php
|
||||
|
||||
class DeviceConfig
|
||||
{
|
||||
// third party modules can change the options based on this
|
||||
// the allowed values are: "nano" or "tetra"
|
||||
const DEVICE_TYPE = 'tetra';
|
||||
|
||||
const USE_INTERNAL_STORAGE = true;
|
||||
|
||||
const USE_USB_STORAGE = true;
|
||||
|
||||
const SHOW_FIREWALL_CONFIG = true;
|
||||
|
||||
// third party modules do not have this flag implemented
|
||||
const SHOW_SCAN_TYPE = true;
|
||||
|
||||
// hide wlan0 in getClientInterfaces() enumeration
|
||||
const HIDE_WLAN0_CLIENT = true;
|
||||
}
|
||||
|
@ -1,54 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Usage: led <color|reset> [on|off]
|
||||
|
||||
usage() {
|
||||
echo "Usage: led <color|reset> [on|off]"
|
||||
echo " "
|
||||
echo "Available colors are: BLUE"
|
||||
exit 1
|
||||
}
|
||||
|
||||
resetLEDs() {
|
||||
/etc/init.d/led restart
|
||||
}
|
||||
|
||||
setLED() {
|
||||
led=$1
|
||||
state=$2
|
||||
case "$led" in
|
||||
blue|BLUE|all|ALL)
|
||||
echo "$state" > /sys/class/leds/wifi-pineapple-nano:blue:system/brightness
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
color=$(echo "$1" | tr '[:upper:]' '[:lower:]')
|
||||
mode=$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
case "$color" in
|
||||
reset)
|
||||
resetLEDs
|
||||
;;
|
||||
blue|all)
|
||||
case "$mode" in
|
||||
on)
|
||||
setLED $color 255
|
||||
;;
|
||||
off)
|
||||
setLED $color 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Done."
|
||||
#!/bin/sh
|
||||
|
||||
# Usage: led <color|reset> [on|off]
|
||||
|
||||
usage() {
|
||||
echo "Usage: led <color|reset> [on|off]"
|
||||
echo " "
|
||||
echo "Available colors are: BLUE"
|
||||
exit 1
|
||||
}
|
||||
|
||||
resetLEDs() {
|
||||
/etc/init.d/led restart
|
||||
}
|
||||
|
||||
setLED() {
|
||||
led=$1
|
||||
state=$2
|
||||
case "$led" in
|
||||
blue|BLUE|all|ALL)
|
||||
echo "$state" > /sys/class/leds/wifi-pineapple-nano:blue:system/brightness
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
color=$(echo "$1" | tr '[:upper:]' '[:lower:]')
|
||||
mode=$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
case "$color" in
|
||||
reset)
|
||||
resetLEDs
|
||||
;;
|
||||
blue|all)
|
||||
case "$mode" in
|
||||
on)
|
||||
setLED $color 255
|
||||
;;
|
||||
off)
|
||||
setLED $color 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Done."
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,190 +1,190 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2023 DSR!
|
||||
|
||||
COMMANDS="format_sd correct_sd_mount missing_packages theme_install set_panel_port set_router_ip set_pineap_interface handle_lost_phys"
|
||||
HELP="
|
||||
Available commands:
|
||||
format_sd Format SD/pendrive for use with Pineapple
|
||||
correct_sd_mount Fix ghost SD/pendrive issues
|
||||
missing_packages Install the missing OpenWRT packages
|
||||
theme_install Deploys the tool to change panel theme
|
||||
set_panel_port Change the port used by panel
|
||||
set_router_ip Change the IP used by the hardware
|
||||
set_pineap_interface Change the interface used by PineAP
|
||||
handle_lost_phys Fix unrecognized wifi interfaces
|
||||
"
|
||||
PACKAGES="python-logging python-openssl python-sqlite3 python-codecs"
|
||||
|
||||
to_logger() {
|
||||
logger -s -t wpc "$1"
|
||||
}
|
||||
|
||||
format_sd() {
|
||||
to_logger "[+] Formatting SD using the panel script..."
|
||||
/pineapple/modules/Advanced/formatSD/format_sd
|
||||
to_logger "Process finished. Read the log to see if it was completed correctly."
|
||||
to_logger "The partition may take a few seconds to become available."
|
||||
}
|
||||
|
||||
correct_sd_mount() {
|
||||
SD_STATUS=$(/bin/mount | /bin/grep "on /sd" -c)
|
||||
SD_COUNT=$(ls /sd | wc -l)
|
||||
if [[ -d /sd && $SD_STATUS == "0" && $SD_COUNT == "0" ]]; then
|
||||
to_logger "[+] Fix sd status"
|
||||
rm -rf /sd
|
||||
fi
|
||||
}
|
||||
|
||||
missing_packages() {
|
||||
if [[ ! -d "/usr/lib/python2.7" && ! -d "/sd/usr/lib/python2.7" ]]; then
|
||||
FREE_SPACE=$(df / | tail -1 | awk '{print $4}')
|
||||
|
||||
if [[ ! -d /sd && $FREE_SPACE -lt 10240 ]]; then
|
||||
to_logger "[!] There is not enough space to install the packages"
|
||||
elif ping -q -c 1 -W 1 1.1.1.1 >/dev/null; then
|
||||
to_logger "[+] Installing missing packages..."
|
||||
INSTALL_ROUTE="--dest sd"
|
||||
if [[ $FREE_SPACE -gt 10240 ]]; then
|
||||
INSTALL_ROUTE=""
|
||||
to_logger "[*] Found available space in the system partition"
|
||||
fi
|
||||
|
||||
opkg update && opkg $INSTALL_ROUTE install $PACKAGES && python -m compileall
|
||||
if [[ ! -d "/usr/lib/python2.7" && ! -d "/sd/usr/lib/python2.7" ]]; then
|
||||
to_logger "[!] Packages were not installed!"
|
||||
else
|
||||
to_logger "[*] Install Complete!"
|
||||
fi
|
||||
else
|
||||
to_logger "[!] Connect to the internet and run \"wpc-tools missing_packages\" command!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
theme_install() {
|
||||
to_logger "[+] Downloading theme manager..."
|
||||
wget -q "https://raw.githubusercontent.com/xchwarze/wifi-pineapple-community/main/themes/install.sh" -O /tmp/theme-install.sh
|
||||
chmod +x /tmp/theme-install.sh
|
||||
to_logger "[*] By running /tmp/theme-install.sh you will be able to see the available themes and choose the one you want"
|
||||
/tmp/theme-install.sh "$1"
|
||||
}
|
||||
|
||||
set_panel_port() {
|
||||
new_port="$1"
|
||||
config_file="/etc/nginx/nginx.conf"
|
||||
if [ -z "$new_port" ] || ! echo "$new_port" | grep -qE '^[1-9][0-9]{0,4}$' || [ "$new_port" -gt 65535 ]; then
|
||||
to_logger "[!] Error: You must provide a valid TCP port (1-65535) as a parameter"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
old_port=$(awk '/listen/ {++counter; if(counter==2) print NR}' "$config_file")
|
||||
sed -i "${old_port}s/[0-9]\+/$new_port/" "$config_file"
|
||||
/etc/init.d/nginx restart
|
||||
|
||||
uci set firewall.allowui.dest_port="$new_port"
|
||||
uci commit firewall
|
||||
/etc/init.d/firewall restart
|
||||
|
||||
to_logger "[+] The port has been changed to: $new_port"
|
||||
}
|
||||
|
||||
set_router_ip() {
|
||||
new_ip="$1"
|
||||
if [ -z "$new_ip" ] || ! echo "$new_ip" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||
to_logger "[!] Error: You must provide a valid IP address as a parameter"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gateway_ip="${new_ip%.*}.42"
|
||||
uci set network.lan.ipaddr="$gateway_ip"
|
||||
uci set network.lan.gateway="$new_ip"
|
||||
uci commit network
|
||||
|
||||
to_logger "[+] The LAN IP address has been updated to: $new_ip"
|
||||
/etc/init.d/network restart
|
||||
}
|
||||
|
||||
set_pineap_interface() {
|
||||
new_iface=$(echo $1 | sed 's/mon//')
|
||||
iface=$(uci get pineap.@config[0].pineap_interface | sed 's/mon//')
|
||||
if [[ "$new_iface" == "" ]]; then
|
||||
to_logger "[!] Error: You must select a new interface to assign to"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
to_logger "[+] Current interface : ${iface}"
|
||||
to_logger "[+] New interface : ${new_iface}"
|
||||
|
||||
airmon-ng stop "${iface}mon" &>/dev/null
|
||||
airmon-ng stop "${new_iface}mon" &>/dev/null
|
||||
|
||||
uci set pineap.@config[0].pineap_interface="${new_iface}mon"
|
||||
uci commit pineap
|
||||
|
||||
/etc/init.d/pineapd restart
|
||||
}
|
||||
|
||||
# based on airmon-ng code
|
||||
handle_lost_phys() {
|
||||
to_logger "[+] Looking for unrecognized wifi interfaces..."
|
||||
if [ -d /sys/class/ieee80211 ]; then
|
||||
for i in $(ls /sys/class/ieee80211/); do
|
||||
if [ ! -d /sys/class/ieee80211/${i}/device/net ]; then
|
||||
to_logger "[*] Found ${i} with no interface assigned!"
|
||||
find_free_interface ${i}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
to_logger "[*] Check completed"
|
||||
}
|
||||
|
||||
find_free_interface() {
|
||||
PHYDEV="${1}"
|
||||
target_mode="station"
|
||||
target_type="1"
|
||||
|
||||
for i in $(seq 0 100); do
|
||||
if [ "$i" = "100" ]; then
|
||||
to_logger "[!] Unable to find a free name between wlan0 and wlan99"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -e /sys/class/net/wlan${i} ] && [ ! -e /sys/class/net/wlan${i}mon ]; then
|
||||
to_logger "[*] Candidate wlan${i} and wlan${i}mon are both clear, creating wlan${i}"
|
||||
|
||||
IW_ERROR="$(iw phy ${PHYDEV} interface add wlan${i} type ${target_mode} 2>&1)"
|
||||
if [ -z "${IW_ERROR}" ]; then
|
||||
if [ -d /sys/class/ieee80211/${PHYDEV}/device/net ]; then
|
||||
for j in $(ls /sys/class/ieee80211/${PHYDEV}/device/net/); do
|
||||
if [ "$(cat /sys/class/ieee80211/${PHYDEV}/device/net/${j}/type)" = "${target_type}" ]; then
|
||||
k=${j#wlan}
|
||||
i=${k%mon}
|
||||
fi
|
||||
done
|
||||
else
|
||||
to_logger "[!] Unable to create wlan${i} and no error received"
|
||||
return 1
|
||||
fi
|
||||
|
||||
to_logger "[!] mac80211 ${target_mode} mode vif enabled on [${PHYDEV}]wlan${i}"
|
||||
unset IW_ERROR
|
||||
break
|
||||
else
|
||||
to_logger "[!] Error: Adding ${target_mode} mode interface: ${IW_ERROR}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# handle commands
|
||||
if [[ $# -gt 0 ]]; then
|
||||
if echo "${COMMANDS}" | grep -wq "$1"; then
|
||||
$1 "$2"
|
||||
else
|
||||
to_logger "Unknown command: $1"
|
||||
echo "${HELP}"
|
||||
fi
|
||||
else
|
||||
echo "${HELP}"
|
||||
fi
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2023 DSR!
|
||||
|
||||
COMMANDS="format_sd correct_sd_mount missing_packages theme_install set_panel_port set_router_ip set_pineap_interface handle_lost_phys"
|
||||
HELP="
|
||||
Available commands:
|
||||
format_sd Format SD/pendrive for use with Pineapple
|
||||
correct_sd_mount Fix ghost SD/pendrive issues
|
||||
missing_packages Install the missing OpenWRT packages
|
||||
theme_install Deploys the tool to change panel theme
|
||||
set_panel_port Change the port used by panel
|
||||
set_router_ip Change the IP used by the hardware
|
||||
set_pineap_interface Change the interface used by PineAP
|
||||
handle_lost_phys Fix unrecognized wifi interfaces
|
||||
"
|
||||
PACKAGES="python-logging python-openssl python-sqlite3 python-codecs"
|
||||
|
||||
to_logger() {
|
||||
logger -s -t wpc "$1"
|
||||
}
|
||||
|
||||
format_sd() {
|
||||
to_logger "[+] Formatting SD using the panel script..."
|
||||
/pineapple/modules/Advanced/formatSD/format_sd
|
||||
to_logger "Process finished. Read the log to see if it was completed correctly."
|
||||
to_logger "The partition may take a few seconds to become available."
|
||||
}
|
||||
|
||||
correct_sd_mount() {
|
||||
SD_STATUS=$(/bin/mount | /bin/grep "on /sd" -c)
|
||||
SD_COUNT=$(ls /sd | wc -l)
|
||||
if [[ -d /sd && $SD_STATUS == "0" && $SD_COUNT == "0" ]]; then
|
||||
to_logger "[+] Fix sd status"
|
||||
rm -rf /sd
|
||||
fi
|
||||
}
|
||||
|
||||
missing_packages() {
|
||||
if [[ ! -d "/usr/lib/python2.7" && ! -d "/sd/usr/lib/python2.7" ]]; then
|
||||
FREE_SPACE=$(df / | tail -1 | awk '{print $4}')
|
||||
|
||||
if [[ ! -d /sd && $FREE_SPACE -lt 10240 ]]; then
|
||||
to_logger "[!] There is not enough space to install the packages"
|
||||
elif ping -q -c 1 -W 1 1.1.1.1 >/dev/null; then
|
||||
to_logger "[+] Installing missing packages..."
|
||||
INSTALL_ROUTE="--dest sd"
|
||||
if [[ $FREE_SPACE -gt 10240 ]]; then
|
||||
INSTALL_ROUTE=""
|
||||
to_logger "[*] Found available space in the system partition"
|
||||
fi
|
||||
|
||||
opkg update && opkg $INSTALL_ROUTE install $PACKAGES && python -m compileall
|
||||
if [[ ! -d "/usr/lib/python2.7" && ! -d "/sd/usr/lib/python2.7" ]]; then
|
||||
to_logger "[!] Packages were not installed!"
|
||||
else
|
||||
to_logger "[*] Install Complete!"
|
||||
fi
|
||||
else
|
||||
to_logger "[!] Connect to the internet and run \"wpc-tools missing_packages\" command!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
theme_install() {
|
||||
to_logger "[+] Downloading theme manager..."
|
||||
wget -q "https://raw.githubusercontent.com/xchwarze/wifi-pineapple-community/main/themes/install.sh" -O /tmp/theme-install.sh
|
||||
chmod +x /tmp/theme-install.sh
|
||||
to_logger "[*] By running /tmp/theme-install.sh you will be able to see the available themes and choose the one you want"
|
||||
/tmp/theme-install.sh "$1"
|
||||
}
|
||||
|
||||
set_panel_port() {
|
||||
new_port="$1"
|
||||
config_file="/etc/nginx/nginx.conf"
|
||||
if [ -z "$new_port" ] || ! echo "$new_port" | grep -qE '^[1-9][0-9]{0,4}$' || [ "$new_port" -gt 65535 ]; then
|
||||
to_logger "[!] Error: You must provide a valid TCP port (1-65535) as a parameter"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
old_port=$(awk '/listen/ {++counter; if(counter==2) print NR}' "$config_file")
|
||||
sed -i "${old_port}s/[0-9]\+/$new_port/" "$config_file"
|
||||
/etc/init.d/nginx restart
|
||||
|
||||
uci set firewall.allowui.dest_port="$new_port"
|
||||
uci commit firewall
|
||||
/etc/init.d/firewall restart
|
||||
|
||||
to_logger "[+] The port has been changed to: $new_port"
|
||||
}
|
||||
|
||||
set_router_ip() {
|
||||
new_ip="$1"
|
||||
if [ -z "$new_ip" ] || ! echo "$new_ip" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||
to_logger "[!] Error: You must provide a valid IP address as a parameter"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gateway_ip="${new_ip%.*}.42"
|
||||
uci set network.lan.ipaddr="$gateway_ip"
|
||||
uci set network.lan.gateway="$new_ip"
|
||||
uci commit network
|
||||
|
||||
to_logger "[+] The LAN IP address has been updated to: $new_ip"
|
||||
/etc/init.d/network restart
|
||||
}
|
||||
|
||||
set_pineap_interface() {
|
||||
new_iface=$(echo $1 | sed 's/mon//')
|
||||
iface=$(uci get pineap.@config[0].pineap_interface | sed 's/mon//')
|
||||
if [[ "$new_iface" == "" ]]; then
|
||||
to_logger "[!] Error: You must select a new interface to assign to"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
to_logger "[+] Current interface : ${iface}"
|
||||
to_logger "[+] New interface : ${new_iface}"
|
||||
|
||||
airmon-ng stop "${iface}mon" &>/dev/null
|
||||
airmon-ng stop "${new_iface}mon" &>/dev/null
|
||||
|
||||
uci set pineap.@config[0].pineap_interface="${new_iface}mon"
|
||||
uci commit pineap
|
||||
|
||||
/etc/init.d/pineapd restart
|
||||
}
|
||||
|
||||
# based on airmon-ng code
|
||||
handle_lost_phys() {
|
||||
to_logger "[+] Looking for unrecognized wifi interfaces..."
|
||||
if [ -d /sys/class/ieee80211 ]; then
|
||||
for i in $(ls /sys/class/ieee80211/); do
|
||||
if [ ! -d /sys/class/ieee80211/${i}/device/net ]; then
|
||||
to_logger "[*] Found ${i} with no interface assigned!"
|
||||
find_free_interface ${i}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
to_logger "[*] Check completed"
|
||||
}
|
||||
|
||||
find_free_interface() {
|
||||
PHYDEV="${1}"
|
||||
target_mode="station"
|
||||
target_type="1"
|
||||
|
||||
for i in $(seq 0 100); do
|
||||
if [ "$i" = "100" ]; then
|
||||
to_logger "[!] Unable to find a free name between wlan0 and wlan99"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -e /sys/class/net/wlan${i} ] && [ ! -e /sys/class/net/wlan${i}mon ]; then
|
||||
to_logger "[*] Candidate wlan${i} and wlan${i}mon are both clear, creating wlan${i}"
|
||||
|
||||
IW_ERROR="$(iw phy ${PHYDEV} interface add wlan${i} type ${target_mode} 2>&1)"
|
||||
if [ -z "${IW_ERROR}" ]; then
|
||||
if [ -d /sys/class/ieee80211/${PHYDEV}/device/net ]; then
|
||||
for j in $(ls /sys/class/ieee80211/${PHYDEV}/device/net/); do
|
||||
if [ "$(cat /sys/class/ieee80211/${PHYDEV}/device/net/${j}/type)" = "${target_type}" ]; then
|
||||
k=${j#wlan}
|
||||
i=${k%mon}
|
||||
fi
|
||||
done
|
||||
else
|
||||
to_logger "[!] Unable to create wlan${i} and no error received"
|
||||
return 1
|
||||
fi
|
||||
|
||||
to_logger "[!] mac80211 ${target_mode} mode vif enabled on [${PHYDEV}]wlan${i}"
|
||||
unset IW_ERROR
|
||||
break
|
||||
else
|
||||
to_logger "[!] Error: Adding ${target_mode} mode interface: ${IW_ERROR}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# handle commands
|
||||
if [[ $# -gt 0 ]]; then
|
||||
if echo "${COMMANDS}" | grep -wq "$1"; then
|
||||
$1 "$2"
|
||||
else
|
||||
to_logger "Unknown command: $1"
|
||||
echo "${HELP}"
|
||||
fi
|
||||
else
|
||||
echo "${HELP}"
|
||||
fi
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Community Packages
|
||||
src/gz community_packages https://raw.githubusercontent.com/xchwarze/wifi-pineapple-community/main/packages/mips_24kc
|
||||
# Community Packages
|
||||
src/gz community_packages https://raw.githubusercontent.com/xchwarze/wifi-pineapple-community/main/packages/mips_24kc
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Community Packages
|
||||
src/gz community_packages https://raw.githubusercontent.com/xchwarze/wifi-pineapple-community/main/packages/mipsel_24kc
|
||||
# Community Packages
|
||||
src/gz community_packages https://raw.githubusercontent.com/xchwarze/wifi-pineapple-community/main/packages/mipsel_24kc
|
||||
|
Loading…
Reference in New Issue
Block a user