Convert hexdump to tar file

7,656

You can use xxd -r -p.

$ xxd -r -p <<"EOF" > myfile.tgz
1f8b 0800 3416 1259 0003 edcf 310e c230 0c85 61cf 9c22 1708 b2d3 909e a7a2 5d90 1028 7581 e353 d401 2660 a910 d2ff 2d6f f01b 9ec7 615f 07df facd 6535 3a2b 253f d2da 9dbe e622 9958 639a b3a5 3615 51b3 648d 045d 6fd2 d334 7a57 4390 fed2 bfed 7dba ffa9 c3fc 7ff4 53bc 76f5 18a7 73d8 fc7a 1000 0000 0000 0000 0000 0000 0000 e02b 7747 d31e 6300 2800 0000
EOF

myfile.tgz will then be the archive:

$ file myfile.tgz
myfile.tgz: gzip compressed data, from Unix, last modified: Tue May  9 20:19:16 2017
$ tar -xvf myfile.tgz
secret.txt
Share:
7,656

Related videos on Youtube

Prashant Dey
Author by

Prashant Dey

A coder turned Serial Entrepreneur. Startups: DIYguru (www.diyguru.org), Findmementor (www.findmementor.com), Timoo (www.timoo.online)

Updated on September 18, 2022

Comments

  • Prashant Dey
    Prashant Dey almost 2 years

    I have a hex dump as

    1f8b 0800 3416 1259 0003 edcf 310e c230 0c85 61cf 9c22 1708 b2d3 909e a7a2 5d90 1028 7581 e353 d401 2660 a910 d2ff 2d6f f01b 9ec7 615f 07df facd 6535 3a2b 253f d2da 9dbe e622 9958 639a b3a5 3615 51b3 648d 045d 6fd2 d334 7a57 4390 fed2 bfed 7dba ffa9 c3fc 7ff4 53bc 76f5 18a7 73d8 fc7a 1000 0000 0000 0000 0000 0000 0000 e02b 7747 d31e 6300 2800 0000
    

    I saw the first three bytes and recognized that it is a tar.gz file from the signature. Now I want to reverse this into the tar.gz.

    Any idea on how I can do this?

  • Prashant Dey
    Prashant Dey about 7 years
    This is the complete dump of the file. And there are few people who have successfully retrieved from this.
  • Attie
    Attie about 7 years
    @Prashant see my updates