Modules¶
- exception pManager.modules.fileParser.ConfigurationError(message, filename=None)[source]¶
Bases:
ParserErrorException raised for configuration-related errors during file parsing.
- exception pManager.modules.fileParser.FormatError(message, filename=None)[source]¶
Bases:
ParserErrorException raised for errors in the file format.
- exception pManager.modules.fileParser.ParserError(message, filename=None)[source]¶
Bases:
ExceptionBase class for exceptions in the parser module.
- exception pManager.modules.fileParser.UnknownPortError(message, filename=None)[source]¶
Bases:
ParserErrorException raised when an unknown port is encountered during parsing.
- exception pManager.modules.fileParser.UnknownServiceError(message, filename=None)[source]¶
Bases:
ParserErrorException raised when an unknown service is encountered during parsing.
- class pManager.modules.fileParser.fileParser(filename, ignoreExtension=False)[source]¶
Bases:
objectClass for parsing .qpmgr file
- getBeautifuledInfoByService(serviceName) str[source]¶
Returns string with beautifuled information about the service by it’s name
- Parameters:
serviceName (str) – Name of the service
- Returns:
String with beautifuled information about the service
- Return type:
str
- getClosedPorts() list[source]¶
Returns list of closed ports
- Returns:
List of closed ports
- Return type:
list
- getDescriptionByPort(portNum) str[source]¶
Returns description of the port by its number
- Parameters:
portNum (int) – Number of the port
- Returns:
Description of the port
- Return type:
str
- getDescriptionByService(serviceName) str[source]¶
Returns description of the service by it’s name
- Parameters:
serviceName (str) – Name of the service
- Returns:
Description of the service
- Return type:
str
- getOpenedPorts() list[source]¶
Returns list of opened ports
- Returns:
List of opened ports
- Return type:
list
- getOpenedPortsByService(serviceName) list[source]¶
Returns list of opened ports by service
- Parameters:
serviceName (str) – Name of the service
- Returns:
List of opened ports
- Return type:
list
- getPlainPortList() dict[source]¶
Returns dictionary with plain port list
- Returns:
Plain port list
- Return type:
dict
- getPlainServiceList() dict[source]¶
Returns dictionary with plain service list
- Returns:
Plain service list
- Return type:
dict
- getProtocolByPort(portNum) str[source]¶
Returns protocol of the port by its number
- Parameters:
portNum (int) – Number of the port
- Returns:
Protocol of the port
- Return type:
str
- exception pManager.modules.fileWriter.WriterError(message, filename=None)[source]¶
Bases:
ExceptionBase class for exceptions in the writer module.
- class pManager.modules.fileWriter.fileWriter(filename, autoFlush=True, ignoreExtension=False)[source]¶
Bases:
objectClass for writing or updating .qpmgr files
- addPort(portObj: Port)[source]¶
Adds port to existing service
- Parameters:
portObj (pManager.dataModels.models.Port) – Port object
- Raises:
WriterError – If the port object is not of type Port
- addService(serviceObj: Service)[source]¶
Adds service to the list
- Parameters:
serviceObj (pManager.dataModels.models.Service) – Service object
- Raises:
WriterError – If the service object is not of type Service
- bindPortToService(serviceName, portNum, portProto, openState, portDesc='No description') Port[source]¶
Binds port to existing service
- Parameters:
serviceName (str) – Name (key) of the service
portNum (int) – Port number
portProto (str) – Protocol of the port
openState (bool) – State of the port
portDesc (str) – Description of the port
- Returns:
Port object that was created
- Return type:
- constructServiceObj(serviceName, serviceDescription='No description', portList=None) Service[source]¶
Creates service object and adds it to the list
- Parameters:
serviceName (str) – Name of the service
serviceDescription (str) – Description of the service
portList (dict) – Dictionary of ports, where key is port number and value is port object
- Returns:
Created service object
- Return type: