我有两个USB无线网卡,wlan0和wlan1。
wlan0用yagi天线连接到远处的wifi (我有一栋离“文明”很远的房子,所以我使用的是公开无线网络)
所以我想要的是,能够和我的android手机分享这个连接,因为我不能真正连接yagi天线到android,所以我想创建一个热点,这样我就可以上网到我的android手机,但是我的kali机器上仍然有连接。这是可能的吗?如果可能的话,如何做到?
发布于 2018-07-24 04:20:26
首先从这里下载一些必要的驱动程序。然后
在终端类型lspci中,如果使用usb无线适配器类型命令lsusb
apt-get install hostapd dnsmasq终端类型:
sudo service hostapd stop
sudo service dnsmasq stop
sudo update-rc.d hostapd disable
sudo update-rc.d dnsmasq disable在终端类型中设置配置文件:
gedit /etc/dnsmasq.conf或kate /etc/dnsmasq.conf如果你使用kde.
将这些行添加到配置文件中:
# Bind to only one interface
bind-interfaces
# Choose interface for binding
interface=wlan0
# Specify range of IP addresses for DHCP leasses
dhcp-range=192.168.150.2,192.168.150.10终端类型:
gedit /etc/hostapd.conf再加上他们
# Define interface
interface=wlan0
# Select driver
driver=nl80211
# Set access point name
ssid=myhotspot
# Set access point harware mode to 802.11g
hw_mode=g
# Set WIFI channel (can be easily changed)
channel=6
# Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
wpa=2
wpa_passphrase=mypassword您可以在这里更改任何您想要的ssid名称和密码。当前配置将创建带有密码mypassword的热点名为myhotspot。
现在,在您想要的任何地方创建一个名为hotspot.sh的文件(在桌面上保存脚本的最佳方式),用以下任何文本编辑器编辑它:
#!/bin/bash
# Start
# Configure IP address for WLAN
sudo ifconfig wlan0 192.168.150.1
# Start DHCP/DNS server
sudo service dnsmasq restart
# Enable routing
sudo sysctl net.ipv4.ip_forward=1
# Enable NAT
sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# Run access point daemon
sudo hostapd /etc/hostapd.conf
# Stop
# Disable NAT
sudo iptables -D POSTROUTING -t nat -o ppp0 -j MASQUERADE
# Disable routing
sudo sysctl net.ipv4.ip_forward=0
# Disable DHCP/DNS server
sudo service dnsmasq stop
sudo service hostapd stop您可能需要将其中的ppp0更改为eth0或任何其他与有线连接有关的数字。
最后一步。
现在您可以通过启动脚本启动您的热点。运行它.对我来说是这样的:
root@kali:~# cd /root/Desktop/
root@kali:~/Desktop# ./hotspot.sh如果不想这样做,可以安装pwnstar,它可以与任何驱动程序一起工作
https://unix.stackexchange.com/questions/458057
复制相似问题