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.

My claim is that it's trivial to gather valid access points to check 
against Apple's highly insecure WPS database, where below is that check.

Once we have tens of thousands of random (or sequential) BSSIDs (which we
can start at any start point but I stop at the FF:FF:FF wrap around), we 
can then check each of them against Apple's highly insecure WPS database.

 @echo off
 :: This is C:\app\os\python\apple_bssid_locator\bssidcheck.bat 
 :: v1p0 20251217
 ::  checks a list of BSSIDs from bssidcheck.txt in Apple's WPS db
 ::  outputs to the console and into a timestamped log file 
 :: v1p1 20251217
 ::  added fullpath to output files in the console output
 :: v1p2 20251217
 ::  only log when a lookup is successful
 :: v1p3 20251217
 ::  added summary section of bssid's that were found
 
 :: Begin Log setup
 set LOGDIR=%~dp0log
 if not exist "%LOGDIR%" mkdir "%LOGDIR%"
 
 for /f %%A in ('wmic os get localdatetime ^| find "."') do set dt0=%%A
 set "session_ts=%dt0:~0,8%_%dt0:~8,6%"
 set "session_log=%LOGDIR%\session_%session_ts%.log"
 :: End Log setup
 
 :: --- begin Success list setup ---
 set "FOUND_LIST="
 :: --- end Success list setup ---
 
 echo === New BSSID lookup session started at %date% %time% === >> "%session_log%"
 echo Session log: %session_log%
 
 :: Begin FILE MODE
 if exist "%~dp0bssidcheck.txt" (
     echo Processing BSSIDs from bssidcheck.txt...
     for /f "usebackq tokens=*" %%X in ("%~dp0bssidcheck.txt") do (
         set "BSSID=%%X"
         call :process_bssid
     )
     goto end
 )
 :: End FILE MODE
 
 :: Begin INTERACTIVE MODE
 :loop
 echo.
 set /p BSSID=Enter the BSSID (or q to quit): 
 if /I "%BSSID%"=="q" goto end
 
 call :process_bssid
 goto loop
 
 :: End INTERACTIVE MODE
 
 :: Begin PROCESS ONE BSSID
 :process_bssid
 :: --- Clean up input ---
 set "BSSID=%BSSID:"=%"
 set "BSSID=%BSSID: =%"
 
 :: --- begin Make filename-safe version ---
 set "safeBSSID=%BSSID::=-%"
 :: --- end Make filename-safe version ---
 
 :: --- begin Generate timestamp for THIS lookup ---
 for /f %%A in ('wmic os get localdatetime ^| find "."') do set dt=%%A
 set "ts=%dt:~0,8%_%dt:~8,6%"
 :: --- end Generate timestamp for THIS lookup ---
 
 :: --- begin Timestamped output file ---
 set "outfile=%LOGDIR%\bssidlookup_%ts%_%safeBSSID%.log"
 :: --- end Timestamped output file ---
 
 :: --- begin Clear previous coordinates ---
 set LAT=
 set LON=
 :: --- end Clear previous coordinates ---
 
 :: --- begin Run Python lookup ---
 echo === Lookup started at %date% %time% === > "%outfile%"
 echo BSSID: %BSSID% >> "%outfile%"
 echo. >> "%outfile%"
 
 python.exe apple_bssid_locator.py %BSSID% --all >> "%outfile%"
 :: --- end Run Python lookup ---
 
 :: --- begin Display results ---
 echo -----------------------------------------------
 type "%outfile%"
 echo -----------------------------------------------
 if defined LAT if defined LON echo Log written to: %outfile%
 :: --- end Display results ---
 
 :: --- begin Extract coordinates ---
 for /f "tokens=2 delims=: " %%A in ('findstr /i "Latitude" "%outfile%"') do set LAT=%%A
 for /f "tokens=2 delims=: " %%B in ('findstr /i "Longitude" "%outfile%"') do set LON=%%B
 
 echo === Lookup finished at %date% %time% === >> "%outfile%"
 echo. >> "%outfile%"
 :: --- end Extract coordinates ---
 
 :: --- begin Append to session log ---
 if defined LAT if defined LON (
     echo [%date% %time%] BSSID: %BSSID% >> "%session_log%"
     echo Latitude: %LAT% >> "%session_log%"
     echo Longitude: %LON% >> "%session_log%"
     echo. >> "%session_log%"
 
     :: Add to success list
     set "FOUND_LIST=%FOUND_LIST% %BSSID%"
 )
 :: --- end Append to session log ---
 
 :: --- begin Append to master log ---
 if defined LAT if defined LON (
     echo [%date% %time%] BSSID: %BSSID% >> "%LOGDIR%\bssidcheck_%session_ts%.log"
     echo Latitude: %LAT% >> "%LOGDIR%\bssidcheck_%session_ts%.log"
     echo Longitude: %LON% >> "%LOGDIR%\bssidcheck_%session_ts%.log"
     echo. >> "%LOGDIR%\bssidcheck_%session_ts%.log"
 )
 :: --- end Append to master log ---
 
 :: --- begin Open in Google Maps ---
 if defined LAT if defined LON start msedge "https://www.google.com/maps/search/?api=1&query=%LAT%,%LON%"
 :: --- end Open in Google Maps ---
 
 goto :eof
 :: End PROCESS ONE BSSID
 
 
 :end
 
 :: --- begin Summary of successful lookups ---
 echo.
 echo ===== Summary of Successful BSSID Lookups =====
 if defined FOUND_LIST (
     echo %FOUND_LIST%
 ) else (
     echo No BSSIDs were successfully located.
 )
 echo ===============================================
 echo.
 :: --- end Summary of successful lookups ---
 
 echo Exiting. Goodbye!
 :: end of C:\app\os\python\apple_bssid_locator\bssidcheck.bat
 
-- 
Never make the mistake of thinking I'm anything like the trolls are.
I am not here for my ego; nor for my amusement; but to teach & learn.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.