Gallopsled / Gallopsled/pwntools

shellcraft.mov does not support AH, BH, etc. registers

Open
#1,046 1 comment 0 reactions 0 assignees View on GitHub
enhancement Hacktoberfest help-wanted shellcode
Dominant language
Python
Stars
13.7k
Forks
1.9k
Avg merge
6d 23h
Merged PRs (30d)
3

Description

```python
from pwn import *
# context.arch = 'i386'
print shellcraft.mov('eax', 'ah')
```
Expected:
`movzx eax, ah`

Result:
```
NameError: name 'ah' is not defined
```

The error is raised when trying to eval `ah` as a system-constant value

But the real reason is `ah` is not defined in `shellcraft/registers.py` as a register in `i386`.

Issue occurs in `amd64` as well.

Contributor guide

Open the contributing guide

Research direction

Start in shellcraft/registers.py and reproduce the shellcraft.mov('eax', 'ah') example from the issue for i386 and amd64. Define the missing registers so they are recognized instead of evaluated as system constants, and confirm the result produces the expected movzx instruction.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
54/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.