mirror of https://github.com/pwndbg/pwndbg
asm command: fix default arch
Before this commit, running `asm mov rax, 0xdeadbeef` would not work on amd64 targets because the default arch was set in the argparse default argument value and it was populated once. Now, this `default=...` kwarg is not set and instead we fetch current arch inside the `asm` command directly when the user did not pass any architecture value.
This commit is contained in:
parent
994505b8be
commit
2cb8a4e070
|
@ -16,7 +16,6 @@ parser.add_argument(
|
|||
|
||||
parser.add_argument(
|
||||
"--arch",
|
||||
default=pwnlib.context.context.arch,
|
||||
choices=pwnlib.context.context.architectures.keys(),
|
||||
type=str,
|
||||
help="Target architecture",
|
||||
|
@ -63,6 +62,9 @@ def asm(shellcode, format, arch, avoid, infile) -> None:
|
|||
with open(infile) as file:
|
||||
shellcode = [file.read()]
|
||||
|
||||
if not arch:
|
||||
arch = pwnlib.context.context.arch
|
||||
|
||||
bits_for_arch = pwnlib.context.context.architectures.get(arch, {}).get("bits")
|
||||
assembly = pwnlib.asm.asm(" ".join(shellcode), arch=arch, bits=bits_for_arch)
|
||||
|
||||
|
|
Loading…
Reference in New Issue