Skip to content

Commit a028e95

Browse files
committed
0.20151205
Init version
0 parents  commit a028e95

File tree

7 files changed

+168
-0
lines changed

7 files changed

+168
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2015 zvezdochiot
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Wifi-host-ap-bash
2+
3+
Bash-script for Wi-Fi Access Point in one click
4+
5+
https://github.com/zvezdochiot/wifi-host-ap-bash
6+
7+
## Make deb package
8+
9+
```
10+
du -s
11+
nano config/control #edit config
12+
sudo bash-deb-build lzma
13+
```
14+
15+
## Utilites
16+
17+
For build deb package install bash-deb-build:
18+
19+
https://github.com/zvezdochiot/bash-deb-build

config/control

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Package: wifi-host-ap-bash
2+
Version: 0.20151205-wheezy
3+
Architecture: all
4+
Maintainer: Stanislav German-Evtushenko <giner@github.com>
5+
Section: admin
6+
Priority: extra
7+
Depends: bash, sudo, rfkill, hostapd, dnsmasq-base, screen
8+
Installed-Size: 20
9+
Provides: helplinux
10+
Homepage: https://github.com/giner/helplinux
11+
Description: Wi-Fi Access Point in one click
12+
These small scripts are intended to help make your laptop
13+
to work as a Wi-Fi Access Point in one "click".
14+
Prerequisites:
15+
- Wi-Fi card/adapter supported by hostapd
16+
- Internet connection

config/md5sums

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
753fdffce978ebe083f23e3acbdfe680 usr/sbin/wifi-host-ap-bash
2+
3f5055559d8ee84cd7ebb8b9ab9cfd39 usr/share/doc/wifi-host-ap-bash/wifi-host-ap.conf.sample
3+
bbd440e66946343ebf4e38f207967be5 usr/share/doc/wifi-host-ap-bash/README

data/usr/sbin/wifi-host-ap-bash

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
# Created by Stanislav German-Evtushenko, 2011 (http://habrahabr.ru/post/122876/)
4+
# Updated by Stanislav German-Evtushenko, 2014
5+
6+
if [ $USER == root -a $# == 2 ]
7+
then
8+
LAN=$1
9+
WIFI=$2
10+
else
11+
echo -e "Usage:\tsudo $0 LAN_interface WIFI_interface, for example:\n\tsudo $0 eth0 wlan0"
12+
exit 0
13+
fi
14+
15+
configfile="$HOME/.config/wifi-host-ap.conf"
16+
17+
if [ -f "$configfile" ]
18+
then
19+
source "$configfile"
20+
21+
cat > $DNSMASQ_CONF << EOF
22+
bind-interfaces
23+
except-interface=lo
24+
interface=$WIFI
25+
dhcp-range=$DHCP_RANGE
26+
EOF
27+
28+
cat > $HOSTAPD_CONF << EOF
29+
interface=$WIFI
30+
driver=$WIFIdriver
31+
ssid=$WIFIssid
32+
hw_mode=$WIFImode
33+
channel=$WIFIchannel
34+
wpa=$WIFIwpa
35+
wpa_passphrase=$WIFIpass
36+
EOF
37+
38+
# Start
39+
rfkill unblock wifi
40+
ifconfig $WIFI $HOST_IP
41+
dnsmasq --conf-file=$DNSMASQ_CONF --pid-file=$DNSMASQ_PID
42+
sysctl net.ipv4.ip_forward=1
43+
iptables -t nat -A POSTROUTING -o $LAN -j MASQUERADE
44+
hostapd $HOSTAPD_CONF
45+
46+
iptables -D POSTROUTING -t nat -o $LAN -j MASQUERADE
47+
sysctl net.ipv4.ip_forward=0
48+
kill $(cat $DNSMASQ_PID)
49+
rm $DNSMASQ_PID
50+
51+
# Cleanup
52+
rm $DNSMASQ_CONF
53+
rm $HOSTAPD_CONF
54+
55+
else
56+
echo "Not found $configfile!"
57+
echo "See /usr/share/doc/wifi-host-ap-bash/wifi-host-ap.conf.sample"
58+
fi
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
HelpLinux [https://github.com/giner/helplinux]
2+
Author: Stanislav German-Evtushenko <giner@github.com>
3+
4+
These small scripts are intended to help make your laptop to work as a Wi-Fi Access Point in one "click".
5+
6+
Prerequisites:
7+
- Wi-Fi card/adapter supported by hostapd
8+
- Internet connection
9+
10+
How to use:
11+
1. Install required packages:
12+
sudo apt-get install rfkill hostapd dnsmasq-base screen
13+
sudo service hostapd stop
14+
sudo update-rc.d hostapd disable
15+
2. Disable Wi-Fi in "Network Manager" if you are using one.
16+
You can do this using the network icon in the tray or
17+
do this permanently in the following configuration file
18+
/etc/NetworkManager/NetworkManager.conf:
19+
20+
[keyfile]
21+
unmanaged-devices=mac:<hwaddr>
22+
23+
3. Copy and modify configfile:
24+
sudo cp -v /usr/share/doc/wifi-host-ap.conf.sample /root/.config/wifi-host-ap.conf
25+
sudo nano /root/.config/wifi-host-ap.conf
26+
27+
4. Run wifi-host-ap-start.sh LAN_interface WIFI_interface, for example:
28+
sudo screen wifi-host-ap-bash eth0 wlan0
29+
30+
Defaults:
31+
- Access Point name: laptop-wifi
32+
- WPA2 password: wifipass
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
HOST_IP=192.168.153.1
2+
DHCP_RANGE=192.168.153.2,192.168.153.15
3+
# Set pid file, recommended '/root/tmp/dnsmasq.pid', need a folder /root/tmp
4+
DNSMASQ_PID=/tmp/dnsmasq.pid
5+
# Set temp file, recommended '/root/tmp/...', need a folder /root/tmp
6+
DNSMASQ_CONF=$(mktemp /tmp/dnsmasq.conf-XXXXXXXXXX)
7+
HOSTAPD_CONF=$(mktemp /tmp/hostapd.conf-XXXXXXXXXX)
8+
# Select driver
9+
WIFIdriver=nl80211
10+
# Set access point name
11+
WIFIssid=laptop-wifi
12+
# Set access point harware mode to 802.11g
13+
WIFImode=g
14+
# Set WIFI channel (can be changed)
15+
WIFIchannel=6
16+
# Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
17+
WIFIwpa=2
18+
# Set WIFI password
19+
WIFIpass=wifipass

0 commit comments

Comments
 (0)