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

Sourcery refactored master branch #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 5, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@@ -8,7 +8,6 @@

try:
t.halt()
pass
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 11-11 refactored with the following changes:

Comment on lines -7 to +8
registers = []
register_list = ["eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp", "eip"]
for reg in register_list:
registers.append((reg, thread.arch_register(reg)))
return registers
return [(reg, thread.arch_register(reg)) for reg in register_list]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_registers refactored with the following changes:

Comment on lines -16 to +13

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function print_registers refactored with the following changes:

Comment on lines -86 to +83
ret = t.mem(ss.ToHex() + ":" + reg("esp").ToHex(), 4)
ret = t.mem(f"{ss.ToHex()}:" + reg("esp").ToHex(), 4)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function pop refactored with the following changes:

Comment on lines -169 to +172
segment = GDTEntry(t.memblock(str(base.ToUInt32() + 8 * idx.ToUInt32()) + "L", 8, 1))
segment = GDTEntry(
t.memblock(f"{str(base.ToUInt32() + 8 * idx.ToUInt32())}L", 8, 1)
)
limit = segment.limit
print("ESP : %s" % esp.ToHex())
print(f"ESP : {esp.ToHex()}")
esp = esp & ~0xF
t.memdump(ss.ToHex() + ":" + esp.ToHex(), limit - esp, 1)
t.memdump(f"{ss.ToHex()}:{esp.ToHex()}", limit - esp, 1)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function printStackContent refactored with the following changes:

self.rpl = bits[0:1]
self.rpl = bits[:1]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Selector.__init__ refactored with the following changes:

self.limit = bits[0:15]
self.limit = bits[:15]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function GDTEntry.__init__ refactored with the following changes:

Comment on lines -78 to +83
self.offset = bits[0:15]
self.offset = bits[:15]
self.offset.Append(bits[48:63])
self.selector = bits[16:31]
self.zero = bits[32:39]
self.type_attr = bits[40:47]
self.gate_type = self.type_attr[0:3]
self.gate_type = self.type_attr[:3]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function IDTEntry.__init__ refactored with the following changes:

Comment on lines -118 to +122
segment = t.memblock(str(base.ToUInt32() + 8 * i) + "L", 8, 1)
if name == "IDT":
entry = IDTEntry(segment)
else:
entry = GDTEntry(segment)
segment = t.memblock(f"{str(base.ToUInt32() + 8 * i)}L", 8, 1)
entry = IDTEntry(segment) if name == "IDT" else GDTEntry(segment)
if entry.pr:
print("**** %s Entry %d ****" % (name, i))
print("%s" % str(entry))
print(f"{str(entry)}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function print_segment refactored with the following changes:

Comment on lines -156 to +155
segment = t.memblock(str(base.ToUInt32() + 8 * idx) + "L", 8, 1)
segment = t.memblock(f"{str(base.ToUInt32() + 8 * idx)}L", 8, 1)
entry = GDTEntry(segment)
if addr < entry.limit:
return entry.base_addr + addr
else:
return None
return entry.base_addr + addr if addr < entry.limit else None
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function segment_addr_to_linear refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants