Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Hackattic Backup Restore Challenge

This project solves the Backup restore challenge from hackattic.com.

Prerequisites

  • Python 3.x
  • Docker and Docker Compose
  • PostgreSQL client tools (psql) - usually included with PostgreSQL installation
  • API token from https://hackattic.com/challenges/backup_restore

Setup Instructions

1. Start PostgreSQL Database with Docker Compose

Start the PostgreSQL database container:

docker-compose up -d

This will:

  • Start a PostgreSQL 10 container
  • Create a database named hackattic
  • Expose PostgreSQL on port 5432
  • Use credentials: postgres/postgres

Wait for the database to be ready (the healthcheck will ensure it's up).

2. Create Python Virtual Environment

Create a virtual environment to isolate project dependencies:

python3 -m venv .venv

3. Activate Virtual Environment

On macOS/Linux:

source .venv/bin/activate

On Windows:

venv\Scripts\activate

4. Install Dependencies

Install the required Python packages:

pip install -r requirements.txt

This will install:

  • psycopg2==2.9.11 (PostgreSQL adapter for Python)

5. Run the Script

Run the solve script with your Hackattic access token:

python solve.py <your_access_token>

The script will:

  1. Fetch the database dump from Hackattic
  2. Decode and decompress the dump
  3. Load it into the PostgreSQL database
  4. Query for SSNs with status 'alive'
  5. Submit the solution to Hackattic

Stopping the Database

When you're done, you can stop the database container:

docker-compose down

To also remove the volume (and all data):

docker-compose down -v

Troubleshooting

  • Database connection errors: Make sure Docker Compose is running and the database is healthy
  • psql not found: Install PostgreSQL client tools or use Docker to run psql commands
  • Permission errors: Ensure Docker has proper permissions to run containers

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages