-
Notifications
You must be signed in to change notification settings - Fork 745
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
Improve shellcode flexibility #1153
base: dev
Are you sure you want to change the base?
Conversation
I'm also going to test against #1148 after it gets merged. |
There are several things I don't understand about this PR:
if self.ql.code:
# shellcode mode
elif len(self.ql.argv) == 0:
# loaded file mode
else:
# ?? |
Say, you have a shellcode and after
The test for |
Is this a real usecase..? I guess that all other scenarios will break as well since there are some manual adjustments to be made anyway if you want to re-run the same Qiling instance (e.g. clearing hooks, etc.)
My bad, I actually meant to ask what is the difference between |
Of course, consider something like Self Modified Code emulation. Of course, I'm not talking of current implementation can't do but it's quite not flexible. For other scenarios you mentioned, in most cases, we don't need such flexibility. Just take a really simple scenario as an example:
Another scenario as I mentioned already, the shellcode might not be available as the time of creating the
Again, let me clarify my motivation a bit more: Using raw Unicorn bindings is painful and full of tedious work while Qiling sheld a light on this by providing numerous utilities. However, the assumption that the shellcode is already available (and some other internal assumptions as mentioned) as the time of creating |
I think I am starting to understand the direction you're going, but I am still not sure why this cannot happen with the current implementation. A shellcode provided at initialization time has a certain size and Qiling copies it to memory, and... that is pretty much it. Sorry for bothering, but I am trying to understand the justification here. The code around shellcode handling is already messy, and that PR makes it even more messy than it is today. I had some preliminary thoughts about redesigning the way Core, OS and Loader are interacting with each other, by introducing a concept of Process objects (in short, the Loader is static, it loads a Process and had it over to the OS. All the specific process context is saved there instead of being stored on Loader and OS). That would decouple Qiling from a specific program (or shellcode), and let the user load multiple processes on the same Qiling instance. I would use this usecase as an additional incentive to drive this re-design. |
But still, I would like to somehow support
Incorrect. The length of
Any estimation on this? This looks cleaner indeed. |
Checklist
Which kind of PR do you create?
Coding convention?
Extra tests?
Changelog?
Target branch?
One last thing
This PR is based on my previous mem slicing PR #1151, which is also one of several phases to make Qiling a bit more pythonic and easy to use.
The motivation of this PR is that, the current implementation is rather not flexible for shellcode usage, e.g.
Qiling.__init__
.ql.run
.In general, the previous design assumes that only one shellcode is written and never changed and thus this PR improves flexibility.
I also removed
qilingcode
dirty hack, which is a very old bad design and I believe shouldn't exist anymore.