Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 101 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,101 @@
# GitHub Codespaces ♥️ React

Welcome to your shiny new Codespace running React! We've got everything fired up and running for you to explore React.

You've got a blank canvas to work on from a git perspective as well. There's a single initial commit with the what you're seeing right now - where you go from here is up to you!

Everything you do here is contained within this one codespace. There is no repository on GitHub yet. If and when you’re ready you can click "Publish Branch" and we’ll create your repository and push up your project. If you were just exploring then and have no further need for this code then you can simply delete your codespace and it's gone forever.

This project was bootstrapped for you with [Vite](https://vitejs.dev/).

## Available Scripts

In the project directory, you can run:

### `npm start`

We've already run this for you in the `Codespaces: server` terminal window below. If you need to stop the server for any reason you can just run `npm start` again to bring it back online.

Runs the app in the development mode.\
Open [http://localhost:3000/](http://localhost:3000/) in the built-in Simple Browser (`Cmd/Ctrl + Shift + P > Simple Browser: Show`) to view your running application.

The page will reload automatically when you make changes.\
You may also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

## Learn More

You can learn more in the [Vite documentation](https://vitejs.dev/guide/).

To learn Vitest, a Vite-native testing framework, go to [Vitest documentation](https://vitest.dev/guide/)

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://sambitsahoo.com/blog/vite-code-splitting-that-works.html](https://sambitsahoo.com/blog/vite-code-splitting-that-works.html)

### Analyzing the Bundle Size

This section has moved here: [https://github.com/btd/rollup-plugin-visualizer#rollup-plugin-visualizer](https://github.com/btd/rollup-plugin-visualizer#rollup-plugin-visualizer)

### Making a Progressive Web App

This section has moved here: [https://dev.to/hamdankhan364/simplifying-progressive-web-app-pwa-development-with-vite-a-beginners-guide-38cf](https://dev.to/hamdankhan364/simplifying-progressive-web-app-pwa-development-with-vite-a-beginners-guide-38cf)

### Advanced Configuration

This section has moved here: [https://vitejs.dev/guide/build.html#advanced-base-options](https://vitejs.dev/guide/build.html#advanced-base-options)

### Deployment

This section has moved here: [https://vitejs.dev/guide/build.html](https://vitejs.dev/guide/build.html)

### Troubleshooting

This section has moved here: [https://vitejs.dev/guide/troubleshooting.html](https://vitejs.dev/guide/troubleshooting.html)
# Facebook Security Analyzer CLI

This command-line tool provides utilities to help users analyze Facebook messages for potential phishing attempts and assess Facebook profiles for indicators of fakeness.

## Features

1. **Phishing Message Analysis:**
* Accepts user-provided message text.
* Scans for common phishing keywords (e.g., "verify your account," "urgent security alert").
* Extracts URLs and checks them against patterns of suspicious URLs (e.g., impersonation of legitimate domains, use of URL shorteners, IP address links).
* Provides a "suspicion score" and a summary of findings.

2. **Fake Profile Analysis (Manual Check):**
* Accepts a Facebook profile URL from the user.
* **Important:** This tool *does not* scrape Facebook or automatically access profile data, in compliance with Facebook's policies.
* It guides the user through a manual checklist of common fake profile indicators (e.g., generic profile picture, recent account age, low activity, poor grammar, suspicious requests).
* Includes an interactive helper to guide the user in performing a reverse image search on the profile picture using external services like Google Images or TinEye.
* Calculates a "suspicion score" based on the user's answers and provides an assessment of how likely the profile is to be fake.

## Prerequisites

* Python 3.x

## Installation & Setup

1. **Clone the repository or download the files.**
If you have the files (`main.py` and the `facebook_analyzer` directory) in a single project folder, no complex installation is typically needed.

2. **No external Python libraries are required** for the core functionality as it currently stands (uses only standard libraries like `re` and `webbrowser`). If future enhancements (like direct API calls for URL checking) are added, this section will need updates.

## How to Run

1. Open your terminal or command prompt.
2. Navigate to the directory where you saved the `main.py` file and the `facebook_analyzer` folder.
3. Run the application using the Python interpreter:
```bash
python main.py
```

4. The tool will display a menu:

```
--- Facebook Security Analyzer ---
Choose an option:
1. Analyze a message for phishing
2. Analyze a Facebook profile for fakeness (manual check)
3. Exit
------------------------------------
Enter your choice (1-3):
```

## Usage

### 1. Analyze a message for phishing

* Select option `1`.
* When prompted, paste the full text of the suspicious message and press Enter.
* The tool will output:
* A phishing likelihood score (higher is more suspicious).
* Any suspicious keywords found.
* Any suspicious URLs found, along with the reason they were flagged.
* An overall summary.

### 2. Analyze a Facebook profile for fakeness (manual check)

* Select option `2`.
* When prompted, enter the full Facebook profile URL (e.g., `https://www.facebook.com/some.profile`).
* The tool will open the profile URL in your default web browser for your manual inspection.
* You will then be guided through a series of yes/no questions based on your observations of the profile.
* This includes an optional guided step to perform a reverse image search on the profile's picture.
* After you answer all questions, the tool will provide:
* A list of fake profile indicators you noted.
* An overall "suspicion score."
* An assessment category (e.g., Low, Medium, High likelihood of being fake).

## Disclaimer

* This tool provides heuristic-based analysis and guidance. It is **not foolproof** and should not be considered a definitive judgment on whether a message is phishing or a profile is fake.
* **Phishing Detection:** The tool uses a predefined list of keywords and URL patterns. Sophisticated phishing attempts may evade these checks. Always exercise extreme caution with suspicious messages, especially those asking for login credentials or personal information. Do not rely solely on this tool.
* **Fake Profile Detection:** The analysis is based *entirely* on your manual observations and answers. False positives and negatives are possible. Always use your best judgment when interacting with profiles online.
* **Facebook's Terms of Service:** This tool is designed to operate without violating Facebook's Terms of Service by not scraping or automatically collecting data from its platform. The fake profile analysis relies on user-driven manual checks.
* **Reporting:** If you encounter a phishing attempt or a malicious fake profile, report it directly to Facebook through their official reporting channels.

## File Structure
```
.
├── main.py # Main CLI application script
├── facebook_analyzer/
│ ├── __init__.py # Makes facebook_analyzer a Python package
│ ├── phishing_detector.py # Logic for phishing message analysis
│ └── fake_profile_detector.py # Logic for fake profile interactive checklist
└── README.md # This documentation file
```

## Future Enhancements (Potential)

* Integration with external URL checking services/APIs (e.g., Google Safe Browsing) for more robust phishing detection.
* More sophisticated text analysis for phishing detection (e.g., NLP techniques).
* Allowing users to customize keyword lists.
* A graphical user interface (GUI) instead of a CLI.
```
138 changes: 138 additions & 0 deletions README_iot_simulator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Generic IoT Data Simulator

This Python CLI tool simulates various types of IoT sensor data and sends it to configurable endpoints (console or HTTP POST). It's designed to help developers test IoT backends, data ingestion pipelines, dashboards, and other components without needing physical hardware.

## Features

* **Multiple Sensor Types:** Simulate data for:
* Temperature (°C)
* Humidity (%)
* GPS Location (latitude, longitude - with random walk)
* Boolean Status (e.g., on/off, open/closed)
* Incrementing Counter
* **Configurable Device Profiles:** Define multiple simulated devices, each with its own set of sensors. Device IDs can be specified or auto-generated.
* **Flexible Output:**
* **Console:** Print generated data as structured JSON to the standard output.
* **HTTP POST:** Send data as a JSON payload to a specified HTTP(S) endpoint.
* **Customizable Simulation:**
* Control the interval between messages.
* Set the total number of messages to send (or run indefinitely).
* **Standardized Data Format:** Output includes `deviceId`, `timestamp` (ISO 8601 UTC), and sensor readings.
* **Stateful Sensors:** GPS coordinates evolve with a random walk, and counters increment per device.

## Prerequisites

* Python 3.6+
* `requests` library (for HTTP output).

## Installation

1. **Clone the repository or download the files.**
Ensure you have `iot_sim_main.py`, the `iot_simulator` directory (containing `generators.py`, `publishers.py`, `__init__.py`), and the `iot_simulator_requirements.txt` file.

2. **Create a virtual environment (recommended):**
```bash
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```

3. **Install dependencies:**
Navigate to the directory containing `iot_simulator_requirements.txt` and run:
```bash
pip install -r iot_simulator_requirements.txt
```

## Usage

The tool is run from the command line using `python3 iot_sim_main.py`.

### Command-Line Arguments

* `-p, --profiles PROFILES [PROFILES ...]`: **(Required)**
* Defines one or more device profiles.
* Each profile can be a string in the format `"device_id:sensor1,sensor2,..."`.
* If `device_id:` is omitted (e.g., `"sensor1,sensor2"`), a unique device ID will be auto-generated.
* Alternatively, you can provide a single argument which is a JSON string representing a list of profiles: `'[{"id":"dev1","sensors":["temp","hum"]}, {"id":"dev2","sensors":["gps"]}]'`
* **Supported sensor types:** `temperature`, `humidity`, `gps`, `status`, `counter`.
* `-i, --interval INTERVAL`: (Optional) Interval in seconds between sending message batches (default: 5.0 seconds).
* `-n, --num_messages NUM_MESSAGES`: (Optional) Number of message batches to send. A batch includes data from all defined profiles. Set to `0` for an infinite simulation (stop with Ctrl+C) (default: 10).
* `-o, --output {console,http}`: (Optional) Output target. Defaults to `console`.
* `--http_url HTTP_URL`: (Optional) Target URL for HTTP POST output. **Required if `--output=http` is chosen.**
* `-h, --help`: Show help message and exit.

### JSON Payload Format

The data is sent/printed as a JSON object with the following structure:
```json
{
"deviceId": "your_device_id",
"timestamp": "YYYY-MM-DDTHH:MM:SS.ffffffZ", // ISO 8601 UTC
// Sensor fields appear here based on profile
"temperature_celsius": 23.7,
"humidity_percent": 45.8,
"location": {
"latitude": 34.052200,
"longitude": -118.243700
},
"active_status": true,
"event_count": 123
}
```
*Note: Not all sensor fields will be present in every message; only those configured for the specific device profile.*

### Examples

1. **Simulate one device with temperature and humidity, output to console (10 messages, 5s interval):**
```bash
python3 iot_sim_main.py --profiles "device001:temperature,humidity"
```

2. **Simulate two devices, 5 messages, 2s interval, output to console:**
```bash
python3 iot_sim_main.py \
--profiles "thermostat1:temperature" "gps_tracker:gps,counter" \
--num_messages 5 \
--interval 2
```

3. **Simulate one device (auto-generated ID) with all sensor types, run indefinitely, output to console every 10s:**
```bash
python3 iot_sim_main.py \
--profiles "temperature,humidity,gps,status,counter" \
--num_messages 0 \
--interval 10
```

4. **Simulate devices defined in a JSON string, output to an HTTP endpoint:**
```bash
python3 iot_sim_main.py \
--profiles '[{"id":"factory_sensor_A","sensors":["temperature","counter"]},{"id":"asset_tracker_B","sensors":["gps"]}]' \
--output http \
--http_url "http://localhost:8080/api/data" \
--interval 2 \
--num_messages 100
```
*(Ensure you have an HTTP server listening at the specified `--http_url` if testing HTTP output.)*

## File Structure
```
.
├── iot_simulator/
│ ├── __init__.py # Makes 'iot_simulator' a Python package
│ ├── generators.py # Logic for generating sensor data
│ └── publishers.py # Logic for formatting and sending data (console, HTTP)
├── iot_sim_main.py # CLI entry point and main simulation loop
├── iot_simulator_requirements.txt # Python dependencies (requests)
└── README_iot_simulator.md # This documentation file
```

## Sensor Details

* **temperature:** Random float, default range -10.0 to 40.0 °C. Output key: `temperature_celsius`.
* **humidity:** Random float, default range 20.0 to 80.0 %. Output key: `humidity_percent`.
* **gps:** Simulates GPS coordinates (latitude, longitude) starting from a base point and performing a small random walk with each update. Output key: `location` (an object with `latitude` and `longitude`).
* **status:** Random boolean (True/False). Output key: `active_status`.
* **counter:** Integer that increments by 1 for each message from that specific device. Output key: `event_count`.

Sensor data generation (ranges, GPS step) is defined in `iot_simulator/generators.py` and can be customized there if needed.
```
Loading
Loading