20260105_Wirless Note
今天想要分享 WIFI 筆記跟,工具,和 CLI 指令
Capture Wireless OTA Beacon
不同平台有不同抓法,我在這用 Linux 分享,因為它是免費也最簡單用。如果你有 MAC 那是最簡單方式,甚麼都不用安裝你需要有 wireshark。
There’re many type of tool you can use to cpature, but I’m going to use the most easiest way to capture Wireless Beacon Packet OTA(AIR) packet. I will be using Linux which is free and easy to setup. If you have MAC then it’s more easy no need to install any tool, just need a wireshark then you can capture.
Step1 Install airmon-ng
Linux Distribution: Ubuntu
1 | sudo apt install airmon-ng |
Step2 Check your Wirless interface
Please noted down your wirless interface ex: wlan0
1 | ifconfig #to list all interface |
Step3 Run command
Please check your wirless current channel to capture else you’re not able to capture. You can use tool like insider, or GUI to check current channel
- Capture
1 | sudo airmon-ng check kill |
For example:
1 | sudo airmon-ng start wlan0 |
- Wireshark
You can filter your wireless backhaul or wifi interface for easy to debug or find the correct packet with below command, just paste the command into below wireshark picture the place where I mark red on it.
1 | wlan host <MAC address> |
- Finish Capture:
1 | sudo airmon-ng stop <wlan>mon |
Step4 Wireshark
When you’re capture overnight or overweekend, you need to set a special setting, else you disk might be full when capturing it.
Please enable ring biffer it will overwrite file after X size, in my example I set afer 200MB with 10 file, which total to 2GB. This mean after 10 file, the next time it will overwrite the first one.
Wireless Command
I like to show you how to use wireless command to check current SSID around, or password you ever connected and forget. Please Noted the password is only able to check you ever type in password. You’re not able to hack on any ssid password with command. The command is just for some productively without using mouse to connect.
However you can still hack ssid password by other security tool, which I am not going to cover here, you can search on internet if you’re interested.
I will show you window and linux command some how they are different. This is useful especially if you remote to server or server does not contain UI interface.
List saved SSID
This allow to list all the SSID you have ever connected before which mean you ever type in the password and connected.
1 | #window |
Show Password
1 | #window |
Scan all ssid
1 | #window |
- Show More detail infor (Window)
1 | netsh wlan show networks mode=bssid |
Make a connection to SSID
In previous command you check available SSID you can use, now you need to make a connection
1 | #linux |
For window there if you connect first time, then follow below step. If you used to connected, then you above. In window to connected SSID need to have a profile file.
First Time Connected (window)
There’re several step to do before connecting only with window OS
Step 1 : Create a ssid.xml file (ex: WIFI-CAK9XRN.xml)
Please replace {} the string of your ssid, and password.
1 | <?xml version="1.0"?> |
Step 2: Create xml file with interface
Let Create a profile with file you create in previous step, and you Wirless interface.
If you don’t know your itnerface please use netsh wlan show interfaces to check which interface your wan is.
1 | netsh wlan add profile filename=".\WIFI-CAK9XRN.xml" interface="Wi-Fi" |
You can show profile again, it should display the profile you create
1 | netsh wlan show profile |
Note: If you modify your
.xmlfile, you need to remove the profile, else it will not apply
1 | netsh wlan delete profile name="SSID" |
Step3 connect ssid
1 | netsh wlan connect name="WIFI-CAK9XRN" |
Export your profile
1 | #export all your profile (this is all saved network) |
connect status
1 | #linux |
Forget Network (SSID)
1 | #Linux |
Discconect your SSID
1 | #linux |
Alternative you can use
1 | sudo nmcli connection down <CONNECTION_NAME> |
Wifi Summary:
Window is much complicated on setting, Linux is much easier, so I will list commonly use command
Window
1 | # get your ssid password |
Linux
1 | # get your ssid password |