OXIESEC PANEL
- Current Dir:
/
/
snap
/
core
/
17210
/
usr
/
lib
/
python3
/
dist-packages
/
serial
/
urlhandler
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/02/2024 07:52:55 PM
rwxr-xr-x
📄
__init__.py
0 bytes
08/02/2015 10:00:41 PM
rw-r--r--
📁
__pycache__
-
10/02/2024 07:52:55 PM
rwxr-xr-x
📄
protocol_alt.py
1.65 KB
12/16/2015 09:50:43 PM
rw-r--r--
📄
protocol_hwgrep.py
2.97 KB
12/22/2015 09:46:21 PM
rw-r--r--
📄
protocol_loop.py
9.26 KB
12/16/2015 09:51:40 PM
rw-r--r--
📄
protocol_rfc2217.py
269 bytes
12/16/2015 10:01:16 PM
rw-r--r--
📄
protocol_socket.py
9.6 KB
12/16/2015 10:00:53 PM
rw-r--r--
📄
protocol_spy.py
8.1 KB
12/16/2015 09:51:07 PM
rw-r--r--
Editing: protocol_alt.py
Close
#! python # # This module implements a special URL handler that allows selecting an # alternate implementation provided by some backends. # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C) 2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause # # URL format: alt://port[?option[=value][&option[=value]]] # options: # - class=X used class named X instead of Serial # # example: # use poll based implementation on Posix (Linux): # python -m serial.tools.miniterm alt:///dev/ttyUSB0?class=PosixPollSerial import sys import time import serial try: import urlparse except ImportError: import urllib.parse as urlparse def serial_class_for_url(url): """extract host and port from an URL string""" parts = urlparse.urlsplit(url) if parts.scheme != 'alt': raise serial.SerialException('expected a string in the form "alt://port[?option[=value][&option[=value]]]": not starting with alt:// (%r)' % (parts.scheme,)) class_name = 'Serial' try: for option, values in urlparse.parse_qs(parts.query, True).items(): if option == 'class': class_name = values[0] else: raise ValueError('unknown option: %r' % (option,)) except ValueError as e: raise serial.SerialException('expected a string in the form "alt://port[?option[=value][&option[=value]]]": %s' % e) return (''.join([parts.netloc, parts.path]), getattr(serial, class_name)) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if __name__ == '__main__': s = serial_for_url('alt:///dev/ttyS0?class=PosixPollSerial') print(s)