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