-
Notifications
You must be signed in to change notification settings - Fork 49
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
Adding support for converting swarm hash to STOP and toggling disasse… #17
base: master
Are you sure you want to change the base?
Conversation
…mbling with offsets
@@ -65,10 +67,24 @@ def main(): | |||
if buf_set <= hex_set: # subset | |||
buf = binascii.unhexlify(buf) | |||
|
|||
# replace all swarm hashes with \x00 | |||
if args.no_swarmhash: | |||
while True: #detect multiple swarm hashes, about 700 contracts do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify it by using re.sub
(regex replace). Example:
In [9]: re.sub(b'\x12..', b'\x00'*4, b'\x1234 abc \x1233 \x1234')
Out[9]: b'\x00\x00\x00\x00 abc \x00\x00\x00\x00 \x00\x00\x00\x00'
So here it should probably be (pls check this):
buf = re.sub(b'\xa1ebzzr0X .{34}', b'\x00'*43, buf)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
insns = list(disassemble_all(buf)) | ||
for i in insns: | ||
args.output.write("%08x: %s\n" % (i.pc, str(i))) | ||
if args.no_offsets: | ||
args.output.write("%s\n" % (str(i),)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the (,)
is redundant so it could be % str(i)
but I understand it might be better to leave it s it is.
We could also use "{}\n".format(i)
|
…mbling with offsets