Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed some cases of the singleton-comparison pitfall #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions peda.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def string_to_argv(self, str):
a = a.strip(",")
if a.startswith("$"): # try to get register/variable value
v = self.parse_and_eval(a)
if v != None and v != "void":
if v is not None and v != "void":
if v.startswith("0x"): # int
args[idx] = v.split()[0] # workaround for 0xdeadbeef <symbol+x>
else: # string, complex data
Expand All @@ -216,7 +216,7 @@ def string_to_argv(self, str):
# XXX hack to avoid builtin functions/types
if not isinstance(v, six.string_types + six.integer_types):
continue
args[idx] = "%s" % (to_hex(v) if to_int(v) != None else v)
args[idx] = "%s" % (to_hex(v) if to_int(v) is not None else v)
except:
pass
if config.Option.get("verbose") == "on":
Expand Down Expand Up @@ -750,7 +750,7 @@ def disassemble(self, *arg):
if "/" in arg[0]:
modif = arg[0]
arg = arg[1:]
if len(arg) == 1 and to_int(arg[0]) != None:
if len(arg) == 1 and to_int(arg[0]) is not None:
arg += [to_hex(to_int(arg[0]) + 32)]

self.execute("set disassembly-flavor intel")
Expand Down Expand Up @@ -1858,7 +1858,7 @@ def xormem(self, start, end, key):
if mem is None:
return None

if to_int(key) != None:
if to_int(key) is not None:
key = hex2str(to_int(key), self.intsize())
mem = list(bytes_iterator(mem))
for index, char in enumerate(mem):
Expand Down