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

Allow pwntools to load on Windows #1449

Merged
merged 2 commits into from Mar 16, 2020
Merged

Conversation

@peace-maker
Copy link
Contributor

peace-maker commented Mar 12, 2020

Fixes loading of pwntools on Windows. from pwn import * works. Most of the tweaks were required around the pwnlib.term module where most functionality got disabled due to modules only supporting linux.

It allows to use some operating system agnostic features of pwntools out of the box.

This is inspired by #996.

Some features fail or even crash (local processes, gdb, assemble/disassemble) and console colors are still not displayed correctly, but those can be addressed separately.

C:\ctfs\pwnable.tw>python start.py
[x�[m] Opening connection to chall.pwnable.tw on port 10000
[x�[m] Opening connection to chall.pwnable.tw on port 10000: Trying 139.162.123.119
[+�[m] Opening connection to chall.pwnable.tw on port 10000: Done
[*�[m] 'C:\\ctfs\\pwnable.tw\\start'
    Arch:     i386-32-little
    RELRO:    No RELRO�[m
    Stack:    No canary found�[m
    NX:       NX disabled�[m
    PIE:      No PIE (0x8048000)�[m
[*�[m] Switching to interactive mode
FLAG{XXXXXXXXXXXX}

I guess eventually tests could be run on AppVeyor or similar.

Fixes loading of pwntools on Windows. `from pwn import *` works.

It allows to use some operating system agnostic features of pwntools out of the box.

This is inspired by #996.

Some features fail or even crash (local processes, gdb, assemble/disassemble)
 and console colors are still not displayed correctly, but those can be addressed separately.
Copy link
Collaborator

Arusekk left a comment

I didn't know it would be so easy to enable loading on windows. :D
The code of term module needs some attention lately, and possibly a rework using more curses, and less assumptions. When you fix the one drawback, I will happily merge your changes.

pwnlib/tubes/ssh.py Outdated Show resolved Hide resolved
@@ -21,6 +19,8 @@
log = getLogger(__name__)

def testpwnproc(cmd):
import fcntl
import termios

This comment has been minimized.

Copy link
@Arusekk

Arusekk Mar 16, 2020

Collaborator

This is good, will also possibly speed up the whole thing, since these imports are just for the tests.

@peace-maker

This comment has been minimized.

Copy link
Contributor Author

peace-maker commented Mar 16, 2020

I didn't know about os.devnull, that's neat.
I have a patch to get console colors working queued up which removes the windows-curses dependency. I'd still submit it even though the terminal handling is to be rewritten soon™️.

@Arusekk Arusekk merged commit c517846 into Gallopsled:dev Mar 16, 2020
1 of 2 checks passed
1 of 2 checks passed
coverage/coveralls Coverage decreased (-3.8%) to 61.945%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@peace-maker peace-maker deleted the peace-maker:windows_load branch Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.