Last active
June 4, 2020 12:31
-
-
Save R3D9477/c99cf6131acd6ff03ff2797f15402230 to your computer and use it in GitHub Desktop.
WiFi Pub. AccessPoint + Anon. FTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# INSTALL&SETUP ANONYMOUS FTP | |
# TESTED ON UBUNTU 18.04 SERVER | |
sudo -s | |
#------------------------------------------------------- | |
apt install proftpd | |
#------------------------------------------------------- | |
systemctl stop proftpd | |
systemctl disable proftpd | |
#------------------------------------------------------- | |
mkdir /var/ftp | |
chmod 777 /var/ftp | |
cat > /etc/proftpd/conf.d/anon.conf << EOF | |
<Anonymous /var/ftp/> | |
User ftp | |
Group ftp | |
RequireValidShell no | |
UserAlias anonymous ftp | |
WtmpLog off | |
<Directory *> | |
<Limit WRITE> | |
AllowAll | |
</Limit> | |
</Directory> | |
</Anonymous> | |
EOF | |
#------------------------------------------------------- | |
systemctl start proftpd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
systemctl stop hostapd | |
systemctl stop isc-dhcp-server | |
if [ -f "/var/run/dhcpd.pid" ] ; then rm /var/run/dhcpd.pid ; fi | |
#--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
AP=$(iw dev | grep Interface | xargs | cut -f 2 -d " ") | |
if [ -z "$AP" ] ; then exit 1 ; fi | |
if [ -f ".${AP}_wifiap_configured" ] ; then exit 0 ; fi | |
#--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
cat > "/etc/network/interfaces.d/99-wlanap" << EOF | |
auto ${AP} | |
iface ${AP} inet static | |
address 10.0.0.1 | |
netmask 255.255.255.0 | |
EOF | |
cat > "/etc/sysctl.d/00_${AP}_ipv6_off.conf" << EOF | |
net.ipv6.conf.${AP}.disable_ipv6=1 | |
EOF | |
cat > "/etc/hostapd.conf" << EOF | |
interface=${AP} | |
driver=nl80211 | |
ssid=MCP1 | |
hw_mode=g | |
channel=6 | |
wpa=0 | |
EOF | |
cat > "/etc/default/hostapd" << EOF | |
DAEMON_CONF="/etc/hostapd.conf" | |
RUN_DAEMON="yes" | |
EOF | |
cat > "/etc/dhcp/dhcpd.conf" << EOF | |
subnet 10.0.0.0 netmask 255.255.255.224 { | |
range 10.0.0.2 10.0.0.10; | |
} | |
EOF | |
cat > "/etc/default/isc-dhcp-server" << EOF | |
INTERFACESv4=${AP} | |
EOF | |
cp -n "/etc/hosts" "/etc/hosts.bck" | |
sed -i "s|[0-9].*$(cat /etc/hostname)||g" "/etc/hosts" | |
echo "10.0.0.1 $(cat /etc/hostname)" | tee -a "/etc/hosts" | |
systemctl restart networking | |
#--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
echo "1" > ".${AP}_wifiap_configured" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment