Linux ip-148-66-134-25.ip.secureserver.net 3.10.0-1160.119.1.el7.tuxcare.els10.x86_64 #1 SMP Fri Oct 11 21:40:41 UTC 2024 x86_64
Apache
: 148.66.134.25 | : 18.188.140.232
66 Domain
8.0.30
amvm
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
pyserial-2.6 /
examples /
[ HOME SHELL ]
Name
Size
Permission
Action
enhancedserial.py
2.12
KB
-rw-r--r--
port_publisher.py
17.05
KB
-rw-r--r--
port_publisher.sh
1.03
KB
-rw-r--r--
rfc2217_server.py
6.53
KB
-rw-r--r--
scan.py
762
B
-rw-r--r--
scanlinux.py
481
B
-rw-r--r--
scanwin32.py
7.9
KB
-rw-r--r--
setup-miniterm-py2exe.py
609
B
-rw-r--r--
setup-rfc2217_server-py2exe.py
518
B
-rw-r--r--
setup-wxTerminal-py2exe.py
917
B
-rw-r--r--
tcp_serial_redirect.py
10.28
KB
-rw-r--r--
wxSerialConfigDialog.py
11.5
KB
-rw-r--r--
wxSerialConfigDialog.wxg
13.22
KB
-rw-r--r--
wxTerminal.py
13.21
KB
-rw-r--r--
wxTerminal.wxg
5.51
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : enhancedserial.py
#!/usr/bin/env python """Enhanced Serial Port class part of pyserial (http://pyserial.sf.net) (C)2002 cliechti@gmx.net another implementation of the readline and readlines method. this one should be more efficient because a bunch of characters are read on each access, but the drawback is that a timeout must be specified to make it work (enforced by the class __init__). this class could be enhanced with a read_until() method and more like found in the telnetlib. """ from serial import Serial class EnhancedSerial(Serial): def __init__(self, *args, **kwargs): #ensure that a reasonable timeout is set timeout = kwargs.get('timeout',0.1) if timeout < 0.01: timeout = 0.1 kwargs['timeout'] = timeout Serial.__init__(self, *args, **kwargs) self.buf = '' def readline(self, maxsize=None, timeout=1): """maxsize is ignored, timeout in seconds is the max time that is way for a complete line""" tries = 0 while 1: self.buf += self.read(512) pos = self.buf.find('\n') if pos >= 0: line, self.buf = self.buf[:pos+1], self.buf[pos+1:] return line tries += 1 if tries * self.timeout > timeout: break line, self.buf = self.buf, '' return line def readlines(self, sizehint=None, timeout=1): """read all lines that are available. abort after timout when no more data arrives.""" lines = [] while 1: line = self.readline(timeout=timeout) if line: lines.append(line) if not line or line[-1:] != '\n': break return lines if __name__=='__main__': #do some simple tests with a Loopback HW (see test.py for details) PORT = 0 #test, only with Loopback HW (shortcut RX/TX pins (3+4 on DSUB 9 and 25) ) s = EnhancedSerial(PORT) #write out some test data lines s.write('\n'.join("hello how are you".split())) #and read them back print s.readlines() #this one should print an empty list print s.readlines(timeout=0.4)
Close