diff options
author | johannst <johannes.stoelp@gmail.com> | 2020-03-14 16:04:32 +0100 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2020-03-14 16:04:32 +0100 |
commit | c8e14a3d5c8ca3aea06c9035308a1475cc70aa30 (patch) | |
tree | b2d2b9ab1917a78b3e79e9f175298d9e1f4eeff2 /binary.txt | |
parent | 3099cd5efceebcbbc5ab1202c2b183ccd4453a65 (diff) | |
download | notes-c8e14a3d5c8ca3aea06c9035308a1475cc70aa30.tar.gz notes-c8e14a3d5c8ca3aea06c9035308a1475cc70aa30.zip |
migrate binary.txt + explore-elf.txt
Diffstat (limited to 'binary.txt')
-rw-r--r-- | binary.txt | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/binary.txt b/binary.txt deleted file mode 100644 index 37bcc06..0000000 --- a/binary.txt +++ /dev/null @@ -1,75 +0,0 @@ -# binary --------------------------------------------------------------------------------- - -# toc ------- - |od| - |xxd| - -# od(1) *od* -======== - args: - -An don't print addr info - -tx4 print hex in 4 byte chunks - -ta print as named character - -tc printable chars or backslash escape - -w4 print 4 bytes per line - -j <n> skip <n> bytes from file, (hex if start with 0x) - -N <n> dump <n> bytes (hex of start with 0x) - - ## ascii chars to hex string - echo -n AAAABBBB | od -An -w4 -tx4 - >> 41414141 - >> 42424242 - - echo -n '\x7fELF\n' | od -tx1 -ta -tc - >> 0000000 7f 45 4c 46 0a - >> del E L F nl - >> 177 E L F \n - - ## extract part of file (eg .rodata section form ELF) - readelf -W -S foo - >> Section Headers: - >> [Nr] Name Type Address Off Size ES Flg Lk Inf Al - >> ... - >> [15] .rodata PROGBITS 00000000004009c0 0009c0 000030 00 A 0 0 16 - od -j 0x0009c0 -N 0x30 -tx4 -w4 foo - >> 0004700 00020001 - >> 0004704 00000000 - >> * - >> 0004740 00000001 - >> 0004744 00000002 - >> 0004750 00000003 - >> 0004754 00000004 - -# xxd(1) *xxd* -========= - args: - -p dump continuous hexdump - -r convert hexdump into binary ('revert') - -e dump as little endian mode - -i output as C array - - ## from ascii to hex stream - echo -n 'aabb' | xxd -p - >> 61616262 - - ## from hex to binary stream - echo -n '61616262' | xxd -p -r - >> aabb - - ## ascii to binary - echo -n '\x7fELF' | xxd -p | xxd -r -p | file -p - - >> ELF - - ## ascii to C array (hex encoded) - xxd -i <(echo -n '\x7fELF') - >> unsigned char _proc_self_fd_11[] = { - >> 0x7f, 0x45, 0x4c, 0x46 - >> }; - >> unsigned int _proc_self_fd_11_len = 4; - - --------------------------------------------------------------------------------- -vim:ft=help:sts=2:et:tw=80:cc=80:fo+=t - |