Skip to content

tonimaxx/GatePin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GatePin: Simple Directory Protection Script

Created with love and caffeine by Toni (Jarus Soontornsing) Maxx Dec 10, 2024 — San Ramon, California

GatePin

About GatePin

GatePin is a lightweight, user-friendly script for adding PIN-based protection to your directories. Designed with simplicity and moderate security in mind, GatePin dynamically generates a PIN based on a configurable base value and the current day of the month (PST timezone). It's perfect for protecting non-critical directories from accidental access.

Features

  • Dynamic PIN Generation: Base PIN value + current day of the month.
  • Brute Force Protection: Lockout after multiple failed attempts.
  • File Search: Quickly locate files within the directory.
  • Mobile Responsive Design: Access directories on any device.
  • Customizable UI: Toggle Grid/List views or show/hide buttons like "Copy Path."

Use Cases

  • Prevent accidental access to sensitive directories.
  • Add an extra layer of protection for non-critical web applications.
  • Provide controlled directory access for small projects.

Quick Start

1. Installation

  1. Download the index.php file.
  2. Place it in the directory you want to protect.
  3. Ensure the directory allows PHP execution.

2. Configuration

Open the index.php file and update the configuration section:

// PIN Configuration
$basePinValue = 2900; // Choose a four-digit base PIN value (e.g., 2900, 2000, 4000, 9900).
date_default_timezone_set('America/Los_Angeles'); // Set timezone to PST.

// UI Configuration
$showToggleView = false; // Show/Hide Grid/List view toggle button.
$showCopyPathButton = false; // Show/Hide "Copy Path" button.

// Security Settings
$maxAttempts = 5; // Maximum login attempts before lockout.
$attemptResetTime = 3600; // Lockout duration in seconds.

Example Usage

Scenario: Protecting a Directory

1. Place index.php in your secure_folder/ directory.
2. Set $basePinValue = 2900 in the configuration.
3. Access secure_folder/ in a browser.
4. The PIN for today (e.g., Dec 10) is: 2900 + 10 = 2910.

Features in Detail Dynamic PIN Calculation

  • The PIN is calculated as: PIN = basePinValue + currentDay
  • Example: If basePinValue = 4000 and today is the 15th, the PIN is 4000 + 15 = 4015.

Brute Force Protection

  • Users are locked out after $maxAttempts consecutive failed attempts.
  • Lockout resets after $attemptResetTime seconds.

File Search and Viewing

  • Search for files within the directory using the search bar.
  • Preview .txt and .md files directly in the browser.
  • Download or open other files as usual.

Mobile Responsive Design

  • Optimized for desktops, tablets, and mobile devices.
  • Easily switch between Grid and List views (configurable).

Customization Guide

  1. Changing the Base PIN Value: Modify $basePinValue in the configuration:

    $basePinValue = 30; // New base PIN value.
  2. Enabling/Disabling UI Buttons: Toggle the following options to show/hide UI elements:

    $showToggleView = true; // Enables Grid/List view button.
    $showCopyPathButton = true; // Enables "Copy Path" button.
  3. Adjusting Security Settings: Modify these values for custom lockout rules:

    $maxAttempts = 3; // Allow 3 attempts before lockout.
    $attemptResetTime = 1800; // Lockout duration of 30 minutes.

Example Directory Structure

/secure_folder
    ├── index.php (GatePin Script)
    ├── file1.txt
    ├── file2.md
    ├── subdirectory/

Known Limitations

  • Security: Not suitable for critical or highly sensitive data.
  • Compatibility: Requires PHP 7.4+ and a server that supports PHP.

Contributing Pull requests are welcome! For significant changes, please open an issue to discuss what you'd like to improve.

License This project is licensed under the MIT License.

Contact Questions? Suggestions? Drop me a line: Toni (Jarus) Maxx — x.com/tonimaxx | facebook.com/tonimaxx | medium.com/@tonimaxx | tonimaxx.com | [email protected]

P.S. While I've provided many ways to reach me, email is where I actually check for messages the most. Happy coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages