Questions tagged [xxd]

`xxd` is a Linux Hexdump command

On the Linux platform, the command xxd (available via most package managers) works as a hexdump tool.

From man xxd

xxd creates a hex dump of a given file or standard input. It can also 
convert a hex dump back to its original binary form. Like uuencode(1) and 
uudecode(1) it allows the transmission of binary data in a `mail-safe' ASCII 
representation, but has the advantage of decoding to standard output. 
Moreover, it can be used to perform binary file patching.  
107 questions
1
vote
1 answer

File carving with Bash can't find hex values FFD8 or FFD9 with grep

I hope that someone could help me out with my file carving script. I want to find the file header and correspondant footer as an hexvalue in an image file in raw format (.dd). For other headers and footers my script works pretty well but not for…
Nelly
  • 13
  • 4
1
vote
1 answer

What are the last four bytes of the unformatted file record marker?

Below is an excerpt of the hex dump of an unformatted Fortran file (generated by AERMOD compiled with gfortran): 00f3ee50: 0000da50 00b746d7 00000001 204c4c41 20202020 462df2dd 403f41fa c5f77f92... 00f4c886: 6a031d65 f2923f8c 658037cc 01813f8b…
user1427008
1
vote
1 answer

Cant receive Hex response from Imatic board

Good day, This is going to be long. I'm trying to communicate with the "SainSmart iMatic with RJ45" board, which is used together with the "SainSmart 16-Channel 12V Relay Module". Basically, I'm able to send hex commands to the board, successfully,…
1
vote
1 answer

Converting integers to binary with xxd

I have a file, output.log, that has a list of space, ' ', separated integers ranging from [-2048,2048]. I am attempting to convert this to a binary file with xxd. I'm using the command, xxd -r -p output.log > output.bin However when I read the file…
gutelfuldead
  • 562
  • 4
  • 22
1
vote
1 answer

How to grep a block of zeroes (wiped area) in a file?

How can I grep a block of zeroes (wiped area with zeroes) in a file? I have a malicious Word document with macros inside. An Antivirus solution wiped out a block with zeroes in this Word document. I would like to detect this in the future before…
user3022917
  • 579
  • 2
  • 8
  • 20
1
vote
3 answers

xxd output only the binary

Using the command : xxd -b some_text will output the binary representation and the original text: 000054c: 11101111 10100001 10110110 00010000 01011011 10000110 ....[. 0000552: 01111000 11001000 01010101 11000101 11101111 10101111 x.U... 0000558:…
TryingHard
  • 11
  • 1
  • 2
1
vote
1 answer

Difference between using objcopy and xxding the file into a c source

Say I want to embed a file called data in my C executable. The result which comes up from google is this linuxjournal page which says use objdump like this objcopy --input binary \ --output elf32-i386 \ --binary-architecture i386…
Alice Ryhl
  • 3,574
  • 1
  • 18
  • 37
1
vote
1 answer

Getting file in hex format - my output vs xxd command output

I'm trying to write a simple program to generate hex output from file. This is my two.c file: #include int main(void) { printf("%s\n", "Hello"); return 0; } which was compiled in this way: gcc -std=c99 -Wall -Wextra…
python
  • 198
  • 1
  • 5
  • 13
1
vote
1 answer

Bash : Get the bytes at offset for length

I was wondering how I could retrieve bytes from a files given an offset and a length. I came to the following line : hexdump -n 4 -s 0x11C myFile I get the following : Not good enough, I don't need the offset. 000011c 00 00 8c d0 Second try :…
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134
0
votes
4 answers

hexdump and xxd produce different outputs on red hat and ubuntu/mint

Firstly , I am mentioning whatever happened on my linux mint/ubuntu system ... udit@udit-Dabba ~/ah $ xxd -r -p input.txt output.txt udit@udit-Dabba ~/ah $ cat input.txt 60 00 00 00 00 14 06 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00…
Udit Gupta
  • 3,162
  • 11
  • 43
  • 71
0
votes
1 answer

xxd vs od - little/big endian or something else going on

I am looking at a compiled java file on Ubuntu 22.04. On bash, when i say xxd A.class, i get a hexdump that begins with cafe babe - this is what i expect. But if i say od -x A.class, i get feca beba - why? As an additional puzzler, both if is say…
bukwyrm
  • 186
  • 6
0
votes
0 answers

xdd -r returns nothing or how can I convert a hex string to binary so I can then convert it to Base64

I am working with RSA keys and the system requires that I provide the public key modulus in base64 encoding. I have tried the following openssl rsa -in Key.pem -noout -modulus |sed -e 's/Modulus=//' |xxd -r -p |openssl base64 -out KeyPairPubMod.b64…
0
votes
0 answers

Trouble generating random hex numbers using /dev/urandom in bash

I'm trying to generate a random hex number with an specified length ($length) using the following command: head -c $length /dev/urandom | xxd -p -u -c $length | tr -d '[:space:]\\' I've noticed that head -c $length /dev/urandom actually prints the…
chyxo
  • 19
  • 4
0
votes
1 answer

how to use xxd revert to start from an offset instead of from 0 address?

Let me explain the question by an example. I first use memtool md -b 0x58040000+128K > rom.hex to dump the option rom of my PCIe card. The content looks like this (notice the address column starts from 0x58040000): 58040000: 55 aa 75 e9 9d 02 00 00…
bruin
  • 979
  • 1
  • 10
  • 30
0
votes
2 answers

Syntax error while trying to generate a 2048bit long prime number

I'm trying to generate a 2048 bit long prime number, this is my code so far: #!/bin/bash generate_random() { hex=$(head -c 256 /dev/urandom | xxd -p) bc <<< "ibase=16; $hex" } p=$(generate_random) echo "$p" While running the script I get…
chyxo
  • 19
  • 4