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

Dev3 #1343

Merged
merged 14 commits into from Sep 23, 2019

Conversation

@colinmkinsella
Copy link
Contributor

commented Sep 22, 2019

This pull request is for updating the Dockerfile to use python3. There were a few errors and warnings that I cleaned up as part of the process.

cK added 13 commits Sep 22, 2019
Removed the < 1.8.0 requirement for sphinx. It appeared no longer
necessary.

Alphabetized the listing for easier searching.

Moved the requirements file under the docker folder. Docker does not
like relative paths to parent directories due to security restrictions.
Moving the imports to the beginning of the file resolved the issue.

The following errors were popping up during testing within Docker:

Document: rop/srop
------------------
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.recvline()
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/doctest.py", line 1321, in __run
        compileflags, 1), test.globs)
      File "<doctest default[18]>", line 1, in <module>
        p.recvline()
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 467, in recvline
        return self.recvuntil(self.newline, drop = not keepends, timeout = timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 310, in recvuntil
        res = self.recv(timeout=self.timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 82, in recv
        return self._recv(numb, timeout) or b''
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 160, in _recv
        if not self.buffer and not self._fillbuffer(timeout):
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 131, in _fillbuffer
        data = self.recv_raw(self.buffer.get_fill_size())
      File "/home/travis/pwntools/pwnlib/tubes/process.py", line 707, in recv_raw
        raise EOFError
    EOFError
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.poll(block=True)
Expected:
    0
Got:
    -11
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.recvline()
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/doctest.py", line 1321, in __run
        compileflags, 1), test.globs)
      File "<doctest default[18]>", line 1, in <module>
        p.recvline()
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 467, in recvline
        return self.recvuntil(self.newline, drop = not keepends, timeout = timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 310, in recvuntil
        res = self.recv(timeout=self.timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 82, in recv
        return self._recv(numb, timeout) or b''
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 160, in _recv
        if not self.buffer and not self._fillbuffer(timeout):
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 131, in _fillbuffer
        data = self.recv_raw(self.buffer.get_fill_size())
      File "/home/travis/pwntools/pwnlib/tubes/process.py", line 707, in recv_raw
        raise EOFError
    EOFError
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.poll(block=True)
Expected:
    0
Got:
    -11
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.recvline()
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/doctest.py", line 1321, in __run
        compileflags, 1), test.globs)
      File "<doctest default[18]>", line 1, in <module>
        p.recvline()
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 467, in recvline
        return self.recvuntil(self.newline, drop = not keepends, timeout = timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 310, in recvuntil
        res = self.recv(timeout=self.timeout)
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 82, in recv
        return self._recv(numb, timeout) or b''
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 160, in _recv
        if not self.buffer and not self._fillbuffer(timeout):
      File "/home/travis/pwntools/pwnlib/tubes/tube.py", line 131, in _fillbuffer
        data = self.recv_raw(self.buffer.get_fill_size())
      File "/home/travis/pwntools/pwnlib/tubes/process.py", line 707, in recv_raw
        raise EOFError
    EOFError
**********************************************************************
File "rop/srop.rst", line ?, in default
Failed example:
    p.poll(block=True)
Expected:
    0
Got:
    -11
**********************************************************************
1 items had failures:
   6 of 159 in default
159 tests in 1 items.
153 passed and 6 failed.
***Test Failed*** 6 failures.
The following warning is resolved with this fix:

/home/travis/pwntools/pwnlib/dynelf.py:docstring of pwnlib.dynelf.DynELF._resolve_symbol_sysv:11: WARNING: Definition list ends without a blank line; unexpected unindent.
The following warnings are resolved with this fix:

/home/travis/pwntools/pwnlib/gdb.py:docstring of pwnlib.gdb.debug_assembly:8: WARNING: Inline strong start-string without end-string.
/home/travis/pwntools/pwnlib/gdb.py:docstring of pwnlib.gdb.debug_assembly:21: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/travis/pwntools/pwnlib/gdb.py:docstring of pwnlib.gdb.debug_shellcode:4: WARNING: Inline strong start-string without end-string.
/home/travis/pwntools/pwnlib/gdb.py:docstring of pwnlib.gdb.debug_shellcode:17: WARNING: Block quote ends without a blank line; unexpected unindent.
The following error is resolved with this fix:

Document: protocols/adb
-----------------------
**********************************************************************
File "../../pwnlib/protocols/adb/__init__.py", line ?, in default
Failed example:
    pprint(AdbClient().list('/data/user'))
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/doctest.py", line 1321, in __run
        compileflags, 1), test.globs)
      File "<doctest default[0]>", line 1, in <module>
        pprint(AdbClient().list('/data/user'))
    TypeError: 'module' object is not callable
**********************************************************************
1 items had failures:
   1 of  10 in default
10 tests in 1 items.
9 passed and 1 failed.
***Test Failed*** 1 failures.

The following warning is resolved with this fix:

/home/travis/pwntools/pwnlib/protocols/adb/__init__.py:docstring of pwnlib.protocols.adb.AdbClient.stat:6: WARNING: Inline literal start-string without end-string.
The following warning is resolved with this fix:

/home/travis/pwntools/pwnlib/rop/rop.py:docstring of pwnlib.rop.rop.DescriptiveStack.descriptions:3: WARNING: Inline literal start-string without end-string.
The following warning is resolved with this fix:

/home/travis/pwntools/pwnlib/tubes/ssh.py:docstring of pwnlib.tubes.ssh.ssh._init_remote_platform_info:6: WARNING: Block quote ends without a blank line; unexpected unindent.
There was an ordering problem while running the doctest in misc.py.
Sorting the dictionary with pprint and updating the results fixed the
issue.

Document: util/misc
-------------------
**********************************************************************
File "../../pwnlib/util/misc.py", line ?, in default
Failed example:
    sizes
Expected:
    {'eax': 32, 'ax': 16, 'al': 8, 'ah': 8, 'ebx': 32, 'bx': 16, 'bl': 8, 'bh': 8, 'ecx': 32, 'cx': 16, 'cl': 8, 'ch': 8, 'edx': 32, 'dx': 16, 'dl': 8, 'dh': 8, 'edi': 32, 'di': 16, 'esi': 32, 'si': 16, 'ebp': 32, 'bp': 16, 'esp': 32, 'sp': 16}
Got:
    {'si': 16, 'cx': 16, 'cl': 8, 'dl': 8, 'dh': 8, 'eax': 32, 'bx': 16, 'sp': 16, 'bl': 8, 'bh': 8, 'di': 16, 'esi': 32, 'edx': 32, 'dx': 16, 'ebx': 32, 'ebp': 32, 'ax': 16, 'ch': 8, 'al': 8, 'ah': 8, 'edi': 32, 'esp': 32, 'bp': 16, 'ecx': 32}
**********************************************************************
File "../../pwnlib/util/misc.py", line ?, in default
Failed example:
    bigger
Expected:
    {'eax': ['eax'], 'ax': ['eax', 'ax'], 'al': ['eax', 'ax', 'al'], 'ah': ['eax', 'ax', 'ah'], 'ebx': ['ebx'], 'bx': ['ebx', 'bx'], 'bl': ['ebx', 'bx', 'bl'], 'bh': ['ebx', 'bx', 'bh'], 'ecx': ['ecx'], 'cx': ['ecx', 'cx'], 'cl': ['ecx', 'cx', 'cl'], 'ch': ['ecx', 'cx', 'ch'], 'edx': ['edx'], 'dx': ['edx', 'dx'], 'dl': ['edx', 'dx', 'dl'], 'dh': ['edx', 'dx', 'dh'], 'edi': ['edi'], 'di': ['edi', 'di'], 'esi': ['esi'], 'si': ['esi', 'si'], 'ebp': ['ebp'], 'bp': ['ebp', 'bp'], 'esp': ['esp'], 'sp': ['esp', 'sp']}
