Skip to content

Conversation

@TAbdiukov
Copy link

Serial interface implementation

  • Originally imported from pwntools,
  • Added extra functions not present in original pwntools (recvline, sendline). Not sure why aren't they there

@masthoon
Copy link
Owner

Thanks for your contribution, actually I would prefer not to add any required dependency to the project (only PythonForWindows).
Can you include a run-time wrapper like capstone/keystone ones so that instancing serialtube would trigger NotImplementedError exception (we should probably raise a ImportError instead)?

@TAbdiukov
Copy link
Author

I am slightly confused. You want to improve the pull request or you don't want the serial implementation entirely ? The former I'm happy to do, but the latter would be somewhat sad, because, as crazy as it is, there is no good Python implementation for serial interface i/o

…ts to some of them (min used in original pwntools; I use max for timeout since it makes more sense). Minor optimisations
@masthoon
Copy link
Owner

Sorry, I want to improve and merge the pull request but I prefer not to impose a new dependency.

Can you remove pyserial dependency from requirements.txt and setup.py?
Then add a runtime check that tell you to install pyserial if you want to use serialtube:

Like this:

class SerialTube(object): # you don't need serial.Serial parent since you use conn
    def __init__(
            self, port = None, baudrate = 115200,
            convert_newlines = True,
            bytesize = 8, parity='N', stopbits=1, xonxoff = False,
            rtscts = False, dsrdtr = False, *a, **kw):
        # you don't need super too
        try:
            import serial
        except ImportError:
           raise(ImportError("pyserial module not found :: Please pip install pyserial==3.0.1"))

It's a bit dirty, if you have a better idea feel free to implement it :)

@TAbdiukov
Copy link
Author

Hey! Sorry for the delay, life's been busy for some months. I'll see if I can fix this

@TAbdiukov
Copy link
Author

@masthoon I think I fixed it? Let me know if I can do anything else

P.S. You may also wanna check out the script at https://github.com/TAbdiukov/pwintools-samples

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