-
-
Notifications
You must be signed in to change notification settings - Fork 746
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update
nop
command to patch entire instructions (#959)
* The default behavior to `nop` is to patch entire instruction(s) unless indicated otherwise via the `--b` toggle * `--n` can be used to specify the number of nops to insert
- Loading branch information
1 parent
0fd751e
commit 74e8626
Showing
3 changed files
with
88 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
## Command `nop` | ||
|
||
The `nop` command allows you to easily skip instructions. | ||
The `nop` command allows you to easily patch instructions with nops. | ||
|
||
``` | ||
gef ➤ help nop | ||
Patch the instruction(s) pointed by parameters with NOP. Note: this command is architecture | ||
aware. | ||
Syntax: nop [LOCATION] [--nb NUM_BYTES] | ||
LOCATION address/symbol to patch | ||
--nb NUM_BYTES Instead of writing one instruction, patch the specified number of bytes | ||
nop [LOCATION] [--n NUM_ITEMS] [--b] | ||
``` | ||
|
||
`LOCATION` indicates the address of the instruction to bypass. If not | ||
specified, it will use the current value of the program counter. | ||
`LOCATION` address/symbol to patch | ||
|
||
If `--nb <bytes>` is entered, gef will explicitly patch the specified number of | ||
bytes. Otherwise it will patch the _whole_ instruction at the target location. | ||
`--n NUM_ITEMS` Instead of writing one instruction/nop, patch the specified number of instructions/nops (full instruction size by default) | ||
|
||
`--b` Instead of writing full instruction size, patch the specified number of nops | ||
|
||
```bash | ||
gef➤ nop | ||
gef➤ nop $pc+3 | ||
gef➤ nop --n 2 $pc+3 | ||
gef➤ nop --b | ||
gef➤ nop --b $pc+3 | ||
gef➤ nop --b --n 2 $pc+3 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters