diff --git a/.gitignore b/.gitignore index f9606a3..5368713 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /venv +assets/* diff --git a/README.md b/README.md new file mode 100644 index 0000000..90e7b88 --- /dev/null +++ b/README.md @@ -0,0 +1,151 @@ +# iPhone-Linux Transfer Service + +A web-based application for transferring files and links between iPhone and Linux devices with a secure and user-friendly interface. + +## Features +- **Upload and manage links and files:** Upload HTML links, images, and other files from your device. +- **Secure authentication:** User login with salted and hashed password storage for enhanced security. +- **Automatic lockout:** Users are locked out after multiple unsuccessful login attempts. +- **Device identification:** Uploaders are identified by device type and IP address. + +--- + +## Table of Contents +1. [Installation](#installation) +2. [Usage](#usage) +3. [Database Reset](#database-reset) +4. [Security](#security) +5. [Dependencies](#dependencies) +6. [Known Issues](#known-issues) +7. [Contributing](#contributing) +8. [License](#license) + +--- + +## Installation + +### Prerequisites +- Python 3.x +- `pip` (Python package installer) +- `venv` module for creating virtual environments +- Required binaries: `flask`, `sqlite3`, `curl`, `openssl` + +### Automated Installation +1. Clone this repository: + git clone https://github.com/kleinpanic/iphone-linux-transfer.git + cd iphone-linux-transfer + +2. Run the installation script: + ./install.sh + This script will: + - Check for the `venv` module and attempt installation if missing + - Check for required binaries and prompt you to install any that are missing + - Set up a virtual environment and install all Python dependencies + +### Manual Installation +If you'd prefer to install everything manually, follow these steps: + +1. Install Python 3.x and `venv`. +2. Create a virtual environment: + python3 -m venv venv +3. Activate the virtual environment: + - **Linux/Mac:** `source venv/bin/activate` + +4. Install the required Python packages: + pip install -r requirements.txt + +--- + +## Usage +1. **Activate the virtual environment**: + - **Linux/Mac:** `source venv/bin/activate` + +2. **Start the application**: + python app.py + The application will run on `https://127.0.0.1:5000` by default. + +3. **Access the application**: + - Open your browser and go to `https://127.0.0.1:5000`. + +### Available Features +- **Uploading:** Upload links, images, and other files. +- **Downloading:** Download uploaded content. +- **Renaming:** Rename uploaded files. +- **Preview:** Preview uploaded images directly from the app. +- **Delete:** Delete uploaded content. +- Curl: compable with curl ideally. + +--- + +## Database Reset + +To start fresh with a new database setup, you can use the reset script provided: + +1. Ensure your virtual environment is activated: + source venv/bin/activate +2. Run the reset script: + python reset_db.py + This will: + - Remove all existing entries from the database + - Reinitialize the tables for users and uploads + +**Note**: Use this command with caution as it will remove all existing data. + +--- + +## Security + +- Passwords are salted and hashed before being stored. +- After 3 unsuccessful login attempts, users are locked out, and their IP address is recorded in `locked_ips.txt`. +- To unlock a user, manually remove their IP from `locked_ips.txt`. + +--- + +## Dependencies + +This project requires the following: +- **Python Packages** (specified in `requirements.txt`) + - `Flask` + - `Werkzeug` + - Other packages as needed by your project +- **System Binaries** + - `flask` + - `sqlite3` + - `curl` + - `openssl` + +--- + +## Known Issues + +- The application is currently set up for development use. It is not secure for deployment in a production environment. +- Make sure you properly configure your firewall and network settings when using this application on a publicly accessible server. + +--- + +## Contributing + +Contributions are welcome! Please follow these steps to contribute: + +1. **Fork the repository** on GitHub. +2. **Clone your fork**: + git clone https://github.com/yourusername/iphone-linux-transfer.git +3. **Create a new branch** for your feature or bug fix: + git checkout -b feature-name +4. **Make your changes**, commit them, and push to your fork: + git add . + git commit -m "Description of your changes" + git push origin feature-name +5. Open a **Pull Request** on the main repository. + +--- + +## License + +This project is licensed under the MIT License. Do whatever the fuck you want with it. + +--- + +## Support + +For any issues or suggestions, please open an issue on the GitHub repository or contact me directly. diff --git a/assets/IMG_5016.jpeg b/assets/IMG_5016.jpeg deleted file mode 100644 index 3122202..0000000 Binary files a/assets/IMG_5016.jpeg and /dev/null differ diff --git a/assets/IMG_5031.jpeg b/assets/IMG_5031.jpeg deleted file mode 100644 index d3be0ec..0000000 Binary files a/assets/IMG_5031.jpeg and /dev/null differ diff --git a/assets/Imsadspice-2-1.mp4 b/assets/Imsadspice-2-1.mp4 deleted file mode 100644 index 49b8046..0000000 Binary files a/assets/Imsadspice-2-1.mp4 and /dev/null differ diff --git a/assets/erm-what-the-sigma_su7GnzC.mp3 b/assets/erm-what-the-sigma_su7GnzC.mp3 deleted file mode 100644 index 71eb98c..0000000 Binary files a/assets/erm-what-the-sigma_su7GnzC.mp3 and /dev/null differ diff --git a/assets/links.txt b/assets/links.txt deleted file mode 100644 index f213917..0000000 --- a/assets/links.txt +++ /dev/null @@ -1,3 +0,0 @@ -https://chatgpt.com/c/66fc4ce7-44c4-8011-936a-35d53ae12af2 -https://chatgpt.com/c/66fc4ce7-44c4-8011-936a-35d53ae12af2 -Collin: https://10.0.0.235:5000/ diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..4e1f015 --- /dev/null +++ b/install.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Check for venv installation +check_venv() { + if ! command -v python3 -m venv &> /dev/null; then + echo "Python venv is not installed. Attempting to install it..." + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + # Linux + if command -v apt-get &> /dev/null; then + sudo apt-get update + sudo apt-get install python3-venv -y + elif command -v yum &> /dev/null; then + sudo yum install python3-venv -y + else + echo "Unsupported Linux package manager. Please install Python venv manually." + exit 1 + fi + elif [[ "$OSTYPE" == "darwin"* ]]; then + # MacOS + brew install python3 + elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then + # Windows + echo "Please install Python and add it to your PATH manually." + exit 1 + else + echo "Unsupported operating system. Please install Python venv manually." + exit 1 + fi + else + echo "Python venv is already installed." + fi +} + +# Check for required binaries +check_binaries() { + DEPENDENCIES=("flask" "sqlite3" "curl" "openssl") + + echo "Checking for required dependencies..." + for dep in "${DEPENDENCIES[@]}"; do + if ! command -v $dep &> /dev/null; then + echo "$dep is not installed. Please install it." + exit 1 + else + echo "$dep is installed." + fi + done +} + +# Create virtual environment and install requirements +setup_venv() { + echo "Setting up virtual environment..." + python3 -m venv venv + + echo "Activating virtual environment..." + source venv/bin/activate + + if [[ ! -f "requirements.txt" ]]; then + echo "requirements.txt not found!" + deactivate + exit 1 + fi + + echo "Installing dependencies from requirements.txt..." + pip install --upgrade pip + pip install -r requirements.txt + echo "All dependencies installed." + + deactivate +} + +# Run the checks and setup +check_venv +check_binaries +setup_venv + +echo "Installation completed successfully." + diff --git a/server/app.py b/server/app.py index 1d1713f..387a901 100644 --- a/server/app.py +++ b/server/app.py @@ -9,7 +9,7 @@ from zipfile import ZipFile from preview import generate_preview # Import the preview module from rename import rename_file # Import the rename module -app = Flask(__name__, template_folder='../templates') +app = Flask(__name__, template_folder='../templates', static_folder='../static') app.secret_key = os.urandom(24) talisman = Talisman(app, content_security_policy={ 'default-src': ["'self'"], diff --git a/static/login.css b/static/login.css new file mode 100644 index 0000000..4f50b15 --- /dev/null +++ b/static/login.css @@ -0,0 +1,61 @@ +/* Centering the login container */ +body { + background-color: #f0f0f0; /* Light grey background for the whole page */ + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; + font-family: Arial, sans-serif; +} + +/* Styling the container that holds the login form */ +.login-container { + background-color: #fff; /* White background for the login form */ + padding: 30px; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Add a shadow effect */ + width: 300px; + text-align: center; +} + +/* Styling the title */ +.login-container h1 { + margin-bottom: 20px; + font-size: 24px; + color: #333; +} + +/* Styling input fields */ +.login-container input[type="text"], +.login-container input[type="password"] { + width: 100%; /* Full width of container */ + padding: 10px; + margin: 10px 0; + border: 1px solid #ccc; /* Light grey border */ + border-radius: 4px; /* Rounded corners */ + box-sizing: border-box; +} + +/* Styling the login button */ +.login-container button { + background-color: #4CAF50; /* Green background */ + color: white; + padding: 10px; + width: 100%; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 16px; +} + +.login-container button:hover { + background-color: #45a049; /* Darker green on hover */ +} + +/* Responsive design: ensure the form looks good on smaller screens */ +@media (max-width: 400px) { + .login-container { + width: 90%; /* Make container smaller on narrow screens */ + } +} diff --git a/templates/login.html b/templates/login.html index b3cdd55..7517234 100644 --- a/templates/login.html +++ b/templates/login.html @@ -5,17 +5,20 @@ Login + -

Login

-
- - -

- - -

- -
+
+

Login

+
+ + +

+ + +

+ +
+
diff --git a/templates/login.html.bak b/templates/login.html.bak new file mode 100644 index 0000000..b3cdd55 --- /dev/null +++ b/templates/login.html.bak @@ -0,0 +1,21 @@ + + + + + + + Login + + +

Login

+
+ + +

+ + +

+ +
+ + diff --git a/server/app.py.bak b/tests/app.py.bak similarity index 100% rename from server/app.py.bak rename to tests/app.py.bak diff --git a/server/db_setup.py.bak b/tests/db_setup.py.bak similarity index 100% rename from server/db_setup.py.bak rename to tests/db_setup.py.bak