MCPcopy
hub / github.com/owtf/owtf / RunCommand

Method RunCommand

owtf/plugin/helper.py:186–213  ·  view source on GitHub ↗
(self, Command, PluginInfo, PluginOutputDir)

Source from the content-addressed store, hash-verified

184 return PluginOutputDir
185
186 def RunCommand(self, Command, PluginInfo, PluginOutputDir):
187 FrameworkAbort = PluginAbort = False
188 if not PluginOutputDir:
189 PluginOutputDir = self.InitPluginOutputDir(PluginInfo)
190 timer.start_timer("FormatCommandAndOutput")
191 ModifiedCommand = shell.get_modified_shell_cmd(Command, PluginOutputDir)
192
193 try:
194 RawOutput = shell.shell_exec_monitor(
195 self.session, ModifiedCommand, PluginInfo
196 )
197 except PluginAbortException as PartialOutput:
198 RawOutput = str(PartialOutput.parameter) # Save Partial Output
199 PluginAbort = True
200 except FrameworkAbortException as PartialOutput:
201 RawOutput = str(PartialOutput.parameter) # Save Partial Output
202 FrameworkAbort = True
203 TimeStr = timer.get_elapsed_time_as_str("FormatCommandAndOutput")
204 logging.info("Time=%s", TimeStr)
205 out = [
206 ModifiedCommand,
207 FrameworkAbort,
208 PluginAbort,
209 TimeStr,
210 RawOutput,
211 PluginOutputDir,
212 ]
213 return out
214
215 def GetCommandOutputFileNameAndExtension(self, InputName):
216 OutputName = InputName

Callers 1

CommandDumpMethod · 0.95

Calls 5

InitPluginOutputDirMethod · 0.95
start_timerMethod · 0.80
shell_exec_monitorMethod · 0.80

Tested by

no test coverage detected