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

pull/1586/head
Disconnect3d 3 years ago committed by GitHub
parent c33c18c374
commit 871a440a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

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

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

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

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

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

Loading…
Cancel
Save