コード例 #1
0
ファイル: api.py プロジェクト: everping/w3af
 def engine_start(self):
     if os.path.exists("sqlmap.py"):
         self.process = Popen(["python", "sqlmap.py", "--pickled-options", base64pickle(self.options)], shell=False, close_fds=not IS_WIN)
     elif os.path.exists(os.path.join(os.getcwd(), "sqlmap.py")):
         self.process = Popen(["python", "sqlmap.py", "--pickled-options", base64pickle(self.options)], shell=False, cwd=os.getcwd(), close_fds=not IS_WIN)
     else:
         self.process = Popen(["sqlmap", "--pickled-options", base64pickle(self.options)], shell=False, close_fds=not IS_WIN)
コード例 #2
0
ファイル: api.py プロジェクト: bussiere/sqlmap
class Task(object):
    global db

    def __init__(self, taskid):
        self.process = None
        self.output_directory = None
        self.initialize_options(taskid)

    def initialize_options(self, taskid):
        dataype = {"boolean": False, "string": None, "integer": None, "float": None}
        self.options = AttribDict()

        for _ in optDict:
            for name, type_ in optDict[_].items():
                type_ = unArrayizeValue(type_)
                self.options[name] = _defaults.get(name, dataype[type_])

        # Let sqlmap engine knows it is getting called by the API, the task ID and the file path of the IPC database
        self.options.api = True
        self.options.taskid = taskid
        self.options.database = db.get_filepath()

        # Enforce batch mode and disable coloring
        self.options.batch = True
        self.options.disableColoring = True

    def set_option(self, option, value):
        self.options[option] = value

    def get_option(self, option):
        return self.options[option]

    def get_options(self):
        return self.options

    def set_output_directory(self):
        self.output_directory = tempfile.mkdtemp(prefix="sqlmapoutput-")
        self.set_option("oDir", self.output_directory)

    def clean_filesystem(self):
        shutil.rmtree(self.output_directory)

    def engine_start(self):
        self.process = Popen("python sqlmap.py --pickled-options %s" % base64pickle(self.options), shell=True, stdin=PIPE)

    def engine_stop(self):
        if self.process:
            self.process.terminate()

    def engine_kill(self):
        if self.process:
            self.process.kill()

    def engine_get_pid(self):
        return self.processid.pid
コード例 #3
0
ファイル: api.py プロジェクト: sdlirjc/algorithm
    def engine_start(self):
        handle, configFile = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.CONFIG, text=True)
        os.close(handle)
        saveConfig(self.options, configFile)

        if os.path.exists("sqlmap.py"):
            self.process = Popen(["python", "sqlmap.py", "--api", "-c", configFile], shell=False, close_fds=not IS_WIN)
        elif os.path.exists(os.path.join(os.getcwd(), "sqlmap.py")):
            self.process = Popen(["python", "sqlmap.py", "--api", "-c", configFile], shell=False, cwd=os.getcwd(), close_fds=not IS_WIN)
        else:
            self.process = Popen(["sqlmap", "--api", "-c", configFile], shell=False, close_fds=not IS_WIN)
コード例 #4
0
ファイル: score-m.py プロジェクト: cuongitbk/MalDetector
	info_msg = "get permissions from apk file '%s'" %src
	
	try:
		pms_bin = os.path.join(apkscan_path,'pms_statistic.py')
		if not os.path.exists(pms_bin):
			err_msg = "pms_statistic file is not exists in path[%s]" %apkscan_path
			#logger.error(err_msg)
			return err_msg
		if True == os.path.isdir(src):
			cmd = 'python %s -p "%s"' %(pms_bin, src)
			print "This is a score for 'a path' that includes many apps"
		else:
			cmd = 'python %s -a "%s"' %(pms_bin, src)
			print "This is a score for 'single app'"
		
		process = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE, stdin=PIPE, close_fds=False)
		out, err = process.communicate()
		if not async:
			process.wait()
		time.sleep(1)
		#ret = conf.pms_result_path
		ret = pms01_result_path
		#name = appname_path #record the name depends on the sequence of 01 file apps
		return ret
	except Exception,e:
		print e
	
	return ret

