MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / SharedDevice

Class SharedDevice

pager_lib/smb/base.py:2990–3040  ·  view source on GitHub ↗

Contains information about a single shared device on the remote server. The following attributes are available: * name : An unicode string containing the name of the shared device * comments : An unicode string containing the user description of the shared device

Source from the content-addressed store, hash-verified

2988 messages_history.append(message)
2989
2990class SharedDevice:
2991 """
2992 Contains information about a single shared device on the remote server.
2993
2994 The following attributes are available:
2995
2996 * name : An unicode string containing the name of the shared device
2997 * comments : An unicode string containing the user description of the shared device
2998 """
2999
3000 # The following constants are taken from [MS-SRVS]: 2.2.2.4
3001 # They are used to identify the type of shared resource from the results from the NetrShareEnum in Server Service RPC
3002 DISK_TREE = 0x00
3003 PRINT_QUEUE = 0x01
3004 COMM_DEVICE = 0x02
3005 IPC = 0x03
3006
3007 def __init__(self, type, name, comments):
3008 self._type = type
3009 self.name = name #: An unicode string containing the name of the shared device
3010 self.comments = comments #: An unicode string containing the user description of the shared device
3011
3012 @property
3013 def type(self):
3014 """
3015 Returns one of the following integral constants.
3016 - SharedDevice.DISK_TREE
3017 - SharedDevice.PRINT_QUEUE
3018 - SharedDevice.COMM_DEVICE
3019 - SharedDevice.IPC
3020 """
3021 return self._type & 0xFFFF
3022
3023 @property
3024 def isSpecial(self):
3025 """
3026 Returns True if this shared device is a special share reserved for interprocess communication (IPC$)
3027 or remote administration of the server (ADMIN$). Can also refer to administrative shares such as
3028 C$, D$, E$, and so forth
3029 """
3030 return bool(self._type & 0x80000000)
3031
3032 @property
3033 def isTemporary(self):
3034 """
3035 Returns True if this is a temporary share that is not persisted for creation each time the file server initializes.
3036 """
3037 return bool(self._type & 0x40000000)
3038
3039 def __unicode__(self):
3040 return 'Shared device: %s (type:0x%02x comments:%s)' % (self.name, self.type, self.comments )
3041
3042
3043class SharedFile:

Callers 1

decodeResultsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected