-
Notifications
You must be signed in to change notification settings - Fork 807
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
replace Nasm assembler with Keystone engine #82
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ | |
import traceback | ||
import codecs | ||
|
||
from keystone import * | ||
|
||
# point to absolute path of peda.py | ||
PEDAFILE = os.path.abspath(os.path.expanduser(__file__)) | ||
if os.path.islink(PEDAFILE): | ||
|
@@ -754,7 +756,17 @@ def assemble(self, asmcode, bits=None): | |
""" | ||
if bits is None: | ||
(arch, bits) = self.getarch() | ||
return Nasm.assemble(asmcode, bits) | ||
|
||
if bits == 16: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i know, but this is simple enough that i did not bother. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed now |
||
mode = KS_MODE_16 | ||
if bits == 32: | ||
mode = KS_MODE_32 | ||
if bits == 64: | ||
mode = KS_MODE_64 | ||
|
||
ks = Ks(KS_ARCH_X86, mode) | ||
encoding, count = ks.asm(asmcode) | ||
return encoding | ||
|
||
def disassemble(self, *arg): | ||
""" | ||
|
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.
Please use an helper function instead of putting everything here.