Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master

Conversation

@sourcery-ai
Copy link
Copy Markdown

@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!

@sourcery-ai sourcery-ai bot requested a review from mightyhouseinc October 5, 2023 08:54

try:
t.halt()
pass
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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:

def __init__(self, bits):
self.bits = bits
self.rpl = bits[0:1]
self.rpl = bits[:1]
Copy link
Copy Markdown
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.base_addr.Append(bits[32:39])
self.base_addr.Append(bits[56:63])
self.limit = bits[0:15]
self.limit = bits[:15]
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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