Questions tagged [hex]
69
questions
0
votes
0
answers
37
views
Shift the address in the hex file with Offset
I want to update the hexfile start address with offset. For example, i have a hex file name abc.hex and start with address 0x0000 to 0xFFFF. But I want to shift the context in the hexfile to the ...
2
votes
0
answers
42
views
SOCKET auditd hex value meaning
I have the following log messages from auditd. They appear to log calls to socket.
type=SYSCALL msg=audit(05/11/2023 23:19:52.913:2533) :
arch=x86_64 syscall=socket success=yes exit=9
a0=inet a1=...
0
votes
1
answer
663
views
Convert variable from little endian to big endian
Working in Bash
I have a hex variable that I must convert from little endian to big endian
I am new to the entire concept of this and only learned about this about 20 minutes ago, so please bare with ...
10
votes
1
answer
994
views
Space not taken as an argument separator by shell script (could someone please explain that small file difference ?)
SHORT VERSION (TL;DR)
I have 2 small one-line files, seemingly identical :
$ cat f1 f2
./cconv.sh 100 EUR USD
./cconv.sh 100 EUR USD
But they are not, there is a 1 byte difference in size :
$ ls -l ...
7
votes
2
answers
1k
views
How to write binary values into a file in Bash instead of ASCII values
I am dealing with an embedded system which has some memory that is accessible by a file descriptor (I have no idea what am I saying, so please correct me if I am wrong).
This memory is 32 kB and I ...
0
votes
3
answers
3k
views
How to use sh script to send hex data to /dev/ttyUSB0?
I'm working with a paired down embedded Linux installation that does not support bash, only sh across a ssh terminal. I need to send hex data to a connected USB device /dev/ttyUSB0. I'm able to do ...
1
vote
0
answers
46
views
Is it possible to repair a jpg that doesn't "look" broken? [duplicate]
I have many photos that were recovered a long time ago, at the time I recovered them and everything looked fine, the thumbnails produced looked good. However now, 16 years later. I see that the images ...
0
votes
1
answer
274
views
Colour codes for 88 colours
I am looking at the colour codes
Have seen the 88 colour, any idea what bit length is used for 88 colours?
3-Bit (2^3) | 8 | 8 (Primary) (000 to 111)
4-Bit (2^4) | 16 | 16 (Basic) (0000 ...
1
vote
3
answers
724
views
Modify and Replace $1 (awk) or \1 (sed) Values from Decimal to Hexadecimal Globally in a String?
Is it possible to Modify and Replace $1 (awk) or \1 (sed) Values from Decimal to Hexadecimal Globally in a String? It is possible that the string may contain any decimal value, which needs to be ...
1
vote
2
answers
1k
views
How to grep for hex pattern w/ wildcards?
I'm trying to find the offset of a hex pattern in a file. This works for one specific value:
$ grep -obUaP -m1 "\x00\x50\x53\x46\x01\x01\x00\x00\x34\x01\x00\x00" file.bin
3088:PSF4
However,...
0
votes
2
answers
357
views
Is there any linux utility to create plain binary dump of file and vice versa?
I want to know is there any linux utility or procedure for generating plain binary dump and reversing it back to the original file (as xxd is capable of doing it with -r argument)? I have tried xxd, ...
6
votes
1
answer
1k
views
grep should find a hex value in a file but doesn't
Here is the beginning of a file:
# hexdump -n 550 myFile
0000000 f0f2 f5f0 f7f9 f1f1 f1f0 f0f0 e3f1 f3c8
0000010 f3f5 0000 0000 000c 0000 0000 0000 000c
0000020 0000 0c00 0000 0000 0000 0c00 0000 0000
...
2
votes
1
answer
2k
views
Reverse the effect of endianness on a memory dump
I've got a series of pipe commands that gets me a memory dump represented as a string of hexadecimal. This memory dump includes some ascii text that I want to read. The endianness of the memory dump ...
1
vote
0
answers
192
views
How to grep for hex patterns from within a shell script?
Thanks to this thread:
https://stackoverflow.com/questions/23695609/how-to-grep-for-presence-of-specific-hex-bytes-in-files
I've determined that I can grep for a particular hex pattern in a file and ...
2
votes
1
answer
418
views
How to modify a hex string to LE-format before passing it to `xxd -r` to view its binary contents?
The hex string 0068732f6e69622f represents the ASCII string /bin/sh, when it's stored in memory in LE-format.
Is there any Linux utiltity that will take the hex string and reverse it bytes (...
3
votes
3
answers
782
views
Boosting the grep search using GNU parallel
I am using the following grep script to output all the unmatched patterns:
grep -oFf patterns.txt large_strings.txt | grep -vFf - patterns.txt > unmatched_patterns.txt
patterns file contains the ...
0
votes
2
answers
357
views
Equivalent of grep string matching to sed & awk [closed]
I am currently processing large files looking for unmatched patterns. I am using grep to achieve this. And for some reason, grep ignores/excludes some of the potential unmatched patterns. Both the ...
0
votes
0
answers
502
views
How to change bytes of file in HexEditor terminal
How can I add 4 characters to the start of a file by using the hexeditor (xdd) in terminal?
1
vote
1
answer
2k
views
How to print variable value as a hex number?
I can find seemingly every variation of hex manipulation by printf except this one.
I am trying to send html hex colour values to a text file, built mostly using printf.
I can calculate the separate R,...
0
votes
0
answers
22
views
Kali Linux VM 2020 after upgrade converted all text to some kind of hex
I am doing some training with the OSCP shipped Kali VM. It was working fine and I got around to upgrading all packages and after I did, I get this problem. I cant even navigate to some kind of ...
0
votes
3
answers
290
views
BASH binary to Hex to match PHP bin2hex function?
In bash I can call PHP and run the following:
testKey='8798(*&98}9%"^8&]8_98{9798**76876'
testHex=$(php -r "echo bin2hex('$testKey');")
echo $testHex
And that will result in
...
0
votes
1
answer
421
views
Hex edit over SSH
How can you hex edit a file over SSH? I have tried using hexedit, but it says command not found. Using xxd gives the hex dump of the file, but how can I actually edit the file?
0
votes
1
answer
145
views
Find contents of one file in another, and replace with FF
I have a binary file called rockx.dat, and a bunch of other binary files rockx_#.pmf.
I want to find the contents of the pmf files in the dat file, and replace them with FF. So if the pmf file is 500 ...
1
vote
1
answer
1k
views
Standard naming practice for executables (binary file) and how to tell whether a file has has non-printable characters?
So I am often guilty of running cat on an executable file that's a binary file and my terminal usually makes some weird noises and isn't happy. Is there some accepted naming convention for giving an ...
0
votes
1
answer
4k
views
Convert received data bytes in serial to hex text
Hi now I write bytes data (for eg, \x00\x11\x22) from my PC to serial port of my device running unix at the ttyS1 port. I am able to print the data using either
cat /dev/ttyS1
od -x < /dev/ttyS1
...
2
votes
1
answer
3k
views
Make xxd display the the byte offset at the top column?
So Im using emacs which has a stupendous hexl-mode to view the byte offset in a file right over the hex values similar to:
87654321 0011 2233 4455 6677 8899 aabb ccdd eeff 0123456789abcdeff ...
2
votes
2
answers
2k
views
Undump od (octal or hex dump) in Version 6 Unix
od (octal dump) command is implemented in Unix since Version 1. However, I couldn't find a reverse command in the Version 6 Unix manual (1975). Modern ways of reversing od with either xxd or sed do ...
3
votes
3
answers
709
views
How can I list the different hex characters between two files?
allHexChars.txt
\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\...
-1
votes
1
answer
247
views
How do we get the readable string from big endian hex string
How do we get the readable string from hex string
0049006e00740072006f
of BE which means as normal word, ie. we dont have to swap the byte pair per word
tried with xxd in vain, cause I dont know ...
8
votes
2
answers
11k
views
How to read string as hex number in bash?
I have the bash line:
expr substr $SUPERBLOCK 64 8
Which is return to me string line:
00080000
I know that this is, actually, a 0x00080000 in little-endian. Is there a way to create integer-...
2
votes
1
answer
830
views
Hex code for '(' in bash regex
I have a strange behaviour in shell.
When I try to match '_' in regex with its hex code it works, but not with '('.
$ regex1=$'\x5f'
$ pattern1='_'
$ if [[ $pattern1 =~ $regex1 ]]; then echo yes; ...
3
votes
1
answer
2k
views
Can you edit address values in "/proc/$pid/mem" to reflect changes in that process?
I would like to see if I can edit a value in my program while it is running by directly changing the memory.
My thought process (untested) is to do the following:
Run the program.
Open up "System ...
4
votes
1
answer
10k
views
Hex dump only the beginning and the end of a file with xxd [duplicate]
I am looking for a command to display three .png files using xxd, displaying the first two and last two lines of the hexadecimal for each.
I have used the command below to display one file at a time ...
-2
votes
2
answers
629
views
Reverse engineering the hex file [closed]
reverse engineering the hex file
Written in c language
From atmega16
Want source code from the hex code
By reverse engineering need to extract the library file of the code
is their any possible ...
8
votes
4
answers
13k
views
Get hex-only output from objdump
Say for example I've got this C function:
void f(int *x, int *y)
{
(*x) = (*x) * (*y);
}
When saved to f.c, compiling with gcc -c f.c produces f.o. objdump -d f.o gives this:
f.o: file ...
0
votes
4
answers
2k
views
Finding how many hex values a string containing hex and random string
I have the file ~/dummy_hex.txt containing hex and random string:
\x12\xA1\xF1\xE3somegibberigh
I want to count how many hex values (groups of \x^hex_digit^^hex_digit^) the string above has. In the ...
6
votes
2
answers
2k
views
convert hex IP address into hostname
I would like to switch between hostnames and hex IP addresses, and vice versa. I have installed syslinux-utils on Debian Stretch, which provides gethostip:
gethostip -x google.com
D83ACD2E
How can ...
3
votes
2
answers
6k
views
printf in shell script can't do \x%x
where ECHO-VAR produces \xFF\xFF\xFF\x00 ($fb_COLOR15) these work on the command line:
CP="`ECHO-VAR`" printf $CP | dd status=none bs=4 count=$(( ( 1360 * 100 ) + 100 )) > /dev/fb0
printf "`ECHO-...
3
votes
2
answers
9k
views
Find hex value in files/folder
Is there a way to search for a hex value in files / folders?
I've tried the following:
grep -P "[\x01\x02\x03]"
but that doesn't work (there is no error, but it doesn't search for these hex values).
0
votes
1
answer
744
views
Hex viewer for Solaris (SunOS 5.11)
Can anyone point me at a decent hex viewer for Solaris? Looking for something with a front-end similar to bless on Ubuntu or Binary Viewer on Windows or ..almost the Delta Hex Editor Netbeans plugin. ...
2
votes
1
answer
2k
views
Why does xxd not show the byte order mark?
I have a Java class which the compiler refuses to compile due to \ufeff at the start of the file. I can view the fact that the BOM is present by vim -b file.java, but neither xxd nor hexdump show the ...
0
votes
1
answer
2k
views
Command for converting little endian memory addresses to hex code?
I'm wondering is there's a command or utility already built within the terminal that can take a little endian memory address (for e.g. 5F4A358F) and convert it into a hex code (in this case \x8f\x35\...
1
vote
2
answers
698
views
swap bits position in linux
i have hex value
B455
when i change it to binary i got
1011 0100 0101 0101
i want to swap the bits with a rule of :
origin bits index : 0123456789ABCDEF
result bits index : D5679123C4EF80AB`
...
12
votes
3
answers
4k
views
Bash expansion hexadecimal
I would like to know if there is a way of using bash expansion to view all possibilities of combination for a number of digits in hexadecimal. I can expand in binaries
In base 2:
echo {0..1}{0..1}{0....
11
votes
6
answers
11k
views
Reverse a hexadecimal number in bash
Is there a simple command to reverse an hexadecimal number?
For example, given the hexadecimal number:
030201
The output should be:
010203
Using the rev command, I get the following:
102030
...
19
votes
4
answers
30k
views
How to calculate hexadecimal xor (^) from shell?
Unfortunately bc and calc don't support xor.
0
votes
1
answer
204
views
Hex has unknown character / in the output
I need to create a Rc2Key variable and then convert this to hexadecimal. I have done this with two commands. The Rc2Key variable has to be 16 characters long, so in my test module I used "...
2
votes
1
answer
7k
views
Grep is not matching non-ascii characters
I found a problematic sequence of a supposedly UTF-8 encoded text file. The strange thing is that grep seems unable to match this non-ASCII line.
$ iconv -f utf8 -t iso88591 corrupt_part.txt --output ...
3
votes
2
answers
1k
views
How can I do a binary search of a text file for a specific character string?
I have a text file that contains a large number of records, each on a single line. Some of the records have special characters that have been corrupted, and I'm attempting to find those by looking for ...
1
vote
2
answers
534
views
Appending Echo [Password Generator]
I am creating a password generator however I am not get the passwords to append properly.
Here is my script
i="0"
while [ $i -lt 5 ]
do
echo -n '#' >> passwords.txt && openssl rand ...