Skip to content

Instantly share code, notes, and snippets.

@miaoski
Created August 18, 2014 06:28
Show Gist options
  • Save miaoski/d23ab13066ae9d0dd436 to your computer and use it in GitHub Desktop.
Save miaoski/d23ab13066ae9d0dd436 to your computer and use it in GitHub Desktop.
HITCON2014 Tarmful
#!/bin/bash
for n in `seq 145 -1 1`; do
FN=`ls $n`
echo "$n -- $FN"
echo "$FN" | grep -q bz && tar jfxv "$n/$FN" && continue
echo "$FN" | grep -q gz && tar zfxv "$n/$FN" && continue
echo "$FN" | grep -q xz && tar Jfxv "$n/$FN" && continue
echo "$FN" | grep -i -q zip && unzip "$n/$FN" && continue
file "$n/$FN" | grep -q bz && tar jfxv "$n/$FN" && continue
file "$n/$FN" | grep -q gz && tar zfxv "$n/$FN" && continue
file "$n/$FN" | grep -q xz && tar Jfxv "$n/$FN" && continue
file "$n/$FN" | grep -i -q zip && unzip "$n/$FN" && continue
break
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment