Re: Tutorial: Query the Apple database with Python for your access point BSSID
Marian <[email protected]>
| Newsgroups | alt.comp.os.windows-10,alt.internet.wireless,alt.comp.microsoft.windows,alt.comp.os.windows-11 |
|---|---|
| Organization | BWH Usenet Archive (https://usenet.blueworldhosting.com) |
| Message-ID | <[email protected]> |
Marian wrote:
> Here is code I hacked out this morning which tracks those 400 BSSID:GPS
> pairs, where I set the distance to 100KM but it could be any distance.
Here is code that generates random (or sequential) BSSIDs to place into a
file which can later be checked against Apple's highly insecure WPS DB.
C:\> bssidgenerate.bat
Select an OUI from the menu or press Enter to type your own:
1) TP-Link F4:F2:6D
2) Netgear 44:94:FC
3) Arris 60:31:97
4) Ubiquiti 24:A4:3C
5) Technicolor 10:13:31
6) Cisco/Linksys 00:25:9C
7) ASUS AC:9E:17
8) Google/Nest F4:F5:D8
9) Amazon/Eero 74:83:C2
10) Hitron C8:3A:35
Enter menu number (1¡V10) or press Enter to type your own: 3
How many BSSIDs do you want to generate?: 100
Random or Sequential? (R/S): r
Generating BSSIDs...
60:31:97:CF:01:AB
60:31:97:21:8A:8B
60:31:97:A2:3D:B5
60:31:97:E3:F7:5F
60:31:97:62:E4:8A
60:31:97:7F:45:6D
60:31:97:77:C3:76
60:31:97:63:9E:DB
60:31:97:5C:33:91
60:31:97:76:B9:71
60:31:97:1D:0B:F0
60:31:97:9C:17:21
60:31:97:25:F7:F5
60:31:97:4D:67:FA
60:31:97:94:88:D0
60:31:97:E7:73:04
etc.
Output file saved to: bssidinput.txt
@echo off
:: C:\app\os\python\apple_bssid_locator\bssidgenerate.bat
:: Runs bssidgenerate.ps1 to generate random/sequential realistic BSSIDs
set "SCRIPT=%~dp0bssidgenerate.ps1"
echo Running PowerShell script:
echo %SCRIPT%
echo.
powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT%"
# C:\app\os\python\apple_bssid_locator\bssidgenerate.ps1
# Usemodel: bssidgenerate.bat (runs this powershell script)
# v1p0 20251217
# Generates BSSIDs based on user input.
# Prompts for:
# 1. OUI (first half), e.g., F4:F2:6D (TP-Link)
# 2. Number of BSSIDs to generate (e.g., 100)
# 3. Mode: R = random, S = sequential
# v1p1 20251217
# Saves results to bssidinput.txt
# Forces an OUI in case enter is hit prematurely
# v1p2 20251217
# Added menu of the ten most common USA OUI's
# v1p3 20251217
# Added sequential-mode starting block
# v1p4 20251217
# Added wraparound protection (at FF:FF:FF)
# --- BEGIN OUI MENU BLOCK ---
Write-Host ""
Write-Host "Select an OUI from the menu or press Enter to type your own:"
Write-Host " 1) TP-Link F4:F2:6D"
Write-Host " 2) Netgear 44:94:FC"
Write-Host " 3) Arris 60:31:97"
Write-Host " 4) Ubiquiti 24:A4:3C"
Write-Host " 5) Technicolor 10:13:31"
Write-Host " 6) Cisco/Linksys 00:25:9C"
Write-Host " 7) ASUS AC:9E:17"
Write-Host " 8) Google/Nest F4:F5:D8"
Write-Host " 9) Amazon/Eero 74:83:C2"
Write-Host " 10) Hitron C8:3A:35"
Write-Host ""
$choice = Read-Host "Enter menu number (1¡V10) or press Enter to type your own"
switch ($choice) {
"1" { $oui = "F4:F2:6D" }
"2" { $oui = "44:94:FC" }
"3" { $oui = "60:31:97" }
"4" { $oui = "24:A4:3C" }
"5" { $oui = "10:13:31" }
"6" { $oui = "00:25:9C" }
"7" { $oui = "AC:9E:17" }
"8" { $oui = "F4:F5:D8" }
"9" { $oui = "74:83:C2" }
"10" { $oui = "C8:3A:35" }
default { $oui = $null }
}
# --- END OUI MENU BLOCK ---
# Ask for the first half (OUI)
if (-not $oui) {
$oui = Read-Host "Enter the first half (e.g., F4:F2:6D)"
}
$oui = $oui.ToUpper().Replace("-",":").Trim()
# Prevent empty OUI
if (-not $oui) {
Write-Host "You must enter an OUI such as F4:F2:6D."
exit
}
# Ask how many BSSIDs to generate
$count = Read-Host "How many BSSIDs do you want to generate?"
$count = [int]$count
# Ask for mode: random or sequential
$mode = Read-Host "Random or Sequential? (R/S)"
$mode = $mode.ToUpper()
Write-Host ""
Write-Host "Generating BSSIDs..."
Write-Host ""
# Output file
$outfile = "bssidinput.txt"
Clear-Content -Path $outfile -ErrorAction SilentlyContinue
# Function to format a number 0¡V255 as two hex digits
function To-Hex([int]$n) {
return "{0:X2}" -f $n
}
# Sequential mode
if ($mode -eq "S") {
# Ask for starting second-half (e.g., AB:CD:EF)
$startHex = Read-Host "Enter starting second-half (e.g., AB:CD:EF) or press Enter for 00:00:00"
if (-not $startHex) { $startHex = "00:00:00" }
# Normalize
$startHex = $startHex.ToUpper().Replace("-",":").Trim()
# Convert to integer
$parts = $startHex.Split(":")
if ($parts.Count -ne 3) {
Write-Host "Invalid starting value. Must be three bytes like AB:CD:EF."
exit
}
$startVal = ([Convert]::ToInt32($parts[0],16) -shl 16) `
+ ([Convert]::ToInt32($parts[1],16) -shl 8) `
+ [Convert]::ToInt32($parts[2],16)
$maxVal = 0xFFFFFF
for ($i = 0; $i -lt $count; $i++) {
$val = $startVal + $i
if ($val -gt $maxVal) {
Write-Host "Reached maximum value FF:FF:FF. Stopping."
break
}
$b1 = ($val -shr 16) -band 0xFF
$b2 = ($val -shr 8) -band 0xFF
$b3 = $val -band 0xFF
$bssid = "${oui}:{0}:{1}:{2}" -f (To-Hex $b1), (To-Hex $b2), (To-Hex $b3)
Write-Host $bssid
Add-Content -Path $outfile -Value $bssid
}
}
# Random mode
elseif ($mode -eq "R") {
$rand = New-Object System.Random
for ($i = 0; $i -lt $count; $i++) {
$b1 = $rand.Next(0,256)
$b2 = $rand.Next(0,256)
$b3 = $rand.Next(0,256)
$bssid = "${oui}:{0}:{1}:{2}" -f (To-Hex $b1), (To-Hex $b2), (To-Hex $b3)
Write-Host $bssid
Add-Content -Path $outfile -Value $bssid
}
}
else {
Write-Host "Invalid choice. Please enter R or S."
}
Write-Host ""
Write-Host "Output file saved to: $(Resolve-Path $outfile)"
# end of C:\app\os\python\apple_bssid_locator\bssidgenerate.ps1
--
Helping others & learning from them is what this Usenet ng is all about.