예제 #1
0
    def __init__(self, server, session_id, arguments):
        cmd.Cmd.__init__(self)
        self.__base = ""
        self.__has_context = None
        self.__module_pushed_completers = 0
        self.__permissions = None
        self.__server = server
        self.__session_id = session_id
        self.__onecmd = arguments.onecmd
        self.active = True
        self.aliases = {"l": "list", "ls": "list", "ll": "list"}
        self.intro = "drozer Console (v%s)" % meta.version
        self.history_file = os.path.sep.join(
            [os.path.expanduser("~"), ".drozer_history"])
        self.modules = collection.ModuleCollection(loader.ModuleLoader())
        self.prompt = "dz> "
        self.reflector = Reflector(self)
        if hasattr(arguments, 'no_color') and not arguments.no_color:
            # session stdout
            self.stdout = ColouredStream(self.stdout)

            self.filestdout = FileColouredStream(self.stdout)
            # session xmlstdout
            self.txmlstdout = XMLColouredStream(self.stdout)
            self.sqlstdout = MYSQLDB()

            self.stderr = ColouredStream(self.stderr)
        else:
            self.stdout = DecolouredStream(self.stdout)
            self.stderr = DecolouredStream(self.stderr)

        m = Module(self)

        if m.has_context():
            dataDir = str(m.getContext().getApplicationInfo().dataDir)
        else:
            dataDir = str(
                m.new("java.io.File", ".").getCanonicalPath().native())

        self.variables = {
            'PATH': dataDir +
            '/bin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin',
            'WD': dataDir
        }

        self.__load_variables()

        if arguments.onecmd == None:
            self.__print_banner()
예제 #2
0
    def testItShouldLoadModules(self):
        modules = collection.ModuleCollection(loader.ModuleLoader())

        assert len(modules.all()) > 0
예제 #3
0
 def __init__(self):
     self.__modules = collection.ModuleCollection(loader.ModuleLoader())