Skip to content

Commit 2f3f85f

Browse files
committed
fix install script, docs
1 parent 81e7480 commit 2f3f85f

File tree

6 files changed

+69
-35
lines changed

6 files changed

+69
-35
lines changed

FAQ.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ This is the directory where gef temporarily stores files.
3232
Since it is used for caching, there is no problem in deleting it.
3333
It will be created automatically the next time gef starts.
3434

35+
## Will this GEF work as a plugin for hugsy/gef?
36+
No, it doesn't work. It replaces hugsy/gef.
37+
However, compatibility with hugsy/gef has already been lost. You should be considered a completely different product.
38+
39+
3540
## Will each GEF command be more accurate if I have vmlinux with debug symbols?
3641
No, whether vmlinux includes debug information has no effect on GEF behavior.
3742
GEF always uses its own resolved address with `kallsyms-remote`.
@@ -41,6 +46,15 @@ It also performs its own heuristic structure member detection in each command.
4146
No, GEF does not support real mode.
4247
Please consider using other scripts, such as [here](https://astralvx.com/debugging-16-bit-in-qemu-with-gdb-on-windows/).
4348

49+
## Does GEF support Android?
50+
I've never tried it, so I don't know.
51+
52+
I think it will work for userland debugging.
53+
However, Android does not use glibc, so the heap structure is different.
54+
Therefore, I think at least `heap` related commands will not work.
55+
56+
Regarding kernel debugging, I haven't been able to confirm how much the structure is different.
57+
4458
## Is it possible to debug userland with GEF when using qemu-system?
4559
Partially yes. I think it can be used when you want to track before and after a system call.
4660
However, if KPTI is enabled, many kernel-related commands cannot be used.
@@ -121,7 +135,7 @@ The `got` command uses `objdump` internally to obtain the PLT address.
121135
However, with certain combinations of `binutils` and `glibc` versions, `objdump` does not display the PLT address.
122136

123137
The currently known combinations are as follows.
124-
- `binutils 2.38` + `glibc 2.37 or later` (`binutils 2.38` is default of Ubuntu 22.04)
138+
- `binutils 2.38` (Ubuntu 22.04 default) + `glibc 2.37 or later`
125139

126140
This problem occurs when you try to use newer glibc in an Ubuntu 22.04 environment using `patchelf` etc.
127141
The workaround is to build and install new `binutils` from source code.
@@ -139,7 +153,7 @@ If the mode remains switched due to an interruption during command execution, et
139153
Yes, you can access by `__LCO__` that means loaded command objects. For example, `pi __LCO__["vmmap"]`.
140154

141155
## I want to call the function in `KernelAddressHeuristicFinder` class from `python-interactive`, but the class name is too long and I often forget it.
142-
Yes, you can access by `KF`. For example. `pi KF.get_slab_caches()`.
156+
You can access by `KF`. For example, `pi KF.get_slab_caches()`.
143157

144158
## How can I get the instruction object?
145159
You can get instruction object by `pi get_insn(addr=None)`.
@@ -166,6 +180,8 @@ There are also similar functions. Here are the list.
166180
- `p8`, `p16`, `p32`, `p64`
167181
- `u8`, `u16`, `u32`, `u64`, `u128`
168182

183+
If you want the complete list, run `gef pyobj-list`.
184+
169185

170186
# About development schedule
171187

@@ -198,6 +214,8 @@ But this is a personal development, so I have the final decision. I appreciate y
198214
You will need a screenshot or a copy of the terminal string when the problem occurred.
199215
In addition, I am glad if there are the results of the `version` command and `arch-info` command.
200216

217+
Additionally, if the issue is related to kernel debugging, please provide a set of environments (`run.sh`, `bzImage`, `rootfs`, etc.) or where to get them.
218+
201219
## Is it okay to fork and modify?
202220
Yes, however, please follow the license.
203221

QEMU-USER-SUPPORTED-ARCH.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ I also list the tools I used in my Ubuntu 22.04 environment.
118118
* arc32 (HS38; ARCv2)
119119
* toolchain: `arcle-hs38--glibc--bleeding-edge-2023.08-1` from https://toolchains.bootlin.com/
120120
* qemu: https://github.com/foss-for-synopsys-dwc-arc-processors/qemu
121-
* `./configure --target-list=arc-linux-user`.
121+
* `./configure --target-list=arc-linux-user`
122122
* gdb: build from latest.
123123
* `./configure --enable-targets=all --with-python=/usr/bin/python3`
124124
* arc32 (HS58; ARCv3)

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
This is a fork of [GEF](https://github.com/hugsy/gef).
2424
However, there are two major improvements.
2525

26-
1. Added many heuristic commands for kernel debugging __WITHOUT symboled vmlinux__.
27-
2. Added support for [many userland architectures](https://github.com/bata24/gef/blob/dev/QEMU-USER-SUPPORTED-ARCH.md) (for qemu-user).
26+
1. Added many heuristic commands for kernel debugging __WITHOUT symboled vmlinux__ (for qemu-system).
27+
2. Added support for [many architectures](https://github.com/bata24/gef/blob/dev/QEMU-USER-SUPPORTED-ARCH.md) (for qemu-user).
2828

2929
Many other commands have been added and improved. Enjoy!
3030

@@ -114,7 +114,7 @@ See [SUPPORTED-MODE.md](https://github.com/bata24/gef/blob/dev/SUPPORTED-MODE.md
114114
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/v2p-p2v.png)
115115
* `xp`: is a shortcut for physical memory dump.
116116
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/xp.png)
117-
* `qemu-device-info`: dumps device information for qemu-escape.
117+
* `qemu-device-info`: dumps device information for qemu-escape (WIP).
118118

119119
### Qemu-system cooperation - Linux specific
120120
* `ksymaddr-remote`: displays kallsyms information from scanning kernel memory.
@@ -141,7 +141,7 @@ See [SUPPORTED-MODE.md](https://github.com/bata24/gef/blob/dev/SUPPORTED-MODE.md
141141
* Supported on x64 + SLOB + no-symbol + kASLR.
142142
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/slob-dump.png)
143143
* `slub-tiny-dump`: dumps slub-tiny free-list.
144-
* Supported on x64/x86 + SLUB_TINY + no-symbol + kASLR.
144+
* Supported on x64/x86 + SLUB-TINY + no-symbol + kASLR.
145145
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/slub-tiny-dump.png)
146146
* `kbase`: displays the kernel base address.
147147
* `kversion`: displays the debugged kernel version.
@@ -150,11 +150,11 @@ See [SUPPORTED-MODE.md](https://github.com/bata24/gef/blob/dev/SUPPORTED-MODE.md
150150
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/kbase-kversion-kcmdline-kcurrent.png)
151151
* `ktask`: displays each task address.
152152
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/ktask.png)
153-
* It also displays the memory map of the user-land process.
153+
* It also displays the memory map of the userland process.
154154
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/ktask-maps.png)
155-
* It also displays the register values saved on kstack of the user-land process.
155+
* It also displays the register values saved on kstack of the userland process.
156156
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/ktask-regs.png)
157-
* It also displays the file descriptors of the user-land process.
157+
* It also displays the file descriptors of the userland process.
158158
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/ktask-fd.png)
159159
* `kmod`: displays each module address.
160160
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/kmod.png)
@@ -402,11 +402,11 @@ See [SUPPORTED-MODE.md](https://github.com/bata24/gef/blob/dev/SUPPORTED-MODE.md
402402
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/vdso.png)
403403
* `vvar`: dumps the area of vvar.
404404
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/vvar.png)
405-
* `gdtinfo`: pretty prints GDT entries. If user-land, show sample entries.
405+
* `gdtinfo`: pretty prints GDT entries. If userland, show sample entries.
406406
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/gdtinfo.png)
407-
* `idtinfo`: pretty prints IDT entries. If user-land, show sample entries.
407+
* `idtinfo`: pretty prints IDT entries. If userland, show sample entries.
408408
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/idtinfo.png)
409-
* `tls`: pretty prints TLS area.
409+
* `tls`: pretty prints TLS area. Some architectures only support glibc.
410410
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/tls.png)
411411
* `fsbase`/`gsbase`: pretty prints `$fs_base`, `$gs_base`.
412412
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/fsbase_gsbase.png)
@@ -519,7 +519,7 @@ See [SUPPORTED-MODE.md](https://github.com/bata24/gef/blob/dev/SUPPORTED-MODE.md
519519
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/search-mangled-ptr.png)
520520
* `strings`: searches ASCII string from specific location.
521521
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/strings.png)
522-
* `read-system-register`: reads system register for old qemu.
522+
* `read-system-register`: reads system register for old qemu (ARM32 only).
523523
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/read-system-register.png)
524524
* `v8`: displays v8 tagged object.
525525
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/v8.png)
@@ -541,7 +541,7 @@ See [SUPPORTED-MODE.md](https://github.com/bata24/gef/blob/dev/SUPPORTED-MODE.md
541541
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/symbols.png)
542542
* `saveo`/`diffo`: saves and diffs the command outputs.
543543
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/saveo-diffo.png)
544-
* `seq-length`: detects consecutive length of the same value.
544+
* `seq-length`: detects consecutive length of the same sequence.
545545
* ![](https://raw.githubusercontent.com/bata24/gef/dev/images/seq-length.png)
546546
* `gef arch-list`: displays defined architecture information.
547547
* `gef pyobj-list`: displays defined global python object.

gef.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -52893,7 +52893,7 @@ def modify_regs(self):
5289352893

5289452894
@register_command
5289552895
class TlsCommand(GenericCommand):
52896-
"""Display TLS base address."""
52896+
"""Display TLS base address. Some architectures only support glibc."""
5289752897
_cmdline_ = "tls"
5289852898
_category_ = "02-b. Process Information - Base Address"
5289952899

@@ -54131,7 +54131,7 @@ def do_invoke(self, args):
5413154131

5413254132
@register_command
5413354133
class SequenceLengthCommand(GenericCommand):
54134-
"""Detect consecutive lengths of the same value."""
54134+
"""Detect consecutive lengths of the same sequence."""
5413554135
_cmdline_ = "seq-length"
5413654136
_category_ = "03-d. Memory - Calculation"
5413754137

install-minimal.sh

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
#!/bin/sh -eux
22

33
if [ ! $(id -u) = 0 ]; then
4-
echo "[-] Detected non-root user, install failed."
5-
exit 1
4+
echo "[-] Detected non-root user."
5+
echo "[-] INSTALLATION FAILED"
6+
exit 1
67
fi
78

89
echo "[+] apt"
910
apt-get update
1011
apt-get install -y gdb-multiarch binutils gcc file
1112

1213
echo "[+] download gef"
13-
wget -q https://raw.githubusercontent.com/bata24/gef/dev/gef.py -O /root/.gdbinit-gef.py
14+
if [ -e /root/.gdbinit-gef.py ]; then
15+
echo "[-] /root/.gdbinit-gef.py already exists. Please delete or rename."
16+
echo "[-] INSTALLATION FAILED"
17+
exit 1
18+
else
19+
wget -q https://raw.githubusercontent.com/bata24/gef/dev/gef.py -O /root/.gdbinit-gef.py
20+
fi
1421

1522
echo "[+] setup gef"
1623
STARTUP_COMMAND="source /root/.gdbinit-gef.py"
1724
if [ ! -e /root/.gdbinit ] || [ "x$(grep "$STARTUP_COMMAND" /root/.gdbinit)" = "x" ]; then
18-
echo "$STARTUP_COMMAND" >> /root/.gdbinit
25+
echo "$STARTUP_COMMAND" >> /root/.gdbinit
1926
fi
2027

28+
echo "[+] INSTALLATION SUCCESSFUL"
2129
exit 0

install.sh

+22-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/bin/sh -eux
22

33
if [ ! $(id -u) = 0 ]; then
4-
echo "[-] Detected non-root user, install failed."
5-
exit 1
4+
echo "[-] Detected non-root user."
5+
echo "[-] INSTALLATION FAILED"
6+
exit 1
67
fi
78

89
echo "[+] apt"
@@ -14,36 +15,43 @@ pip3 install crccheck unicorn capstone ropper keystone-engine tqdm
1415

1516
echo "[+] install seccomp-tools, one_gadget"
1617
if [ "x$(which seccomp-tools)" = "x" ]; then
17-
gem install seccomp-tools
18+
gem install seccomp-tools
1819
fi
1920

2021
if [ "x$(which one_gadget)" = "x" ]; then
21-
gem install one_gadget
22+
gem install one_gadget
2223
fi
2324

2425
echo "[+] install rp++"
2526
if [ "x$(uname -m)" = "xx86_64" ]; then
26-
if [ "x$(which rp-lin)" = "x" ] && [ ! -e /usr/local/bin/rp-lin ]; then
27-
wget -q https://github.com/0vercl0k/rp/releases/download/v2.1.1/rp-lin-clang.zip -P /tmp
28-
unzip /tmp/rp-lin-clang.zip -d /usr/local/bin/
29-
chmod +x /usr/local/bin/rp-lin
30-
rm /tmp/rp-lin-clang.zip
31-
fi
27+
if [ "x$(which rp-lin)" = "x" ] && [ ! -e /usr/local/bin/rp-lin ]; then
28+
wget -q https://github.com/0vercl0k/rp/releases/download/v2.1.1/rp-lin-clang.zip -P /tmp
29+
unzip /tmp/rp-lin-clang.zip -d /usr/local/bin/
30+
chmod +x /usr/local/bin/rp-lin
31+
rm /tmp/rp-lin-clang.zip
32+
fi
3233
fi
3334

3435
echo "[+] install vmlinux-to-elf"
3536
if [ "x$(which vmlinux-to-elf)" = "x" ] && [ ! -e /usr/local/bin/vmlinux-to-elf ]; then
36-
pip3 install --upgrade lz4 zstandard git+https://github.com/clubby789/python-lzo@b4e39df
37-
pip3 install --upgrade git+https://github.com/marin-m/vmlinux-to-elf
37+
pip3 install --upgrade lz4 zstandard git+https://github.com/clubby789/python-lzo@b4e39df
38+
pip3 install --upgrade git+https://github.com/marin-m/vmlinux-to-elf
3839
fi
3940

4041
echo "[+] download gef"
41-
wget -q https://raw.githubusercontent.com/bata24/gef/dev/gef.py -O /root/.gdbinit-gef.py
42+
if [ -e /root/.gdbinit-gef.py ]; then
43+
echo "[-] /root/.gdbinit-gef.py already exists. Please delete or rename."
44+
echo "[-] INSTALLATION FAILED"
45+
exit 1
46+
else
47+
wget -q https://raw.githubusercontent.com/bata24/gef/dev/gef.py -O /root/.gdbinit-gef.py
48+
fi
4249

4350
echo "[+] setup gef"
4451
STARTUP_COMMAND="source /root/.gdbinit-gef.py"
4552
if [ ! -e /root/.gdbinit ] || [ "x$(grep "$STARTUP_COMMAND" /root/.gdbinit)" = "x" ]; then
46-
echo "$STARTUP_COMMAND" >> /root/.gdbinit
53+
echo "$STARTUP_COMMAND" >> /root/.gdbinit
4754
fi
4855

56+
echo "[+] INSTALLATION SUCCESSFUL"
4957
exit 0

0 commit comments

Comments
 (0)