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
Fixed faulty read loop #1239
Fixed faulty read loop #1239
Conversation
Can you add a test for this? Probably easiest to use the runners to exec your shellcode. |
That should be doable, but how do I run a doctest from inside a template? |
@zachriggle I added a doctest the same way as the echo shellcode did it but I don't know how to actually run it. However, if I run the code manually I get the expected result. |
|
||
>>> stage_2 = asm(shellcraft.echo('hello') + "\n" + shellcraft.syscalls.exit(42)) | ||
>>> p = run_assembly(shellcraft.stager(0, len(stage_2))) | ||
>>> for c in stage_2: |
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.
Your indentation is incorrect here. Looks like you added a tab. The error on Travis is a bit misleading, but this is the reason.
**********************************************************************
File "shellcraft/i386.rst", line ?, in default
Failed example:
for c in stage_2:
Exception raised:
Traceback (most recent call last):
File "/opt/python/2.7.14/lib/python2.7/doctest.py", line 1315, in __run
compileflags, 1) in test.globs
File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/sphinx/ext/doctest.py", line 480, in compile
return compile(code, name, self.type, flags, dont_inherit)
File "<doctest default[2]>", line 1
for c in stage_2:
^
SyntaxError: unexpected EOF while parsing
i386 linux stager had socket in wrong register and did not increment the destination pointer register after each read. This PR fixes this issue.