Use pwnlib.util.misc.which instead of gdblib.which.which (#1584)

This commit is contained in:
Disconnect3d 2023-02-20 18:49:28 +01:00 committed by GitHub
parent c33c18c374
commit 871a440a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 13 deletions

View File

@ -1,5 +0,0 @@
:mod:`pwndbg.lib.which` --- pwndbg.lib.which
=============================================
.. automodule:: pwndbg.lib.which
:members:

View File

@ -1,5 +1,4 @@
import pwndbg.commands
import pwndbg.lib.which
import pwndbg.wrappers.checksec

View File

@ -4,7 +4,6 @@ import pwndbg.chain
import pwndbg.commands
import pwndbg.enhance
import pwndbg.gdblib.file
import pwndbg.lib.which
import pwndbg.wrappers.checksec
import pwndbg.wrappers.readelf
from pwndbg.color import message

View File

@ -8,7 +8,6 @@ import pwndbg.chain
import pwndbg.commands
import pwndbg.enhance
import pwndbg.gdblib.file
import pwndbg.lib.which
import pwndbg.wrappers.checksec
import pwndbg.wrappers.readelf
from pwndbg.commands import CommandCategory

View File

@ -4,8 +4,9 @@ Wrapper for shell commands.
import os
from pwnlib.util.misc import which
import pwndbg.commands
import pwndbg.lib.which
from pwndbg.commands import CommandCategory
pwncmd_names = ["asm", "constgrep", "disasm", "pwn", "unhex"]
@ -61,8 +62,8 @@ shellcmd_names = [
"zsh",
]
pwncmds = list(filter(pwndbg.lib.which.which, pwncmd_names))
shellcmds = list(filter(pwndbg.lib.which.which, shellcmd_names))
pwncmds = list(filter(which, pwncmd_names))
shellcmds = list(filter(which, shellcmd_names))
def register_shell_function(cmd, deprecated=False) -> None:

View File

@ -2,8 +2,9 @@ import functools
import subprocess
from subprocess import STDOUT
from pwnlib.util.misc import which
import pwndbg.commands
import pwndbg.lib.which
class OnlyWithCommand:
@ -11,7 +12,7 @@ class OnlyWithCommand:
self.all_cmds = list(map(lambda cmd: cmd[0] if isinstance(cmd, list) else cmd, commands))
for command in commands:
self.cmd = command if isinstance(command, list) else [command]
self.cmd_path = pwndbg.lib.which.which(self.cmd[0])
self.cmd_path = which(self.cmd[0])
if self.cmd_path:
break