Skip to content

GramThanos/BrainFLAG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BrainFLAG

A BrainFuck debugger and scanner for CTF flags

preview

Examples

Example 1

Example code from the Hackappatoi 2022:

>--------[<+++++++++++++++++++++++>-]<>>++++++++[<++++++++>-]<+++>>---------[<+++++++++++++++++++>-]<->>--------[<+++++++++++++++++++++++>-]<-->>+++++++++++[<+++++++++++>-]<++>>++++++++[<++++++++>-]<++++>>++++++[<++++++++>-]<>>++++++++++[<+++++++++++>-]<>>----------[<++++++++++++++>-]<>>---------[<+++++++++++++++++>-]<-------->>+++++++++[<+++++++++++>-]<>>------[<++++++++++++++++++++++++++++++++++>-]<---->>++++++++++[<++++++++++>-]<>>-------[<+++++++++++++++++++++++++++++>-]<-->>---------[<+++++++++++++++++>-].<-------->>-------[<+++++++++++++++++++++++++++++>-].<---->>----------[<+++++++++++++++>-].<---->>---------[<+++++++++++++++++>-].<-------->>-----------[<++++++++++++>-].<--->>------[<++++++++++++++++++++++++++++++++++>-].<---->>----------[<+++++++++++++>-].<--------->>+++++++++[<++++++++++>-].<+++++>>+++++++[<+++++++>-].<+++>>---------[<+++++++++++++++++++>-].<--->>+++++++[<+++++++>-].<++>>+++++++++[<++++++++++>-].<+++++>>----------[<++++++++++++++>-].<->>------[<++++++++++++++++++++++++++++++++++>-].<---->>+++++++++[<++++++++++>-].<++++++++>>-------[<+++++++++++++++++++++++++++++>-].<-->>++++++++++[<+++++++++++>-].<++++>>+++++++++++[<+++++++++++>-].<++++><>++++++++++++++[<++++++++++++++>-].<+++.<>>+++++++++++++++[<<++++++++++++++++>>-].<<+++++++++++++.<>>>+++++++++++++++[<<<+++++++++++++++>>>-].<<<++++++++++++.<>>>>----[<<<<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>>>-].<<<<-.<>>>>>+++++++[<<<<<+++++++++>>>>>-].<<<<<.<>>>>>>+[<<<<<<++>>>>>>-].<<<<<<.<>>>>>>>+++++++++++++[<<<<<<<++++++++++++++>>>>>>>-].<<<<<<<+++++++++++.<>>>>>>>>--------[<<<<<<<<+++++++++++++++++++++++>>>>>>>>-].<<<<<<<<----.<>>>>>>>>>+++[<<<<<<<<<+++++>>>>>>>>>-].<<<<<<<<<.<>>>>>>>>>>+++++++[<<<<<<<<<<++++++++>>>>>>>>>>-].<<<<<<<<<<++.<>>>>>>>>>>>++++[<<<<<<<<<<<+++++>>>>>>>>>>>-].<<<<<<<<<<<+.<>>>>>>>>>>>>-------------[<<<<<<<<<<<<++++++>>>>>>>>>>>>-].<<<<<<<<<<<<-------.<>>>>>>>>>>>>>+++++++[<<<<<<<<<<<<<+++++++>>>>>>>>>>>>>-].<<<<<<<<<<<<<.<>>>>>>>>>>>>>>------------[<<<<<<<<<<<<<<+++++++>>>>>>>>>>>>>>-].<<<<<<<<<<<<<<-----.<>>>>>>>>>>>>>>>++[<<<<<<<<<<<<<<<++>>>>>>>>>>>>>>>-].<<<<<<<<<<<<<<<+.<>>>>>>>>>>>>>>>>+++[<<<<<<<<<<<<<<<<++++>>>>>>>>>>>>>>>>-].<<<<<<<<<<<<<<<<.<>>>>>>>>>>>>>>>>>+++++++[<<<<<<<<<<<<<<<<<++++++++>>>>>>>>>>>>>>>>>-].<<<<<<<<<<<<<<<<<.<>>>>>>>>>>>>>>>>>>+++[<<<<<<<<<<<<<<<<<<+++++>>>>>>>>>>>>>>>>>>-].<<<<<<<<<<<<<<<<<<.<>>>>>>>>>>>>>>>>>>>-------[<<<<<<<<<<<<<<<<<<<++++++++++++++++++++++++++++>>>>>>>>>>>>>>>>>>>-].<<<<<<<<<<<<<<<<<<<----.<>>>>>>>>>>>>>>>>>>>>+++++++++++++[<<<<<<<<<<<<<<<<<<<<++++++++++++++>>>>>>>>>>>>>>>>>>>>-].<<<<<<<<<<<<<<<<<<<<++++++.<>>>>>>>>>>>>>>>>>>>>>---[<<<<<<<<<<<<<<<<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>>>>>>>>>>>>>>>>>>>>-].<<<<<<<<<<<<<<<<<<<<<-.<>>>>>>>>>>>>>>>>>>>>>>------------[<<<<<<<<<<<<<<<<<<<<<<+++++++>>>>>>>>>>>>>>>>>>>>>>-].<<<<<<<<<<<<<<<<<<<<<<-----.<

Flag retrieved from scanning the data memory durring execution:

HCTF{D0nt_c0d3_1f_y0u_4R3_s0b3r}

Example 2

Example from Tenable CTF 2021:

--[----->+<]>.++++++.-----------.++++++.[----->+<]>.----.---.+++[->+++<]>+.-------.++++++++++.++++++++++.++[->+++<]>.+++.[--->+<]>----.+++[->+++<]>++.++++++++.+++++.--------.-[--->+<]>--.+[->+++<]>+.++++++++.>--[-->+++<]>.

Flag retrieved from output:

flag{wtf_is_brainfuck}

Example 3

Example from the Codefest CTF 2020:

++++++++[>+>++>+++>++++>+++++>++++++>+++++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++>+++++++++++++>++++++++++++++>+++++++++++++++>++++++++++++++++<<<<<<<<<<<<<<<<-]>>>>>>>>>>>>+++.---<<<<<<<<<<<<>>>>>>>>>>>>>>-.+<<<<<<<<<<<<<<>>>>>>>>>>>>>----.++++<<<<<<<<<<<<<>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<>>>>>>>>>>>>>--.++<<<<<<<<<<<<<>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<>>>>>>>>>>>>>>+++.---<<<<<<<<<<<<<<>>>>>>>>>>>>>>>----.++++<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>+++.---<<<<<<<<<<<<<<<>>>>>>>>>>>>>>--.++<<<<<<<<<<<<<<>>>>>>.<<<<<<>>>>>>>>>>>>>>>----.++++<<<<<<<<<<<<<<<>>>>>>>>>>>>-.+<<<<<<<<<<<<>>>>>>>>>>>>>>>----.++++<<<<<<<<<<<<<<<>>>>>>>>>>>>>.<<<<<<<<<<<<<>>>>>>+++.---<<<<<<>>>>>>>>>>>>-.+<<<<<<<<<<<<>>>>>>>>>>>>>--.++<<<<<<<<<<<<<>>>>>>+.-<<<<<<>>>>>>>----.++++<<<<<<<>>>>>>>>>>>>>-.+<<<<<<<<<<<<<>>>>>>>>>>>>-.+<<<<<<<<<<<<>>>>>>>>>>>>>+++.---<<<<<<<<<<<<<>>>>>>+++.---<<<<<<>>>>>>+++.---<<<<<<>>>>>>>>>>>>>>.<<<<<<<<<<<<<<>>>>>>>>>>>>-.+<<<<<<<<<<<<>>>>>>>>>>>>>----.++++<<<<<<<<<<<<<>>>>>>+.-<<<<<<>>>>>>>>>>>>>-.+<<<<<<<<<<<<<>>>>>>>>>>>>>-.+<<<<<<<<<<<<<>>>>>>+.-<<<<<<>>>>>>>>>>>>>>--.++<<<<<<<<<<<<<<>>>>>>>---.+++<<<<<<<>>>>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<<<<>++.--<>>>>>>>+.-<<<<<<<>>>>>>>--.++<<<<<<<>>>>>>>++.--<<<<<<<>>>>>>>.<<<<<<<>>>>>>>---.+++<<<<<<<>>>>>>>----.++++<<<<<<<>>>>>>>-.+<<<<<<<>>>>>>>+.-<<<<<<<>>>>>>+++.---<<<<<<>>>>>>>--.++<<<<<<<>>>>>>>---.+++<<<<<<<>>>>>>>----.++++<<<<<<<>>>>>>>-.+<<<<<<<>>>>>>>.<<<<<<<>>>>>>>>>>>>+++.---<<<<<<<<<<<<>>>>>>>>>>>>>--.++<<<<<<<<<<<<<>>>>>>++.--<<<<<<>>>>>>.<<<<<<.

Flag retrieved from output:

codefest{n0t_th3_f14g_k33p_d1gg1n5}

Example 4

Example from the SunshineCTF 2019:

+[--------->++<]>+.++.-------.[--->+<]>+.[->+++++<]>-.-[--->+<]>--.+[->+++<]>+.++++++++.------------.[--->+<]>-.------------.---.[->+++<]>--.-[--->+<]>--.[--->+<]>----.+++[->+++<]>++.++++++++.+++++.[++>---<]>--.-[-->+++++++<]>.[->+++<]>.--[--->+<]>.+[->+++<]>+.++++++++.+++++.[->+++<]>++.++++.+++..+.>--[-->+++<]>.

Flag retrieved from output:

sun{fuck_the-brain#we!got^beef}