<commit_before># Usage: getrekt.sh file_or_folder flag_marker
# Example: getrekt.sh for101 'flag{'

if [ -z "$2" ]
   then
   echo 'Usage: lolsolved.sh file_or_folder flag_marker'
   exit 2
fi

featherduster='~/tools/featherduster/featherduster.py'

FLAG="$2"
FLAG_REVERSE=`echo $FLAG | rev`

echo 'Magic CTF challenge solver GO!'
echo ''

# Do general solves
# strings | grep
find "$1" | while read file; do
   strings "$file" | grep "$FLAG" && echo 'GETREKT: strings | grep flag' && exit 0
   strings "$file" | grep "$FLAG_REVERSE" && echo 'GETREKT: strings | grep flag_in_reverse' && exit 0
   binwalk -e "$file" >/dev/null;
   grep -r -i "$FLAG" _$file.extracted/ && echo 'GETREKT: binwalk -e -M ; grep -r flag' && exit 0
   grep -r -i "$FLAG_REVERSE" _$file.extracted/ && echo 'GETREKT: binwalk -e -M ; grep -r flag_in_reverse' && exit 0

   # Do crypto solves
   # FeatherDuster autopwn
   python $featherduster "$file" <<EOF | grep "$FLAG" && echo 'GETREKT: featherduster autodecode' && exit 0
analyze
samples
EOF

   # FeatherDuster autodecode
   echo 'autopwn' | python "$featherduster" "$file" | grep "$FLAG" && echo 'GETREKT: featherduster autopwn' && exit 0
   <commit_msg>this is a useful commit message<commit_after># Usage: getrekt.sh file flag_marker
# Example: getrekt.sh for101 'flag{'

if [ -z "$2" ]
   then
   echo 'Usage: lolsolved.sh file flag_marker'
   exit 2
fi

featherduster='~/tools/featherduster/featherduster.py'

FLAG="$2"
FLAG_REVERSE=`echo $FLAG | rev`

echo 'Magic CTF challenge solver GO!'
echo ''

# Do general solves
# strings | grep
find "$1" | while read file; do
   strings "$file" | grep "$FLAG" && echo 'GETREKT: strings | grep flag' && exit 0
   strings "$file" | grep "$FLAG_REVERSE" && echo 'GETREKT: strings | grep flag_in_reverse' && exit 0
   binwalk -e "$file" >/dev/null;
   grep -r -i "$FLAG" *.extracted/ && echo 'GETREKT: binwalk -e -M ; grep -r flag' && exit 0
   grep -r -i "$FLAG_REVERSE" *.extracted/ && echo 'GETREKT: binwalk -e -M ; grep -r flag_in_reverse' && exit 0

   # Do crypto solves
   # FeatherDuster autopwn
   python $featherduster "$file" <<EOF | grep "$FLAG" && echo 'GETREKT: featherduster autodecode' && exit 0
analyze
samples
EOF

   # FeatherDuster autodecode
   echo 'autopwn' | python "$featherduster" "$file" | grep "$FLAG" && echo 'GETREKT: featherduster autopwn' && exit 0
   
{'fraction_non_alphanumeric': 0.14249363867684478, 'fraction_numerical': 0.01102629346904156, 'mean_word_length': 3.8142857142857145, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1114918', 'n_tokens_mistral': 920, 'n_tokens_neox': 847, 'n_words': 275}