#----------------------------------------------------------------------
def loadDataSet_real(filePath): 
コード例 #5
0
ファイル: api.py プロジェクト: HackingLab/Termite-sqlmap
class Task(object):
    def __init__(self, taskid, remote_addr):
        self.remote_addr = remote_addr
        self.process = None
        self.output_directory = None
        self.options = None
        self._original_options = None
        self.initialize_options(taskid)

    def initialize_options(self, taskid):
        datatype = {"boolean": False, "string": None, "integer": None, "float": None}
        self.options = AttribDict()

        for _ in optDict:
            for name, type_ in optDict[_].items():
                type_ = unArrayizeValue(type_)
                self.options[name] = _defaults.get(name, datatype[type_])

        # Let sqlmap engine knows it is getting called by the API,
        # the task ID and the file path of the IPC database
        self.options.api = True
        self.options.taskid = taskid
        self.options.database = Database.filepath

        # Enforce batch mode and disable coloring and ETA
        self.options.batch = True
        self.options.disableColoring = True
        self.options.eta = False

        self._original_options = AttribDict(self.options)

    def set_option(self, option, value):
        self.options[option] = value

    def get_option(self, option):
        return self.options[option]

    def get_options(self):
        return self.options

    def reset_options(self):
        self.options = AttribDict(self._original_options)

    def engine_start(self):
        if os.path.exists("sqlmap.py"):
            self.process = Popen(["python", "sqlmap.py", "--pickled-options", base64pickle(self.options)], shell=False, close_fds=not IS_WIN)
        else:
            self.process = Popen(["sqlmap", "--pickled-options", base64pickle(self.options)], shell=False, close_fds=not IS_WIN)

    def engine_stop(self):
        if self.process:
            self.process.terminate()
            return self.process.wait()
        else:
            return None

    def engine_process(self):
        return self.process

    def engine_kill(self):
        if self.process:
            try:
                self.process.kill()
                return self.process.wait()
            except:
                pass
        return None

    def engine_get_id(self):
        if self.process:
            return self.process.pid
        else:
            return None

    def engine_get_returncode(self):
        if self.process:
            self.process.poll()
            return self.process.returncode
        else:
            return None

    def engine_has_terminated(self):
        return isinstance(self.engine_get_returncode(), int)
コード例 #6
0
ファイル: api.py プロジェクト: khanhnnvn/sqlmap
 def engine_start(self):
     self.process = Popen(["python", "sqlmap.py", "--pickled-options", base64pickle(self.options)],
                          shell=False, close_fds=not IS_WIN)
コード例 #7
0
ファイル: api.py プロジェクト: 0x0mar/sqlmap
 def engine_start(self):
     self.process = Popen("python sqlmap.py --pickled-options %s" % base64pickle(self.options),
                          shell=True, stdin=PIPE, close_fds=False)
コード例 #8
0
ファイル: api.py プロジェクト: 0x0mar/sqlmap
class Task(object):
    def __init__(self, taskid):
        self.process = None
        self.temporary_directory = False
        self.output_directory = None
        self.options = None
        self._original_options = None
        self.initialize_options(taskid)

    def initialize_options(self, taskid):
        datatype = {"boolean": False, "string": None, "integer": None, "float": None}
        self.options = AttribDict()

        for _ in optDict:
            for name, type_ in optDict[_].items():
                type_ = unArrayizeValue(type_)
                self.options[name] = _defaults.get(name, datatype[type_])

        # Let sqlmap engine knows it is getting called by the API,
        # the task ID and the file path of the IPC database
        self.options.api = True
        self.options.taskid = taskid
        self.options.database = Database.filepath

        # Enforce batch mode and disable coloring and ETA
        self.options.batch = True
        self.options.disableColoring = True
        self.options.eta = False

        self._original_options = AttribDict(self.options)

    def set_option(self, option, value):
        self.options[option] = value

    def get_option(self, option):
        return self.options[option]

    def get_options(self):
        return self.options

    def reset_options(self):
        self.options = AttribDict(self._original_options)

    def set_output_directory(self):
        if self.get_option("outputDir"):
            if os.path.isdir(self.get_option("outputDir")):
                self.output_directory = self.get_option("outputDir")
            else:
                try:
                    os.makedirs(self.get_option("outputDir"))
                    self.output_directory = self.get_option("outputDir")
                except OSError:
                    pass

        if not self.output_directory or not os.path.isdir(self.output_directory):
            self.output_directory = tempfile.mkdtemp(prefix="sqlmapoutput-")
            self.temporary_directory = True
            self.set_option("outputDir", self.output_directory)

    def clean_filesystem(self):
        if self.output_directory and self.temporary_directory:
            shutil.rmtree(self.output_directory)

    def engine_start(self):
        self.process = Popen("python sqlmap.py --pickled-options %s" % base64pickle(self.options),
                             shell=True, stdin=PIPE, close_fds=False)

    def engine_stop(self):
        if self.process:
            return self.process.terminate()
        else:
            return None

    def engine_process(self):
        return self.process

    def engine_kill(self):
        if self.process:
            return self.process.kill()
        else:
            return None

    def engine_get_id(self):
        if self.process:
            return self.process.pid
        else:
            return None

    def engine_get_returncode(self):
        if self.process:
            self.process.poll()
            return self.process.returncode
        else:
            return None

    def engine_has_terminated(self):
        return isinstance(self.engine_get_returncode(), int)
コード例 #9
0
ファイル: api.py プロジェクト: rahulunair/sqlmap
class Task(object):
    def __init__(self, taskid, remote_addr):
        self.remote_addr = remote_addr
        self.process = None
        self.output_directory = None
        self.options = None
        self._original_options = None
        self.initialize_options(taskid)

    def initialize_options(self, taskid):
        datatype = {"boolean": False, "string": None, "integer": None, "float": None}
        self.options = AttribDict()

        for _ in optDict:
            for name, type_ in optDict[_].items():
                type_ = unArrayizeValue(type_)
                self.options[name] = _defaults.get(name, datatype[type_])

        # Let sqlmap engine knows it is getting called by the API,
        # the task ID and the file path of the IPC database
        self.options.api = True
        self.options.taskid = taskid
        self.options.database = Database.filepath

        # Enforce batch mode and disable coloring and ETA
        self.options.batch = True
        self.options.disableColoring = True
        self.options.eta = False

        self._original_options = AttribDict(self.options)

    def set_option(self, option, value):
        self.options[option] = value

    def get_option(self, option):
        return self.options[option]

    def get_options(self):
        return self.options

    def reset_options(self):
        self.options = AttribDict(self._original_options)

    def engine_start(self):
        handle, configFile = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.CONFIG, text=True)
        os.close(handle)
        saveConfig(self.options, configFile)

        if os.path.exists("sqlmap.py"):
            self.process = Popen([sys.executable or "python", "sqlmap.py", "--api", "-c", configFile], shell=False, close_fds=not IS_WIN)
        elif os.path.exists(os.path.join(os.getcwd(), "sqlmap.py")):
            self.process = Popen([sys.executable or "python", "sqlmap.py", "--api", "-c", configFile], shell=False, cwd=os.getcwd(), close_fds=not IS_WIN)
        elif os.path.exists(os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "sqlmap.py")):
            self.process = Popen([sys.executable or "python", "sqlmap.py", "--api", "-c", configFile], shell=False, cwd=os.path.join(os.path.abspath(os.path.dirname(sys.argv[0]))), close_fds=not IS_WIN)
        else:
            self.process = Popen(["sqlmap", "--api", "-c", configFile], shell=False, close_fds=not IS_WIN)

    def engine_stop(self):
        if self.process:
            self.process.terminate()
            return self.process.wait()
        else:
            return None

    def engine_process(self):
        return self.process

    def engine_kill(self):
        if self.process:
            try:
                self.process.kill()
                return self.process.wait()
            except:
                pass
        return None

    def engine_get_id(self):
        if self.process:
            return self.process.pid
        else:
            return None

    def engine_get_returncode(self):
        if self.process:
            self.process.poll()
            return self.process.returncode
        else:
            return None

    def engine_has_terminated(self):
        return isinstance(self.engine_get_returncode(), int)
