I want to check inside a binary file if it matches a binary pattern.
For that, I'm using clamAV signature database
Exploit.HTML.ObjectType:3:*:3c6f626a65637420747970653d222f2f2f2f2f2f2f2f2f2f2f2f
I code this to retrieve the hex signature string
signature=$(echo "$line" |awk -F':' '{ print $4 }')
Moreover I would like to change hex string to binary
tmp=$(echo -n $signature | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs print)
Finally I would like to check if my file ( *$raw_file_path* ) matches my binary pattern (now in $tmp)
test_var=$(cat $raw_file_path | grep -U -P "$tmp")
I don't why it doesn't work.
If you have any idea.
Thanks.
od
that will allow you to do what you want. Good luck.