{"id":173,"date":"2014-05-08T22:41:44","date_gmt":"2014-05-08T14:41:44","guid":{"rendered":"http:\/\/matnet.my\/blog\/?p=173"},"modified":"2014-05-28T11:46:08","modified_gmt":"2014-05-28T03:46:08","slug":"kali-linux-as-personal-wids-and-internet-gateway-on-raspi","status":"publish","type":"post","link":"https:\/\/matnet.my\/blog\/2014\/05\/kali-linux-as-personal-wids-and-internet-gateway-on-raspi\/","title":{"rendered":"Kali Linux as personal WIDS and Internet Gateway on Raspi"},"content":{"rendered":"<p>Hardware needs :<\/p>\n<p>1. Raspberry Pi Type B<br \/>\n2. WiPi &#8211;\u00a0http:\/\/www.newark.com\/element14\/wipi\/unknown\/dp\/07W8938<br \/>\n3. Ethernet Cross over cable<\/p>\n<p>Instructions :<\/p>\n<p>1. Install KALI linux on raspi http:\/\/docs.kali.org\/armel-armhf\/install-kali-linux-arm-raspberry-pi<\/p>\n<p>2. The first attempt of Kali linux installation on Raspi was failed to identify my WiPi USB dongle<\/p>\n<p>3. To solve this problem we need update the Raspi firmware and reinstall the OS. Please follow this instruction\u00a0https:\/\/github.com\/Hexxeh\/rpi-update.<\/p>\n<p>4. Software needs on\u00a0my Raspi :<\/p>\n<p>a. DHCPD<br \/>\nb. iptables for routing<br \/>\nc. Wireless Tools for scanning<br \/>\nd. aircrack-ng suite<br \/>\ne. python-scapy<br \/>\nf. python-pip<br \/>\ng. GNTP &#8211; Growl Notification Transport Protocol<\/p>\n<p>5. This is the design looks like :<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/matnet.my\/blog\/wp-content\/uploads\/2014\/05\/testbed.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-174\" src=\"https:\/\/matnet.my\/blog\/wp-content\/uploads\/2014\/05\/testbed-300x100.png\" alt=\"testbed\" width=\"300\" height=\"100\" srcset=\"https:\/\/matnet.my\/blog\/wp-content\/uploads\/2014\/05\/testbed-300x100.png 300w, https:\/\/matnet.my\/blog\/wp-content\/uploads\/2014\/05\/testbed.png 900w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>6. The methodology :<\/p>\n<p style=\"text-align: justify;\">The Raspi will use Kali Linux ARM and will have 2 interfaces eth0 and wlan0. The ethernet interface will be the LAN and connected to the Client PC. Wireless interface wlan0 will be the WAN interface and connected to the local AP that provide the internet. Raspi will act as internet gateway and also the Wireless IDS. For the time being this WIDS only will detect de-authentication attacks. I&#8217;ll use airmon-ng to set wlan0 on monitor mode and to use scapy to detect de-authentication packet from the Wireless Network. Once it&#8217;s detect the attacks, GNTP will send the notice on the client as depicted :<\/p>\n<p><a href=\"https:\/\/matnet.my\/blog\/wp-content\/uploads\/2014\/05\/detected.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-177\" src=\"https:\/\/matnet.my\/blog\/wp-content\/uploads\/2014\/05\/detected.png\" alt=\"detected\" width=\"510\" height=\"156\" srcset=\"https:\/\/matnet.my\/blog\/wp-content\/uploads\/2014\/05\/detected.png 510w, https:\/\/matnet.my\/blog\/wp-content\/uploads\/2014\/05\/detected-300x91.png 300w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/a><\/p>\n<p>7. DHCPD installation \/ configuration<\/p>\n<p><strong><span style=\"color: #ff0000;\">apt-get\u00a0install isc-dhcp-server<\/span><\/strong><\/p>\n<p>This is my dhcpd.conf looks like :<\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">subnet 192.168.2.0 netmask 255.255.255.0 {<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">range 192.168.2.100 192.168.2.150;<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">option broadcast-address 192.168.2.255;<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">option routers 192.168.2.1;<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">default-lease-time 600;<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">max-lease-time 7200;<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">option domain-name &#8220;local&#8221;;<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">option domain-name-servers 8.8.8.8, 8.8.4.4;<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">}<\/span><\/p>\n<p>Make it enable on boot :<br \/>\n<strong><span style=\"color: #ff0000;\">update-rc.d isc-dhcp-server enable<\/span><\/strong><\/p>\n<p>Start the service :<\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\"><strong>\/etc\/init.d\/isc-dhcp-server start<\/strong><\/span><\/p>\n<p>8. Setting up routing :<br \/>\nBefore that we needs to configure static IP for this box.<\/p>\n<p>This is how my \/etc\/network\/interfaces looks like :<\/p>\n<p><span style=\"color: #ff0000;\">auto lo<\/span><\/p>\n<p><span style=\"color: #ff0000;\">iface lo inet loopback<\/span><\/p>\n<p><span style=\"color: #ff0000;\">auto eth0<\/span><\/p>\n<p><span style=\"color: #ff0000;\">iface eth0 inet static<\/span><\/p>\n<p><span style=\"color: #ff0000;\">address 192.168.2.1<\/span><\/p>\n<p><span style=\"color: #ff0000;\">netmask 255.255.255.0<\/span><\/p>\n<p><span style=\"color: #ff0000;\">network 192.168.2.0<\/span><\/p>\n<p><span style=\"color: #ff0000;\">broadcast 192.168.2.255<\/span><\/p>\n<p><span style=\"color: #ff0000;\">#gateway 192.168.1.1<\/span><\/p>\n<p><span style=\"color: #ff0000;\">allow-hotplug wlan0<\/span><\/p>\n<p><span style=\"color: #ff0000;\">iface wlan0 inet dhcp<\/span><\/p>\n<p><span style=\"color: #ff0000;\">wpa-conf \/etc\/wpa_supplicant\/wpa_supplicant.conf<\/span><\/p>\n<p>Set postrouting for wlan0<\/p>\n<p><strong><span style=\"color: #ff0000;\">iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE<\/span><\/strong><\/p>\n<p>Setting ip forward on \/etc\/sysctl.conf<\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">net.ipv4.ip_forward=1<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #000000;\"><br \/>\n<\/span>9. Install wireless tools<\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\"><strong>apt-get install\u00a0wireless-tools<\/strong><\/span><\/p>\n<p>Setup wireless wpa_supplicants as mentioned on \/etc\/network\/interfaces<\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">network={<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">ssid=&#8221;SSID-name&#8221;<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">psk=&#8221;passphrase&#8221;<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">proto=RSN<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">key_mgmt=WPA-PSK<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">pairwise=CCMP TKIP<\/span><\/p>\n<p style=\"color: #f5f5f5;\"><span style=\"color: #ff0000;\">}<\/span><\/p>\n<p>10. aircrack-suite is already intalled on KALI Linux \ud83d\ude42<\/p>\n<p>11. Install python-scapy :<\/p>\n<p><strong><span style=\"color: #ff0000;\">apt-get install python-scapy<\/span><\/strong><\/p>\n<p>12. Install python-pip<\/p>\n<p><span style=\"color: #ff0000;\"><strong>apt-get install python-pip<\/strong><\/span><\/p>\n<p>13. Install GNTP<\/p>\n<p style=\"color: #f5f5f5;\"><strong><span style=\"color: #ff0000;\">pip install gntp<\/span><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Thanks to Ajay Yadav for WIDS code \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hardware needs : 1. Raspberry Pi Type B 2. WiPi &#8211;\u00a0http:\/\/www.newark.com\/element14\/wipi\/unknown\/dp\/07W8938 3. Ethernet Cross over cable Instructions : 1. Install &hellip; <a href=\"https:\/\/matnet.my\/blog\/2014\/05\/kali-linux-as-personal-wids-and-internet-gateway-on-raspi\/\" class=\"more-link\">More <span class=\"screen-reader-text\">Kali Linux as personal WIDS and Internet Gateway on Raspi<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5,7],"tags":[],"class_list":["post-173","post","type-post","status-publish","format-standard","hentry","category-bsd-nix","category-cs778","category-hobbies","standard"],"_links":{"self":[{"href":"https:\/\/matnet.my\/blog\/wp-json\/wp\/v2\/posts\/173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matnet.my\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matnet.my\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matnet.my\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matnet.my\/blog\/wp-json\/wp\/v2\/comments?post=173"}],"version-history":[{"count":16,"href":"https:\/\/matnet.my\/blog\/wp-json\/wp\/v2\/posts\/173\/revisions"}],"predecessor-version":[{"id":207,"href":"https:\/\/matnet.my\/blog\/wp-json\/wp\/v2\/posts\/173\/revisions\/207"}],"wp:attachment":[{"href":"https:\/\/matnet.my\/blog\/wp-json\/wp\/v2\/media?parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matnet.my\/blog\/wp-json\/wp\/v2\/categories?post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matnet.my\/blog\/wp-json\/wp\/v2\/tags?post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}