MCPcopy Create free account
hub / github.com/AutoRecon/AutoRecon / Service

Class Service

autorecon/targets.py:106–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104 return process, stdout, stderr
105
106class Service:
107
108 def __init__(self, protocol, port, name, secure=False):
109 self.target = None
110 self.protocol = protocol.lower()
111 self.port = int(port)
112 self.name = name
113 self.secure = secure
114 self.manual_commands = {}
115
116 @final
117 def tag(self):
118 return self.protocol + '/' + str(self.port) + '/' + self.name
119
120 @final
121 def full_tag(self):
122 return self.protocol + '/' + str(self.port) + '/' + self.name + '/' + ('secure' if self.secure else 'insecure')
123
124 @final
125 def add_manual_commands(self, description, commands):
126 if not isinstance(commands, list):
127 commands = [commands]
128 if description not in self.manual_commands:
129 self.manual_commands[description] = []
130
131 # Merge in new unique commands, while preserving order.
132 [self.manual_commands[description].append(m) for m in commands if m not in self.manual_commands[description]]
133
134 @final
135 def add_manual_command(self, description, command):
136 self.add_manual_commands(description, command)
137
138 @final
139 def info(self, msg):
140 plugin = inspect.currentframe().f_back.f_locals['self']
141 info('{bright}[{yellow}' + self.target.address + '{crst}/{bgreen}' + self.tag() + '/' + plugin.slug + '{crst}]{rst} ' + msg)
142
143 @final
144 def warn(self, msg):
145 plugin = inspect.currentframe().f_back.f_locals['self']
146 warn('{bright}[{yellow}' + self.target.address + '{crst}/{bgreen}' + self.tag() + '/' + plugin.slug + '{crst}]{rst} ' + msg)
147
148 @final
149 def error(self, msg):
150 plugin = inspect.currentframe().f_back.f_locals['self']
151 error('{bright}[{yellow}' + self.target.address + '{crst}/{bgreen}' + self.tag() + '/' + plugin.slug + '{crst}]{rst} ' + msg)
152
153 @final
154 async def execute(self, cmd, blocking=True, outfile=None, errfile=None, future_outfile=None):
155 target = self.target
156
157 # Create variables for command references.
158 address = target.address
159 addressv6 = target.address
160 ipaddress = target.ip
161 ipaddressv6 = target.ip
162 scandir = target.scandir
163 protocol = self.protocol

Callers 3

scan_targetFunction · 0.90
extract_serviceMethod · 0.90
runMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected