Skip to content

Instantly share code, notes, and snippets.

@jaredhaight
Created April 8, 2016 01:05
Show Gist options
  • Save jaredhaight/ee72e3756dd4a2a9178369d06cafc1c3 to your computer and use it in GitHub Desktop.
Save jaredhaight/ee72e3756dd4a2a9178369d06cafc1c3 to your computer and use it in GitHub Desktop.
Script and config files for setting up a simple AP in Kali
#### INIT SCRIPT ####
#!/bin/bash
#########################################################
# #
# * Make sure to update hostapd.conf to use the monitor #
# interface (default is wlan0) #
# * Add MACs of devices you are working with to the #
# allowed_macs file #
# * Add DNS entries you're spoofing to dns_entries #
# * Make sure that monitor interface isn't managed by #
# network manager. http://askubuntu.com/a/647834 #
# #
#########################################################
MONITOR_DEVICE=wlan0
OUTPUT_DEVICE=eth0
# Catch ctrl c so we can exit cleanly
trap ctrl_c INT
function ctrl_c(){
echo Killing processes..
killall dnsmasq
killall hostapd
}
ifconfig $MONITOR_DEVICE 10.0.0.1/24 up
dnsmasq -C dnsmasq.conf -H dns_entries
sysctl -w net.ipv4.ip_forward=1
iptables -P FORWARD ACCEPT
iptables --table nat -A POSTROUTING -o $OUTPUT_DEVICE -j MASQUERADE
hostapd ./hostapd.conf -B
tshark -i $MONITOR_DEVICE -w output.pcap -P
root@kali:~/wap_config#
######## hostapd.conf ##########
interface=wlan0
driver=nl80211
ssid=Monitor-Network
channel=1
macaddr_acl=1
accept_mac_file=./allowed_macs
logger_syslog=-1
logger_syslog_level=2
###### dnsmasq.conf ###########
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.100,8h
dhcp-option=3,10.0.0.1
dhcp-option=6,10.0.0.1
server=8.8.8.8
log-queries
log-dhcp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment