Skip to content

Allow pwntools to load on Windows#1449

Merged
Arusekk merged 2 commits into
Gallopsled:devfrom
peace-maker:windows_load
Mar 16, 2020
Merged

Allow pwntools to load on Windows#1449
Arusekk merged 2 commits into
Gallopsled:devfrom
peace-maker:windows_load

Conversation

@peace-maker

Copy link
Copy Markdown
Member

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 Gallopsled#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.

@Arusekk Arusekk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pwnlib/tubes/ssh.py Outdated
Comment thread pwnlib/ui.py

def testpwnproc(cmd):
import fcntl
import termios

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@peace-maker

Copy link
Copy Markdown
Member Author

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
@peace-maker peace-maker deleted the windows_load branch March 16, 2020 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants