Commit f4577966 authored by fimap.dev@gmail.com's avatar fimap.dev@gmail.com

2 new switches implemented. (--force-os=OS and --force-run)

parent e29e2af3
...@@ -109,6 +109,8 @@ def show_help(AndQuit=False): ...@@ -109,6 +109,8 @@ def show_help(AndQuit=False):
print " --dot-trunc-step=50 The step size for each round in dot-truncation mode." print " --dot-trunc-step=50 The step size for each round in dot-truncation mode."
print " --dot-trunc-ratio=0.095 The maximum ratio to detect if dot truncation was successfull." print " --dot-trunc-ratio=0.095 The maximum ratio to detect if dot truncation was successfull."
print " --dot-trunc-also-unix Use this if dot-truncation should also be tested on unix servers." print " --dot-trunc-also-unix Use this if dot-truncation should also be tested on unix servers."
print " --force-os=OS Forces fimap to test only files for the OS."
print " OS can be 'unix' or 'windows'"
print "## Attack Kit:" print "## Attack Kit:"
print " -x , --exploit Starts an interactive session where you can" print " -x , --exploit Starts an interactive session where you can"
print " select a target and do some action." print " select a target and do some action."
...@@ -135,6 +137,8 @@ def show_help(AndQuit=False): ...@@ -135,6 +137,8 @@ def show_help(AndQuit=False):
print " --merge-xml=XMLFILE Use this if you have another fimap XMLFILE you want to" print " --merge-xml=XMLFILE Use this if you have another fimap XMLFILE you want to"
print " include to your own fimap_result.xml." print " include to your own fimap_result.xml."
print " -C , --enable-color Enables a colorful output. Works only in linux!" print " -C , --enable-color Enables a colorful output. Works only in linux!"
print " --force-run Ignore the instance check and just run fimap even if a lockfile"
print " exists. WARNING: This may erase your fimap_results.xml file!"
print " -v , --verbose=LEVEL Verbose level you want to receive." print " -v , --verbose=LEVEL Verbose level you want to receive."
print " LEVEL=3 -> Debug" print " LEVEL=3 -> Debug"
print " LEVEL=2 -> Info(Default)" print " LEVEL=2 -> Info(Default)"
...@@ -244,6 +248,8 @@ if __name__ == "__main__": ...@@ -244,6 +248,8 @@ if __name__ == "__main__":
config["p_tabcomplete"] = False config["p_tabcomplete"] = False
config["p_multiply_term"] = 1 config["p_multiply_term"] = 1
config["header"] = {} config["header"] = {}
config["force-run"] = False
config["force-os"] = None
doPluginsShow = False doPluginsShow = False
doRFITest = False doRFITest = False
doInternetInfo = False doInternetInfo = False
...@@ -263,22 +269,9 @@ if __name__ == "__main__": ...@@ -263,22 +269,9 @@ if __name__ == "__main__":
try: try:
# Ape style lockfile. But it works! :)
lockFound = False
curlockfile = None
for f in os.listdir(tempfile.gettempdir()):
if f.startswith("fimap_") and f.endswith("_lockfile"):
lockFound = True
curlockfile = f
break
if (lockFound):
print "Another fimap instance is already running!"
print "If you think this is not correct please delete the following file:"
print os.path.join(tempfile.gettempdir(), curlockfile)
sys.exit(0)
else:
lockfile = tempfile.NamedTemporaryFile(prefix="fimap_", suffix="_lockfile")
...@@ -291,7 +284,7 @@ if __name__ == "__main__": ...@@ -291,7 +284,7 @@ if __name__ == "__main__":
"plugins" , "enable-color", "update-def" , "merge-xml=" , "install-plugins" , "results=", "plugins" , "enable-color", "update-def" , "merge-xml=" , "install-plugins" , "results=",
"googlesleep=" , "dot-truncation", "dot-trunc-min=", "dot-trunc-max=", "dot-trunc-step=", "dot-trunc-ratio=", "googlesleep=" , "dot-truncation", "dot-trunc-min=", "dot-trunc-max=", "dot-trunc-step=", "dot-trunc-ratio=",
"tab-complete" , "cookie=" , "bmin=" , "bmax=" , "dot-trunc-also-unix", "multiply-term=", "tab-complete" , "cookie=" , "bmin=" , "bmax=" , "dot-trunc-also-unix", "multiply-term=",
"autoawesome"] "autoawesome" , "force-run" , "force-os="]
optlist, args = getopt.getopt(sys.argv[1:], "u:msl:v:hA:gq:p:sxHw:d:bP:CIDTM:4", longSwitches) optlist, args = getopt.getopt(sys.argv[1:], "u:msl:v:hA:gq:p:sxHw:d:bP:CIDTM:4", longSwitches)
startExploiter = False startExploiter = False
...@@ -384,11 +377,38 @@ if __name__ == "__main__": ...@@ -384,11 +377,38 @@ if __name__ == "__main__":
blind_min = int(v) blind_min = int(v)
if (k in ("--bmax",)): if (k in ("--bmax",)):
blind_max = int(v) blind_max = int(v)
if (k in ("--force-run",)):
config["force-run"] = True
if (k in ("--force-os",)):
config["force-os"] = v
#if (k in("-f", "--exploit-filter")): #if (k in("-f", "--exploit-filter")):
# config["p_exploit_filter"] = v # config["p_exploit_filter"] = v
xmlsettings = language.XML2Config(config) xmlsettings = language.XML2Config(config)
# Ape style lockfile. But it works! :)
lockFound = False
curlockfile = None
for f in os.listdir(tempfile.gettempdir()):
if f.startswith("fimap_") and f.endswith("_lockfile"):
lockFound = True
curlockfile = f
break
if (lockFound):
if (config["force-run"] == True):
print "Another fimap instance is running! But you requested to ignore that..."
else:
print "Another fimap instance is already running!"
print "If you think this is not correct please delete the following file:"
print "-> " + os.path.join(tempfile.gettempdir(), curlockfile)
print "or start fimap with '--force-run' on your own risk."
sys.exit(0)
else:
lockfile = tempfile.NamedTemporaryFile(prefix="fimap_", suffix="_lockfile")
# Setup possibly changed engine settings. # Setup possibly changed engine settings.
if (blind_min != None): if (blind_min != None):
xmlsettings.blind_min = blind_min xmlsettings.blind_min = blind_min
...@@ -627,6 +647,11 @@ if __name__ == "__main__": ...@@ -627,6 +647,11 @@ if __name__ == "__main__":
if (config["p_monkeymode"] == True): if (config["p_monkeymode"] == True):
print "Blind FI-error checking enabled." print "Blind FI-error checking enabled."
if (config["force-os"] != None):
if (config["force-os"] != "unix" and config["force-os"] != "windows"):
print "Invalid parameter for 'force-os'."
print "Only 'unix' or 'windows' are allowed!"
sys.exit(1)
try: try:
......
...@@ -258,11 +258,21 @@ class targetScanner (baseClass.baseClass): ...@@ -258,11 +258,21 @@ class targetScanner (baseClass.baseClass):
if (len(ret) == 0 and self.MonkeyTechnique): if (len(ret) == 0 and self.MonkeyTechnique):
self._log("Sniper failed. Going blind...", self.LOG_INFO) self._log("Sniper failed. Going blind...", self.LOG_INFO)
files = xml2config.getBlindFiles() files = xml2config.getBlindFiles()
os_restriction = self.config["force-os"]
for fileobj in files: for fileobj in files:
post = fileobj.getPostData() post = fileobj.getPostData()
v = fileobj.getFindStr() v = fileobj.getFindStr()
f = fileobj.getFilepath() f = fileobj.getFilepath()
if (os_restriction != None):
if (fileobj.isWindows() and os_restriction != "windows"):
continue
if (fileobj.isUnix() and os_restriction != "linux"):
continue
backSyms = (fileobj.getBackSymbols(), fileobj.getBackSymbols(False)) backSyms = (fileobj.getBackSymbols(), fileobj.getBackSymbols(False))
get_done = False get_done = False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment