Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command to convert hexdump back to text

I am using Catfish to find files containing certain text. Some of the files found instead of plain text contain something which looks like a hex dump:

3c3f 7068 700a 0a66 756e 6374 696f 6e20
7573 6572 5f65 7869 7374 7328 2475 6e29
207b 0a09 7265 7475 726e 2074 7275 653b
0a7d 0a0a 0a3f 3e00 0000 0000 0000 0000

I.e. always 8 columns and each row containing 16 bytes. Line one above should be

<?php
function

Is there a command to unhex the file and print the content?

like image 604
Majid Fouladpour Avatar asked Dec 23 '22 13:12

Majid Fouladpour


1 Answers

Use xxd with the revert option -r

xxd -p -r file.txt

gives a result of

<?php

function user_exists($un) {
        return true;
}


?>
like image 87
etopylight Avatar answered Jan 09 '23 16:01

etopylight