diff --git a/.gitignore b/.gitignore index c9aac04..a174887 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -.env -resources +.env +resources diff --git a/LICENSE b/LICENSE index 08c7dff..d82581f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,22 +1,22 @@ - -MIT License - -Copyright (c) 2022 Blue Cosmo - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + +MIT License + +Copyright (c) 2022 Blue Cosmo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 633e3e8..c42c192 100644 --- a/README.md +++ b/README.md @@ -1,133 +1,289 @@ - - - -[ccs]: https://cosmodiumcs.com -[youtube]: https://www.youtube.com/c/CosmodiumCS -[supervision]: https://marks.cosmodiumcs.com/marks/mk14-supervision/ - - -# SuperVision -> Blue Cosmo | 07/02/22 - ---- - - -``` - .::::::. ... :::::::::::::. .,:::::: :::::::.. - ;;;` ` ;; ;;; `;;;```.;;;;;;;'''' ;;;;``;;;; - '[==/[[[[,[[' [[[ `]]nnn]]' [[cccc [[[,/[[[' - ''' $$$ $$$ $$$"" $$"""" $$$$$$c - 88b dP88 .d888 888o 888oo,__ 888b "88bo, - "YMmMY" "YmmMMMM"" YMMMb """"YUMMMMMMM "W" - :~?J555J?~: - ::: .::.::: .::::::. ::: .~YG&@B5J?J5B@&GY~. :::. :::. - ';;, ,;;;' ;;;;;;` ` ;;; :JB@@@B~.~?J7~.~B@@@BJ: `;;;;, `;;; - \[[ .[[/ [[['[==/[[[[,[[[ .5&@@@@&: P@@G^PP :&@@@@&5 [[[[[. '[[ - Y$c.$$" $$$ ''' $$$$ .5&@@@@&: P@@@&@P :&@@@@&5. $$$ "Y$c$$ - Y88P 888 88b dP888 :JB@@@B~.~?YJ~.~B@@@BJ: 888 Y88 - MP MMM "YMmMY" MMM .~YB&@B5J?J5B@&BY~. MMM YM - :~?J555J?~: -``` - - -## Disclaimer: -SuperVision serves to aid security research and become a reminder of the level of government surveillance that exists today. SuperVision got all its shit from a lot of googling, I did this in my spare time, I can only imagine the level of automated surveillance the government is capable of. - -Also note that Supervision is rendering a lot of data, so **it may take a fair bit of time to render the map** [no more than 20-30 secs]. - - -## Overview: -[SuperVision][supervision] is an open source *"Google Maps"* for hackers developed by [CosmodiumCS][ccs]. SuperVision's map centralizes public data and maps it. Allowing you to see traffic cameras, transportation, and other data systems **in live time**. It is developed with a type of hacking called "Public Data Hacking" [PDH]. This is basically the process in which you exploit data thats publically available. Whats cool about PDH is that its completely legal, because the data we exploit is already publically available. So by the magical powers of Python, JavaScript, and several markup languages, we generate a powerful map that is ready to use whenever you need! - ---- - - - - ---- - - -**How It Works:** - -SuperVision works by using Python to generate Keyhole Markup Language [KML] files. KML files are used to map geographic data. There is a [KML](https://github.com/CosmodiumCS/SuperVision/tree/main/kml) directory that contains all of the generated KML files used in this project. **These files CAN be imported into Google Earth** and you will be able to view all of the markers showing the cameras and other public data that SuperVision has mapped. But Google Earth has two problems... - -1. Google Earth is **NOT** open source -2. Google Earth only maps data statically - -SuperVision's open source magic allows us to do so much more than what propriatary software limited us to. SuperVision has not only mapped thing like cameras, but it can track live data like the locations of public transportation. We can fully customize the tracking of public data to the fullest extent possible [with a lot of debugging of course XP]. - ---- - - -[](https://www.youtube.com/watch?v=knagAWTn7FQ "SuperVision : The Hacker Google Mapper") - ---- - -Watch the first devlog for SuperVision now!! It will give you an update on what the project is and how it was built in the best way possible :D - - -## Resources: -- [SuperVision][supervision] -- [YouTube Video](https://youtu.be/knagAWTn7FQ) -- [YouTube Channel][youtube] -- [Website][ccs] - - -## Requirements: -- A Modern Web Browser - - i.e [Chrome, Firefox, Opera, Safari] -- An Internet Connection - - -## Local Hosting -**SuperVision does have a website [here][supervision]** but if you wish to run it locally you can clone the repository and run the [main.py](https://github.com/CosmodiumCS/SuperVision/blob/main/main.py) file. You then can navigate to `127.0.0.1:5000` in your browser to view the map. - - -## What Can SuperVision Track? - -### Cameras - ---- - - - - ---- - -SuperVision is capable of plotting traffic, security, and other cameras on its map. The above is a photo of a traffic camera showing developer [Blue Cosmo][ccs] at an intersection. This shows the vast amount of possible surveillance with a tool as simple as this. - -### Vehicles - ---- - - - - ---- - -SuperVision is capable of plotting live data. Above we can see the current positions of buses in chicago. Every 10 seconds SuperVision will update any data that it has plotted live for a more consistent flow of where certain live data is on the map. - -### Aircraft - ---- - - - - ---- - -SuperVision plots the positions of aircraft in live time. Every 10 seconds, SuperVision updates their positions and displays their country of origin in a popup [when hovered]. - - -## Data Policy -- SuperVision **only** asks for your device's approximate location. If you say yes it will display the available data closest to you. If you say no, it will display all the full map. -- SuperVision **does not** collect any user data...read the code - - -## Credits -The original concept comes from an old friend of mine, Shepherd. He had the idea to map specific camera locations to kml files and map them on Google Earth. I joined the project and discovered methods of automatically mapping data instead of doing such a thing manually. But after a falling out I took the project to the next step by creating a dynamic mapping environment outside of Google Earth. This has allowed me to map not only all the cameras simultaneously, but also to map live data in real time. - ---- - - -Β© 2022 by Cosmodium CyberSecurity, LLC +# MK14-SuperVision + +> An open-source mapping platform for visualizing public surveillance cameras and transit data in real-time + +[](https://www.python.org/) +[](https://flask.palletsprojects.com/) +[](LICENSE) + +--- + +## π Table of Contents + +- [Overview](#overview) +- [Features](#features) +- [Disclaimer](#disclaimer) +- [Installation](#installation) +- [Usage](#usage) +- [Configuration](#configuration) +- [Project Structure](#project-structure) +- [What Can SuperVision Track?](#what-can-supervision-track) +- [Data Policy](#data-policy) +- [Contributors](#contributors) +- [License](#license) + +--- + +## π― Overview + +**MK14-SuperVision** is an open-source web application that centralizes and visualizes publicly available surveillance data on an interactive map. Built using Flask and Leaflet.js, it demonstrates the concept of "Public Data Hacking" (PDH) - exploiting publicly available data sources to create powerful visualization tools. + +The application maps: +- Traffic and security cameras from various locations +- Live transit vehicle positions (buses, trains, etc.) +- Other publicly available geographic data + +All data sources are **legally obtained** from public APIs and open data repositories. + +--- + +## β¨ Features + +- πΊοΈ **Interactive Map Interface** - Powered by Leaflet.js with multiple tile layer options +- πΉ **Camera Visualization** - Plot traffic and security cameras from multiple regions +- π **Live Transit Tracking** - Real-time vehicle positions (currently using test data) +- π **Auto-refresh** - Automatic updates every 30 seconds for live data +- π± **Responsive Design** - Works on desktop and mobile browsers +- π¨ **Customizable Layers** - Toggle between different map styles and data layers +- π **Marker Clustering** - Efficiently display large numbers of markers + +--- + +## β οΈ Disclaimer + +SuperVision serves to aid security research and demonstrate the level of government surveillance that exists today. This project was created for educational purposes and to raise awareness about publicly available surveillance data. + +**Note:** The map may take 20-30 seconds to fully render due to the large amount of data being processed. + +--- + +## π Installation + +### Prerequisites + +- Python 3.9 or higher +- pip (Python package manager) +- A modern web browser (Chrome, Firefox, Safari, Edge) + +### Step 1: Clone the Repository + +```bash +git clone https://github.com/CosmodiumCS/MK14-SuperVision.git +cd MK14-SuperVision +``` + +### Step 2: Install Dependencies + +```bash +pip install -r requirements.txt +``` + +### Step 3: Set Up Environment Variables (Optional) + +Create a `.env` file in the project root for API keys (if needed): + +```env +CTA_KEY=your_cta_api_key_here +``` + +--- + +## π» Usage + +### Running the Application + +1. **Start the Flask server:** + +```bash +python mk14.py +``` + +2. **Open your browser and navigate to:** + +``` +http://localhost:5000/mk14/ +``` + +The application will start in debug mode, showing detailed error messages if any issues occur. + +### Accessing the API + +The transit API endpoint is available at: + +``` +http://localhost:5000/mk14/api/transit +``` + +This returns JSON data with vehicle positions (currently using test data). + +--- + +## βοΈ Configuration + +### Adding Camera Data + +Camera data files are stored in the `static/cameras/` directory. The application supports: + +- **JSON files** (`.json`) - Simple coordinate-based camera data +- **GeoJSON files** (`.geojson`) - Standard geographic data format + +Example camera files are included: +- `alberta.json` +- `london.geojson` +- `maryland.json` +- `nothern-ireland.geojson` +- `toronto.json` +- `virginia.geojson` + +### Enabling CTA Transit Data + +To enable real Chicago Transit Authority (CTA) bus tracking: + +1. Obtain a CTA API key from [CTA Bus Tracker](http://www.ctabustracker.com/bustime/home.jsp) +2. Add it to your `.env` file as `CTA_KEY` +3. Uncomment the CTA API code in `mk14.py` (lines 44-88) +4. Comment out the test data section (lines 46-51) + +--- + +## π Project Structure + +``` +MK14-SuperVision/ +βββ mk14.py # Main Flask application +βββ requirements.txt # Python dependencies +βββ .env # Environment variables (create this) +βββ templates/ +β βββ index.html # Main web interface +βββ static/ +β βββ cameras/ # Camera data files (JSON/GeoJSON) +β βββ css/ # Stylesheets +β βββ js/ # JavaScript files +β βββ assets/ # Images and icons +βββ assets/ # Project assets +βββ README.md # This file +βββ LICENSE # License information +``` + +--- + +## π― What Can SuperVision Track? + +### πΉ Cameras + +SuperVision plots traffic, security, and surveillance cameras from various public data sources. Camera locations are displayed as markers on the map, and clicking them provides links to live camera feeds where available. + +Supported regions include: +- Alberta, Canada +- London, UK +- Maryland, USA +- Northern Ireland +- Toronto, Canada +- Virginia, USA + +### π Transit Vehicles + +The application can track live transit vehicle positions. Currently, the CTA (Chicago Transit Authority) integration is available but commented out. When enabled, it will: + +- Fetch all active bus routes +- Display real-time bus positions +- Update every 30 seconds automatically + +### π’ Other Vehicles + +The framework supports tracking various vehicle types: +- Buses +- Trains +- Boats +- Aircraft (framework ready) + +--- + +## π Data Policy + +- **Location Data**: SuperVision may request your device's approximate location to show nearby data. This is optional and handled by your browser. +- **User Data Collection**: SuperVision **does not** collect, store, or transmit any user data. All code is open-source and can be audited. +- **Public Data Only**: All data sources are publicly available APIs and open data repositories. + +--- + +## π οΈ Development + +### Debug Mode + +The application runs in debug mode by default. To disable it, modify `mk14.py`: + +```python +app.run(debug=False, host='0.0.0.0', port=5000) +``` + +### Adding New Data Sources + +1. Add camera data files to `static/cameras/` +2. The application automatically detects and loads `.json` and `.geojson` files +3. For transit data, add new API endpoints in `mk14.py` + +### Customizing the Map + +Edit `templates/index.html` to: +- Change map tile layers +- Modify marker icons +- Adjust update intervals +- Customize clustering behavior + +--- + +## π₯ Contributors + +### Main Contributors + +- **Original Concept**: Shepherd +- **Original Development**: [Blue Cosmo](https://github.com/CosmodiumCS) / CosmodiumCS +- **Modified & Fixed Version**: [h9zdev](https://github.com/h9zdev) + +### Project History + +The original concept involved manually mapping camera locations to KML files for Google Earth. This project evolved that idea into a dynamic, open-source web application capable of mapping multiple data sources simultaneously and displaying live data in real-time. + +The current version has been modified and fixed by [h9zdev](https://github.com/h9zdev) to improve cross-platform compatibility, fix template rendering issues, and enhance error handling for better stability on Windows and other operating systems. + +--- + +## π License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +--- + +## π Resources + +- [CosmodiumCS Website](https://cosmodiumcs.com) +- [YouTube Channel](https://www.youtube.com/c/CosmodiumCS) +- [Flask Documentation](https://flask.palletsprojects.com/) +- [Leaflet.js Documentation](https://leafletjs.com/) + +--- + +## π€ Contributing + +Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change. + +### How to Contribute + +1. Fork the repository +2. Create a feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add some amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request + +### Contributors + +We appreciate all contributions! See the [Contributors](#contributors) section above for the main contributors to this project. + +--- + +**Β© 2022-2024 by Cosmodium CyberSecurity, LLC** + +--- + +*Built with β€οΈ for security research and public awareness* diff --git a/mk14.py b/mk14.py index 2106b9f..8c9d24e 100644 --- a/mk14.py +++ b/mk14.py @@ -1,84 +1,92 @@ -#!/bin/python3 -# MK14-SuperVision -# created by : bluecosmo - -# imports -import os -import random -import requests -import xmltodict -from dotenv import load_dotenv -from flask import Flask, render_template, jsonify - -# environment variables -load_dotenv() -CTA_KEY = os.getenv('CTA_KEY') - -app = Flask(__name__, static_folder='static', static_url_path='/mk14/static') -app.config['APPLICATION_ROOT'] = '/mk14' - -def list_files(directory): - files = [] - for filename in os.listdir(directory): - path = os.path.join(directory, filename) - if os.path.isfile(path): - files.append(filename) - return files - -# main page -@app.route('/mk14/') -def mk14(): - camera_list = list_files('/var/www/html/mk14-supervision/static/cameras') - return render_template('index.html', camera_locations=camera_list) - -@app.route('/mk14/api/transit') -def transit(): - - # randomly generated cameras for testing / debugging - cameras = [ - {'lat': 51.5074 + random.uniform(-0.1, 0.1), 'lon': -0.1278 + random.uniform(-0.1, 0.1), 'popup': 'Camera 1'}, - {'lat': 51.5074 + random.uniform(-0.1, 0.1), 'lon': -0.1278 + random.uniform(-0.1, 0.1), 'popup': 'Camera 2'}, - ] - return jsonify(cameras) - - # cta_routes_url = f'http://www.ctabustracker.com/bustime/api/v2/getroutes?key={CTA_KEY}' - # cta_bus_url = f'http://ctabustracker.com/bustime/api/v2/getvehicles?key={CTA_KEY}&rt=' - # vehicles_info = [] - - # try: - # response = requests.get(cta_routes_url) - # response.raise_for_status() # Raise an exception for bad responses - - # xml_dict = xmltodict.parse(response.content) - # rt_numbers = [str(route['rt']) for route in xml_dict.get('bustime-response', {}).get('route', [])] - - # for route in rt_numbers: - # bus_url = cta_bus_url + str(route) - # cta_bus = requests.get(bus_url) - # cta_bus_json = xmltodict.parse(cta_bus.content) - - # # works up to here :) - # vehicles = cta_bus_json.get('bustime-response', {}).get('vehicle', []) - # if isinstance(vehicles, dict): - # vehicles = [vehicles] - - # for vehicle in vehicles: - # vid = int(vehicle.get('vid')) - # lat = float(vehicle.get('lat')) - # lon = float(vehicle.get('lon')) - # vehicles_info.append({'vid': vid, 'lat': lat, 'lon': lon}) - - # return jsonify(vehicles_info) - - # except requests.exceptions.RequestException as e: - # # Handle request exceptions (e.g., connection error, timeout) - # return jsonify({'error': str(e)}), 500 # Return an error response with HTTP status code 500 - - # except xmltodict.expat.ExpatError as e: - # # Handle XML parsing errors - # return jsonify({'error': 'Error parsing XML: ' + str(e)}), 500 # Return an error response with HTTP status code 500 - -# main code, run app -if __name__ == '__main__': - # app.run(debug=True) - app.run(host='0.0.0.0', port=5000) +#!/bin/python3 +# MK14-SuperVision +# created by : bluecosmo + +# imports +import os +import random +import requests +import xmltodict +from dotenv import load_dotenv +from flask import Flask, render_template, jsonify + +# environment variables +load_dotenv() +CTA_KEY = os.getenv('CTA_KEY') + +app = Flask(__name__, static_folder='static', static_url_path='/mk14/static') +app.config['APPLICATION_ROOT'] = '/mk14' + +def list_files(directory): + files = [] + if not os.path.exists(directory): + return files # Return empty list if directory doesn't exist + try: + for filename in os.listdir(directory): + path = os.path.join(directory, filename) + if os.path.isfile(path): + files.append(filename) + except OSError as e: + print(f"Error reading directory {directory}: {e}") + return files + return files + +# main page +@app.route('/mk14/') +def mk14(): + # Get the directory where this script is located + base_dir = os.path.dirname(os.path.abspath(__file__)) + cameras_dir = os.path.join(base_dir, 'static', 'cameras') + camera_list = list_files(cameras_dir) + return render_template('index.html', camera_locations=camera_list) + +@app.route('/mk14/api/transit') +def transit(): + + # randomly generated cameras for testing / debugging + cameras = [ + {'lat': 51.5074 + random.uniform(-0.1, 0.1), 'lon': -0.1278 + random.uniform(-0.1, 0.1), 'popup': 'Camera 1'}, + {'lat': 51.5074 + random.uniform(-0.1, 0.1), 'lon': -0.1278 + random.uniform(-0.1, 0.1), 'popup': 'Camera 2'}, + ] + return jsonify(cameras) + + # cta_routes_url = f'http://www.ctabustracker.com/bustime/api/v2/getroutes?key={CTA_KEY}' + # cta_bus_url = f'http://ctabustracker.com/bustime/api/v2/getvehicles?key={CTA_KEY}&rt=' + # vehicles_info = [] + + # try: + # response = requests.get(cta_routes_url) + # response.raise_for_status() # Raise an exception for bad responses + + # xml_dict = xmltodict.parse(response.content) + # rt_numbers = [str(route['rt']) for route in xml_dict.get('bustime-response', {}).get('route', [])] + + # for route in rt_numbers: + # bus_url = cta_bus_url + str(route) + # cta_bus = requests.get(bus_url) + # cta_bus_json = xmltodict.parse(cta_bus.content) + + # # works up to here :) + # vehicles = cta_bus_json.get('bustime-response', {}).get('vehicle', []) + # if isinstance(vehicles, dict): + # vehicles = [vehicles] + + # for vehicle in vehicles: + # vid = int(vehicle.get('vid')) + # lat = float(vehicle.get('lat')) + # lon = float(vehicle.get('lon')) + # vehicles_info.append({'vid': vid, 'lat': lat, 'lon': lon}) + + # return jsonify(vehicles_info) + + # except requests.exceptions.RequestException as e: + # # Handle request exceptions (e.g., connection error, timeout) + # return jsonify({'error': str(e)}), 500 # Return an error response with HTTP status code 500 + + # except xmltodict.expat.ExpatError as e: + # # Handle XML parsing errors + # return jsonify({'error': 'Error parsing XML: ' + str(e)}), 500 # Return an error response with HTTP status code 500 + +# main code, run app +if __name__ == '__main__': + app.run(debug=True, host='0.0.0.0', port=5000) diff --git a/requirements.txt b/requirements.txt index b40fdc6..913f28b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,14 @@ -blinker==1.7.0 -certifi==2023.11.17 -charset-normalizer==3.3.2 -click==8.1.7 -Flask==3.0.0 -idna==3.6 -itsdangerous==2.1.2 -Jinja2==3.1.2 -MarkupSafe==2.1.3 -python-dotenv==1.0.0 -requests==2.31.0 -urllib3==2.1.0 -Werkzeug==3.0.1 -xmltodict==0.13.0 +blinker==1.7.0 +certifi==2023.11.17 +charset-normalizer==3.3.2 +click==8.1.7 +Flask==3.0.0 +idna==3.6 +itsdangerous==2.1.2 +Jinja2==3.1.2 +MarkupSafe==2.1.3 +python-dotenv==1.0.0 +requests==2.31.0 +urllib3==2.1.0 +Werkzeug==3.0.1 +xmltodict==0.13.0 diff --git a/templates/index.html b/templates/index.html index 35b6a0b..450aeb2 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,189 +1,192 @@ - - - - - - - - -
- - -