Got:
    {'si': ['esi', 'si'], 'cx': ['ecx', 'cx'], 'cl': ['ecx', 'cx', 'cl'], 'dl': ['edx', 'dx', 'dl'], 'dh': ['edx', 'dx', 'dh'], 'eax': ['eax'], 'bx': ['ebx', 'bx'], 'sp': ['esp', 'sp'], 'bl': ['ebx', 'bx', 'bl'], 'bh': ['ebx', 'bx', 'bh'], 'di': ['edi', 'di'], 'esi': ['esi'], 'edx': ['edx'], 'dx': ['edx', 'dx'], 'ebx': ['ebx'], 'ebp': ['ebp'], 'ax': ['eax', 'ax'], 'ch': ['ecx', 'cx', 'ch'], 'al': ['eax', 'ax', 'al'], 'ah': ['eax', 'ax', 'ah'], 'edi': ['edi'], 'esp': ['esp'], 'bp': ['ebp', 'bp'], 'ecx': ['ecx']}
**********************************************************************
File "../../pwnlib/util/misc.py", line ?, in default
Failed example:
    smaller
Expected:
    {'eax': ['ax', 'al', 'ah'], 'ax': ['al', 'ah'], 'al': [], 'ah': [], 'ebx': ['bx', 'bl', 'bh'], 'bx': ['bl', 'bh'], 'bl': [], 'bh': [], 'ecx': ['cx', 'cl', 'ch'], 'cx': ['cl', 'ch'], 'cl': [], 'ch': [], 'edx': ['dx', 'dl', 'dh'], 'dx': ['dl', 'dh'], 'dl': [], 'dh': [], 'edi': ['di'], 'di': [], 'esi': ['si'], 'si': [], 'ebp': ['bp'], 'bp': [], 'esp': ['sp'], 'sp': []}
Got:
    {'si': [], 'cx': ['cl', 'ch'], 'cl': [], 'dl': [], 'dh': [], 'eax': ['ax', 'al', 'ah'], 'bx': ['bl', 'bh'], 'sp': [], 'bl': [], 'bh': [], 'di': [], 'esi': ['si'], 'edx': ['dx', 'dl', 'dh'], 'dx': ['dl', 'dh'], 'ebx': ['bx', 'bl', 'bh'], 'ebp': ['bp'], 'ax': ['al', 'ah'], 'ch': [], 'al': [], 'ah': [], 'edi': ['di'], 'esp': ['sp'], 'bp': [], 'ecx': ['cx', 'cl', 'ch']}
**********************************************************************
1 items had failures:
   3 of  20 in default
20 tests in 1 items.
17 passed and 3 failed.
***Test Failed*** 3 failures.
The following warning is resolved with this fix:

/home/travis/pwntools/pwnlib/util/packing.py:docstring of pwnlib.util.packing.flat:2: WARNING: Inline emphasis start-string without end-string.
Forgot to update the location of requirements.txt in .travis.yml.
Copy link
Collaborator

left a comment

Most changes look great, the sphinx warnings were really annoying, thanks for resolving them. But there are also some changes I don't understand or find unsuitable, see the comments.

pwnlib/rop/srop.py Outdated Show resolved Hide resolved
pwnlib/tubes/ssh.py Outdated Show resolved Hide resolved
pwnlib/util/misc.py Outdated Show resolved Hide resolved
pwnlib/util/packing.py Outdated Show resolved Hide resolved
travis/docker/requirements.txt Outdated Show resolved Hide resolved
pwnlib/gdb.py Outdated Show resolved Hide resolved
pwnlib/gdb.py Outdated Show resolved Hide resolved
pwnlib/dynelf.py Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
travis/docker/Dockerfile Outdated Show resolved Hide resolved
Copy link
Collaborator

left a comment

@Arusekk

This comment has been minimized.

Copy link
Collaborator

commented on f43a779 Sep 22, 2019

Returncode -11 means SIGSEGV, which is normal for me in my testing setup (not sure why this passes on Travis, though). I think that this change just removed those tests.

@colinmkinsella

This comment has been minimized.

Copy link
Contributor Author

commented Sep 22, 2019

Thanks for all the feedback! I am working to make the changes.

Copy link
Contributor Author

left a comment

All changes should be made. Please let me know if you see anything else.

@Arusekk Arusekk merged commit 1566c90 into Gallopsled:dev3 Sep 23, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+2.9%) to 61.942%
Details
@colinmkinsella

This comment has been minimized.

Copy link
Contributor Author

commented Sep 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.