forked from v3l0c1r4pt0r/makeelf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelf_proghdr.hdcb
More file actions
executable file
·65 lines (57 loc) · 1.14 KB
/
elf_proghdr.hdcb
File metadata and controls
executable file
·65 lines (57 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env hdcb
define magic 4
define class 1
define endianness 1
define version 1
define abi 1
define padding 1 0 8 # array
use magic
use class class_l
use endianness endian_l
use version
use abi
use padding 8
if [ $class_l -eq 1 ]; then
wlen=4
elif [ $class_l -eq 2 ]; then
wlen=8
else
echo "Unknown class: $class_l"
exit 1;
fi;
define e_phoff $wlen
define e_phentsize 2
define e_phnum 2
let cursor+=12
[ $endian_l ] && use e_phoff e_phoff_l && let e_phoff_a=$e_phoff_l
[ ! $endian_l ] && use e_phoff e_phoff_b && let e_phoff_a=$e_phoff_b
let cursor+=10
use e_phentsize
[ $endian_l ] && use e_phnum e_phnum_l && let e_phnum_a=$e_phnum_l
[ ! $endian_l ] && use e_phnum e_phnum_b && let e_phnum_a=$e_phnum_b
let cursor=$e_phoff_a
define p_type 4
define p_flags 4
define p_offset $wlen
define p_vaddr $wlen
define p_paddr $wlen
define p_filesz $wlen
define p_memsz $wlen
define p_align $wlen
for i in $(seq 1 $e_phnum_a); do
use p_type
if [ $wlen -eq 8 ]; then
use p_flags
fi;
use p_offset
use p_vaddr
use p_paddr
use p_filesz
use p_memsz
if [ $wlen -eq 4 ]; then
use p_flags
fi;
use p_align
done;
legend;
echo;