コード例 #10
0
ファイル: api.py プロジェクト: zylx0532/sqlmap
class Task(object):
    def __init__(self, taskid, remote_addr):
        self.remote_addr = remote_addr
        self.process = None
        self.output_directory = None
        self.options = None
        self._original_options = None
        self.initialize_options(taskid)

    def initialize_options(self, taskid):
        datatype = {
            "boolean": False,
            "string": None,
            "integer": None,
            "float": None
        }
        self.options = AttribDict()

        for _ in optDict:
            for name, type_ in optDict[_].items():
                type_ = unArrayizeValue(type_)
                self.options[name] = _defaults.get(name, datatype[type_])

        # Let sqlmap engine knows it is getting called by the API,
        # the task ID and the file path of the IPC database
        self.options.api = True
        self.options.taskid = taskid
        self.options.database = Database.filepath

        # Enforce batch mode and disable coloring and ETA
        self.options.batch = True
        self.options.disableColoring = True
        self.options.eta = False

        self._original_options = AttribDict(self.options)

    def set_option(self, option, value):
        self.options[option] = value

    def get_option(self, option):
        return self.options[option]

    def get_options(self):
        return self.options

    def reset_options(self):
        self.options = AttribDict(self._original_options)

    def engine_start(self):
        handle, configFile = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.CONFIG,
                                              text=True)
        os.close(handle)
        saveConfig(self.options, configFile)

        if os.path.exists("sqlmap.py"):
            self.process = Popen([
                sys.executable or "python", "sqlmap.py", "--api", "-c",
                configFile
            ],
                                 shell=False,
                                 close_fds=not IS_WIN)
        elif os.path.exists(os.path.join(os.getcwd(), "sqlmap.py")):
            self.process = Popen([
                sys.executable or "python", "sqlmap.py", "--api", "-c",
                configFile
            ],
                                 shell=False,
                                 cwd=os.getcwd(),
                                 close_fds=not IS_WIN)
        elif os.path.exists(
                os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
                             "sqlmap.py")):
            self.process = Popen([
                sys.executable or "python", "sqlmap.py", "--api", "-c",
                configFile
            ],
                                 shell=False,
                                 cwd=os.path.join(
                                     os.path.abspath(
                                         os.path.dirname(sys.argv[0]))),
                                 close_fds=not IS_WIN)
        else:
            self.process = Popen(["sqlmap", "--api", "-c", configFile],
                                 shell=False,
                                 close_fds=not IS_WIN)

    def engine_stop(self):
        if self.process:
            self.process.terminate()
            return self.process.wait()
        else:
            return None

    def engine_process(self):
        return self.process

    def engine_kill(self):
        if self.process:
            try:
                self.process.kill()
                return self.process.wait()
            except:
                pass
        return None

    def engine_get_id(self):
        if self.process:
            return self.process.pid
        else:
            return None

    def engine_get_returncode(self):
        if self.process:
            self.process.poll()
            return self.process.returncode
        else:
            return None

    def engine_has_terminated(self):
        return isinstance(self.engine_get_returncode(), int)
コード例 #11
0
class Task(object):
    def __init__(self, taskid):
        self.process = None
        self.output_directory = None
        self.options = None
        self._original_options = None
        self.initialize_options(taskid)

    def initialize_options(self, taskid):
        datatype = {
            "boolean": False,
            "string": None,
            "integer": None,
            "float": None
        }
        self.options = AttribDict()

        for _ in optDict:
            for name, type_ in optDict[_].items():
                type_ = unArrayizeValue(type_)
                self.options[name] = _defaults.get(name, datatype[type_])

        # Let sqlmap engine knows it is getting called by the API,
        # the task ID and the file path of the IPC database
        self.options.api = True
        self.options.taskid = taskid
        self.options.database = Database.filepath

        # Enforce batch mode and disable coloring and ETA
        self.options.batch = True
        self.options.disableColoring = True
        self.options.eta = False

        self._original_options = AttribDict(self.options)

    def set_option(self, option, value):
        self.options[option] = value

    def get_option(self, option):
        return self.options[option]

    def get_options(self):
        return self.options

    def reset_options(self):
        self.options = AttribDict(self._original_options)

    def engine_start(self):
        if os.path.exists("sqlmap.py"):
            self.process = Popen([
                "python", "sqlmap.py", "--pickled-options",
                base64pickle(self.options)
            ],
                                 shell=False,
                                 close_fds=not IS_WIN)
        else:
            self.process = Popen(
                ["sqlmap", "--pickled-options",
                 base64pickle(self.options)],
                shell=False,
                close_fds=not IS_WIN)

    def engine_stop(self):
        if self.process:
            self.process.terminate()
            return self.process.wait()
        else:
            return None

    def engine_process(self):
        return self.process

    def engine_kill(self):
        if self.process:
            self.process.kill()
            return self.process.wait()
        else:
            return None

    def engine_get_id(self):
        if self.process:
            return self.process.pid
        else:
            return None

    def engine_get_returncode(self):
        if self.process:
            self.process.poll()
            return self.process.returncode
        else:
            return None

    def engine_has_terminated(self):
        return isinstance(self.engine_get_returncode(), int)
コード例 #12
0
 def engine_start(self):
     self.process = Popen(["python", "sqlmap.py", "--pickled-options", base64pickle(self.options)],
                          shell=False, stdin=PIPE, close_fds=False)
コード例 #13
0
ファイル: api.py プロジェクト: zhouc234/sqlmap
 def engine_start(self):
     self.process = Popen("python sqlmap.py --pickled-options %s" %
                          base64pickle(self.options),
                          shell=True,
                          stdin=PIPE,
                          close_fds=False)
コード例 #14
0
ファイル: api.py プロジェクト: zhouc234/sqlmap
class Task(object):
    def __init__(self, taskid):
        self.process = None
        self.temporary_directory = False
        self.output_directory = None
        self.options = None
        self._original_options = None
        self.initialize_options(taskid)

    def initialize_options(self, taskid):
        datatype = {
            "boolean": False,
            "string": None,
            "integer": None,
            "float": None
        }
        self.options = AttribDict()

        for _ in optDict:
            for name, type_ in optDict[_].items():
                type_ = unArrayizeValue(type_)
                self.options[name] = _defaults.get(name, datatype[type_])

        # Let sqlmap engine knows it is getting called by the API,
        # the task ID and the file path of the IPC database
        self.options.api = True
        self.options.taskid = taskid
        self.options.database = Database.filepath

        # Enforce batch mode and disable coloring and ETA
        self.options.batch = True
        self.options.disableColoring = True
        self.options.eta = False

        self._original_options = AttribDict(self.options)

    def set_option(self, option, value):
        self.options[option] = value

    def get_option(self, option):
        return self.options[option]

    def get_options(self):
        return self.options

    def reset_options(self):
        self.options = AttribDict(self._original_options)

    def set_output_directory(self):
        if self.get_option("oDir"):
            if os.path.isdir(self.get_option("oDir")):
                self.output_directory = self.get_option("oDir")
            else:
                try:
                    os.makedirs(self.get_option("oDir"))
                    self.output_directory = self.get_option("oDir")
                except OSError:
                    pass

        if not self.output_directory or not os.path.isdir(
                self.output_directory):
            self.output_directory = tempfile.mkdtemp(prefix="sqlmapoutput-")
            self.temporary_directory = True
            self.set_option("oDir", self.output_directory)

    def clean_filesystem(self):
        if self.output_directory and self.temporary_directory:
            shutil.rmtree(self.output_directory)

    def engine_start(self):
        self.process = Popen("python sqlmap.py --pickled-options %s" %
                             base64pickle(self.options),
                             shell=True,
                             stdin=PIPE,
                             close_fds=False)

    def engine_stop(self):
        if self.process:
            return self.process.terminate()
        else:
            return None

    def engine_process(self):
        return self.process

    def engine_kill(self):
        if self.process:
            return self.process.kill()
        else:
            return None

    def engine_get_id(self):
        if self.process:
            return self.process.pid
        else:
            return None

    def engine_get_returncode(self):
        if self.process:
            self.process.poll()
            return self.process.returncode
        else:
            return None

    def engine_has_terminated(self):
        return isinstance(self.engine_get_returncode(), int)
コード例 #15
0
ファイル: api.py プロジェクト: yodamaster/sqlmap
 def engine_start(self):
     if os.path.exists("sqlmap.py"):
         self.process = Popen(["python", "sqlmap.py", "--pickled-options", base64pickle(self.options)], shell=False, close_fds=not IS_WIN)
     else:
         self.process = Popen(["sqlmap", "--pickled-options", base64pickle(self.options)], shell=False, close_fds=not IS_WIN)