/usr/share/pyshared/tp/netlib/objects/Connect.py is in python-tp-netlib 0.2.5-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from xstruct import pack
from Header import Processed
class Connect(Processed):
"""\
The Connect packet consists of:
* A String, may contain useful information for stat purposes
"""
no = 3
struct = "S"
def __init__(self, sequence, s=""):
Processed.__init__(self, sequence)
# Length is:
# * 4 bytes (uint32 - string length)
# * the string
# * null terminator
#
self.length = 4 + len(s)
self.s = s
def __str__(self):
output = Processed.__str__(self)
output += pack(self.struct, self.s)
return output
|