diff --git a/pwndbg/commands/__init__.py b/pwndbg/commands/__init__.py index 3f44861ba..c5e0e8a4e 100644 --- a/pwndbg/commands/__init__.py +++ b/pwndbg/commands/__init__.py @@ -52,7 +52,7 @@ def list_current_commands(): line = line.strip() # Skip non-command entries if ( - len(line) == 0 + not line or line.startswith("Command class:") or line.startswith("Unclassified commands") ): diff --git a/pwndbg/commands/nearpc.py b/pwndbg/commands/nearpc.py index 81df359e5..5040d4774 100644 --- a/pwndbg/commands/nearpc.py +++ b/pwndbg/commands/nearpc.py @@ -191,7 +191,7 @@ def nearpc(pc=None, lines=None, to_string=False, emulate=False): # Otherwise if it's a branch and it *is* contiguous, just put # and empty line. elif prev and any(g in prev.groups for g in (CS_GRP_CALL, CS_GRP_JUMP, CS_GRP_RET)): - if len("%s" % nearpc_branch_marker_contiguous) > 0: + if nearpc_branch_marker_contiguous: result.append("%s" % nearpc_branch_marker_contiguous) # For syscall instructions, put the name on the side diff --git a/pwndbg/hexdump.py b/pwndbg/hexdump.py index 6ca58438b..f46e14f7c 100644 --- a/pwndbg/hexdump.py +++ b/pwndbg/hexdump.py @@ -87,7 +87,7 @@ def hexdump( load_color_scheme() # If there's nothing to print, just print the offset and address and return - if len(data) == 0: + if not data: yield H.offset("+%04x " % len(data)) + H.address("%#08x " % (address + len(data))) # Don't allow iterating over this generator again diff --git a/pwndbg/lib/memory.py b/pwndbg/lib/memory.py index 78880cd99..32d21046f 100644 --- a/pwndbg/lib/memory.py +++ b/pwndbg/lib/memory.py @@ -94,7 +94,7 @@ class Page: @property def is_memory_mapped_file(self) -> bool: - return len(self.objfile) > 0 and self.objfile[0] != "[" and self.objfile != "" + return self.objfile and self.objfile[0] != "[" and self.objfile != "" @property def read(self) -> bool: