redballoonsecurity / ofrak

OFRAK: unpack, modify, and repack binaries.
https://ofrak.com
Other
1.82k stars 128 forks source link

Add license check to OFRAK #479

Open rbs-jacob opened 5 days ago

rbs-jacob commented 5 days ago

One sentence summary of this PR (This should go in the CHANGELOG!)

Add license check to OFRAK. Just CLI license check included for now. Not meant to be airtight (since there are a million ways to bypass it at this point), just to prompt users to think about the license on first run.

flowchart TD
    subgraph download [Run OFRAK for the first time]
        script[Run script] & config["Run `ofrak configure` command"]
        run_gui[Run GUI]
    end
    script & config --> |CLI license flow| flow
    run_gui --> |GUI license flow| flow
    subgraph flow [License flow]
        subgraph validate [Validate the license]
            direction TB
            display[Print license type to standard output] --> check_sig[Validate license signature]
            check_sig --> confirm_date[Confirm the license has not expired]
        end
        validate --> |Valid license| continue[Continue running the original script/task]
        validate --> |Invalid or expired license| error[Display an error and abort]
        check[Check for license in expected location] --> |License exists| validate
        check --> |License does not exist| type[Choose Community or Pro License]
        type --> |Community| comunity_agree[Prompt to accept license agreement]
            --> write_disk[Write Community License to expected location on disk] 
            --> validate
        type --> |Pro| locate_or_obtain[Prompt to locate a license on disk or obtain one]
            -->  |Locate on disk| locate[Input path to license]
            -->  pro_agree[Prompt to accept license agreement]
            --> copy[Copy license to expected location on disk]
        locate_or_obtain ----> |Obtain license| obtain[Request license on OFRAK website]
            --> call[Have a call with RBS and get full or trial license]
        copy --> validate
    end