com.securitycentric.metacoretex.lib
Class AbstractCommandProbe

java.lang.Object
  extended bycom.securitycentric.metacoretex.lib.AbstractProbe
      extended bycom.securitycentric.metacoretex.lib.AbstractCommandProbe
All Implemented Interfaces:
CommandProbe, Probe, java.lang.Runnable

public abstract class AbstractCommandProbe
extends AbstractProbe
implements CommandProbe

Command Probes are used to run an operating system command or tool agains the target system and store the output in the KB/Report. Probes of this type should add their information under the KB key "command/asdfasdf" where asdfasdf is the name of the command. STDOUT output from the command will be automatically added to the report. This is one of the few probe types which don't require the developer to implement their own probe() method.

Author:
visigoth

Field Summary
 java.lang.String args
          command line arguments for cmd
 java.lang.String cmd
          the command to run
 java.lang.String key
          the KB key to use in setting this information in the KB
 
Fields inherited from class com.securitycentric.metacoretex.lib.AbstractProbe
copyright, depVect, enabled, familyStr, helpStr, nameStr, options, pException, probeId, provHash, reportable, repStr, safe, severity, target, timeout, unspec, version
 
Constructor Summary
AbstractCommandProbe()
           
 
Method Summary
 java.lang.String getArgs()
          Return the arguments string for this command probe.
 java.lang.String getCommand()
          Get a String of the command which this probe will execute on probe().
 java.lang.String getKbKey()
          Get the KB key (String) which is set by this probe.
 void probe()
          This Abstract probe implements is't own probe() method, because command probes are just regular commands who'se output ends up in the report.
 void setArgs(java.lang.String args)
          Set the arguments to the command.
 void setCommand(java.lang.String cmd)
          Set the cmd string which is used to exec the probe
 void setKbKey(java.lang.String key)
          Set the KB key which this probe will use to store the STDOUT results of the command on execution.
 
Methods inherited from class com.securitycentric.metacoretex.lib.AbstractProbe
addDepends, addOption, addProvides, addReport, depends, dumpOptions, getCopyright, getException, getFamily, getHelp, getHost, getName, getOption, getOptionKeys, getProbeId, getReport, getSeverity, getTarget, getTimeout, getVersion, hasSafe, isEnabled, isReportable, kbGet, kbHas, kbPut, probeSafe, provides, replaceOptions, run, setCopyright, setEnabled, setFamily, setHelp, setName, setProbeId, setReport, setReportable, setSeverity, setTarget, setTimeout, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.securitycentric.metacoretex.interfaces.Probe
addDepends, addOption, addProvides, addReport, depends, dumpOptions, getCopyright, getException, getFamily, getHelp, getHost, getName, getOption, getOptionKeys, getProbeId, getReport, getSeverity, getTarget, getTimeout, getVersion, hasSafe, isEnabled, isReportable, kbGet, kbHas, kbPut, probeSafe, provides, replaceOptions, setCopyright, setEnabled, setFamily, setHelp, setName, setProbeId, setReport, setReportable, setSeverity, setTarget, setTimeout, setVersion
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

cmd

public java.lang.String cmd
the command to run


args

public java.lang.String args
command line arguments for cmd


key

public java.lang.String key
the KB key to use in setting this information in the KB

Constructor Detail

AbstractCommandProbe

public AbstractCommandProbe()
Method Detail

getCommand

public java.lang.String getCommand()
Get a String of the command which this probe will execute on probe().

Specified by:
getCommand in interface CommandProbe
Returns:
String of the command to execute.

getArgs

public java.lang.String getArgs()
Return the arguments string for this command probe.

Specified by:
getArgs in interface CommandProbe
Returns:
String args

setCommand

public void setCommand(java.lang.String cmd)
Set the cmd string which is used to exec the probe

Specified by:
setCommand in interface CommandProbe
Parameters:
cmd - name of the command to set for execution

setArgs

public void setArgs(java.lang.String args)
Set the arguments to the command. Developers may insert the string _TARGET_ anywhere they would like to have the results from getHost() inserted into the argument string.

Specified by:
setArgs in interface CommandProbe
Parameters:
args - String like "-v -oX - _TARGET_" <-- extra credit, what app is this for?

setKbKey

public void setKbKey(java.lang.String key)
Set the KB key which this probe will use to store the STDOUT results of the command on execution.

Specified by:
setKbKey in interface CommandProbe
Parameters:
key - String like "command/nmap"

getKbKey

public java.lang.String getKbKey()
Get the KB key (String) which is set by this probe.

Specified by:
getKbKey in interface CommandProbe
Returns:
String of the KB key used by this probe

probe

public void probe()
           throws ProbeException
This Abstract probe implements is't own probe() method, because command probes are just regular commands who'se output ends up in the report.

Specified by:
probe in interface Probe
Throws:
ProbeException - These exceptions are thrown when failure causes the probe to be unable to determine weather or not the target is vulnerable.