Skip to content

PCF Archive Cleaner is a Rust-based utility designed to automatically delete archived projects from the Pentest Collaboration Framework (PCF). This tool is specifically tailored for version 1.5.0 of PCF and aims to assist cybersecurity professionals in managing data protection requirements.

License

Notifications You must be signed in to change notification settings

evait-security/pcf_archive_cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PCF Archive Cleaner

Description

PCF Archive Cleaner is a Rust-based utility designed to automatically delete archived and deleted projects from the Pentest Collaboration Framework (PCF). This tool is specifically tailored for version 1.5.0 of PCF and aims to assist cybersecurity professionals in managing data protection requirements.

Key Features

Install

  • Download the File
    • wget https://github.com/evait-security/pcf_archive_cleaner/releases/download/linux_x64/pcf_archive_cleaner
  • Downlaod the config file vor version PCF 1.5.0
    • wget https://github.com/evait-security/pcf_archive_cleaner/releases/tag/config-v1.5.0
  • chmod +x pcf_archive_cleaner
  • ./pcf_archive_cleaner <<Path_to_PCF_Folder>>

The log and config file

The config file config.yaml will be in the same folder as the pcf_archive_cleaner. The log file pcf_del_archive.log will be in the same folder as the pcf_archive_cleaner and the config.yaml files are.

Database Schema Validation

The PCF Archive Cleaner implements a robust database schema validation mechanism using SHA-256 hashing. This feature ensures that the cleaning operation only runs on a compatible database structure, preventing potential data corruption or inconsistent deletions.

How Schema Validation Works

  1. The tool generates a unique hash for each database table and its structure:

    • Each column's hash is calculated using its name and type
    • Table hashes are created by combining the table name with all its column hashes
    • A final schema hash is generated by combining all table hashes
  2. The expected schema hash is stored in the config.yaml file under the DataBase file_paths entry:

    file_paths:
      DataBase:
        path: configuration/database.sqlite3
        hash: 55a956d201415f44e3577887d894e2481958441352ab50d03c2ddb3216f9410f
  3. Before performing any operations, the cleaner:

    • Calculates the current database schema hash
    • Compares it with the expected hash from the configuration
    • Proceeds only if the hashes match
    • Logs an error and exits if there's a mismatch

Updating the Schema Hash

When upgrading PCF or making changes to the database structure:

  1. Run the cleaner once - it will log the new schema hash
  2. Update the config.yaml with the new hash value

This ensures safe operation across database schema updates.

The cron job

  • Open the crontab file
    crontab -e
  • Add the following line to run the script daily at midnight
    0 0 * * * /path/to/pcf_archive_cleaner/pcf_archive_cleaner /path/to/pcf/folder

Automated Cleaning

Runs as a cron job on the server, automatically cleaning archived projects.

Configurable

Uses a YAML configuration file, allowing easy updates to database structure and file deletion patterns without recompiling.

Comprehensive Deletion

Removes data from multiple related tables and associated files. Logging: Maintains detailed logs of all operations for auditing purposes.

Configuration

The tool uses a config.yaml file to define the database structure and file paths. It supports a hierarchical workflow structure, allowing for the deletion of related data across multiple tables. The configuration includes:

  • Database tables and their relationships
  • Columns to query for deletion
  • File paths for associated documents

Supported Tables

The cleaner supports deletion from the following PCF tables: Projects, Files, Issues, PoC, Chats, Messages, Credentials, Hosts, Hostnames, Logs, NetworkPaths, Networks, Notes, Ports, Tasks, tool_sniffer_http_info, tool_sniffer_http_data

Benefits

Helps maintain data hygiene in long-running PCF installations Assists in complying with data protection regulations Reduces database bloat and improves performance Customizable to fit specific organizational needs

Caution

  • Always backup your PCF database before running this tool, especially when first setting it up or after making configuration changes.
  • Verify the schema hash in your config.yaml matches your PCF version.
  • Test the cleaner on a non-production environment first.

Contributions, issues, and feature requests are welcome. Feel free to check issues page if you want to contribute.

LICENSE

Disclaimer

This tool is provided as-is. Users are responsible for ensuring it meets their specific data protection and security requirements.

About

PCF Archive Cleaner is a Rust-based utility designed to automatically delete archived projects from the Pentest Collaboration Framework (PCF). This tool is specifically tailored for version 1.5.0 of PCF and aims to assist cybersecurity professionals in managing data protection requirements.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages