Skip to content

Commit

Permalink
Major improvements and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jbjulia committed Jul 15, 2023
1 parent e6885dc commit 439b337
Show file tree
Hide file tree
Showing 5 changed files with 3,012 additions and 188 deletions.
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,55 @@

## Project Description

WiGLE Network Data Retriever is a Python script for querying and retrieving wireless network information within specified geographic areas from the WiGLE database. The WiGLE platform aggregates information on wireless networks (Wi-Fi, cell, Bluetooth) across the globe and provides this data through their API. This script makes use of the WiGLE API to fetch data about wireless networks in specified locations and presents it in both a human-readable table format and a CSV file.
WiGLE Network Data Retriever is a Python script for querying and retrieving wireless network information within specified geographic areas from the WiGLE database. The WiGLE platform aggregates information on wireless networks (Wi-Fi, Cellular, Bluetooth) across the globe and provides this data through their API. This script makes use of the WiGLE API to fetch data about wireless networks in specific latitude and longitude ranges and stores this data in a CSV file for further analysis.

## Features

- Retrieve wireless network information (such as SSIDs, MAC addresses, signal strength, and geographic coordinates) within specified latitude and longitude ranges.
- Support for querying multiple predefined locations by passing location-specific arguments.
- Handles API rate limiting and pagination to retrieve large datasets.
- Cleans data to remove non-printable characters.
- Outputs the results in a well-formatted table for display in the console.
- Supports input validation for geographic coordinates and API tokens.
- Safely handles interruptions during data retrieval, ensuring that retrieved data is not lost.
- Outputs the progress of data retrieval in the console.
- Saves the retrieved data to a CSV file for further analysis or processing.
- Ensures that no empty CSV file is saved if no results are retrieved.
- CSV file names are timestamped for easy identification of different data retrieval sessions.
- Manages error scenarios during the request phase including timeouts, redirects, and unauthorized access, providing relevant feedback.

## Usage

1. Clone the repository to your local machine.
2. Make sure you have Python 3.x installed. Also, install the required libraries by running `pip install -r requirements.txt`.
3. Set the environment variable `WIGLE_API_TOKEN` with your WiGLE API token, or you can pass it as a command line argument using `-api_token`.
4. Run the script and pass the desired location as an argument. For example, for retrieving data for "city", use:
3. Run the script. When prompted, enter the desired latitude and longitude ranges and your WiGLE API token.

```sh
python wigle.py -location "name"
python wigle.py
```
Optionally, you can pass your API token through the command line like this:

For instance, if you want to collect data in the geographic region defined by the latitude range 47.2 to 47.3 and the longitude range -122.5 to -122.4, and your API token is `YOUR_API_TOKEN`, you would do:

```sh
python wigle.py -location "name" -api_token YOUR_API_TOKEN
python wigle.py
Enter lower latitude: 47.2
Enter upper latitude: 47.3
Enter lower longitude: -122.5
Enter upper longitude: -122.4
Enter your API token: YOUR_API_TOKEN
```

The script will then start retrieving data and save it to a CSV file in the `tests` folder. The file will be named according to the first latitude and longitude in your range, along with the current timestamp.

You can stop the script at any time by pressing `Ctrl+C`. The script will save the data retrieved so far to the CSV file.

## Dependencies

- Python 3.x
- requests
- pandas
- prettytable

## Limitations

- The script is subject to the limitations and quotas of the WiGLE API. Ensure you understand these before running the script extensively.
- The script currently supports only three predefined locations. Custom locations can be added by modifying the script.
- The retrieval process can take a long time if the specified geographic range is large.
- There is a maximum of 3 retries for the failed requests.

## Disclaimer

Expand All @@ -47,4 +59,4 @@ Please note that accessing or collecting data from wireless networks might have
## Authors

[Joseph Julian](https://github.com/jbjulia)
[D14b0l1c](https://github.com/D14b0l1c)
[D14b0l1c](https://github.com/D14b0l1c)
2 changes: 1 addition & 1 deletion cellular.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# TODO: Create cellular API version
# TODO: Create Cellular API version
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pandas~=2.0.2
requests==2.31.0
prettytable==3.8.0
requests==2.31.0
Loading

0 comments on commit 439b337

Please sign in to comment.