コード例 #1
0
ファイル: manager.py プロジェクト: 4cce1er/drozer-py3
    def do_build(self, arguments):
        """build a drozer Agent"""

        source = (arguments.rogue
                  or arguments.no_gui) and "rogue-agent" or "standard-agent"
        packager = builder.Packager()
        packager.unpack(source)

        if arguments.rogue or arguments.no_gui:
            e = manifest.Endpoint(packager.endpoint_path())
            if arguments.server != None:
                e.put_server(arguments.server)
            e.write()

            if not arguments.granular:
                permissions = set(android.permissions)
            else:
                permissions = set([])
        else:
            permissions = set([])

        if arguments.permission != None:
            permissions = permissions.union(arguments.permission)

        defined_permissions = {}
        if arguments.define_permission != None:
            defined_permissions = dict(
                itertools.izip_longest(*[iter(arguments.define_permission)] *
                                       2,
                                       fillvalue=""))

        # add extra permissions to the Manifest file
        m = manifest.Manifest(packager.manifest_path())

        # Apktool v2.2.4 generates a malformed YAML file when unpacking apks
        # See https://github.com/iBotPeaches/Apktool/issues/1610
        # This workaround generates a valid YAML document and prevents agent building from failing
        yaml_doc = yaml.load(
            file(packager.apktool_yml_path()).read().replace(
                '!!brut.androlib.meta.MetaInfo', ''))
        m_ver = yaml_doc['versionInfo']['versionName']
        #m_ver = m.version()
        c_ver = meta.version.__str__()

        if m_ver != c_ver:
            print "Version Mismatch: Consider updating your build(s)"
            print "Agent Version: %s" % m_ver
            print "drozer Version: %s" % c_ver

        for p in permissions:
            m.add_permission(p)

        for name, protectionLevel in defined_permissions.iteritems():
            m.define_permission(name, protectionLevel)

        m.write()

        built = packager.package()

        print "Done:", built
コード例 #2
0
    def do_build(self, arguments):
        """build a drozer Agent"""

        source = arguments.no_gui and "rogue-agent" or "standard-agent"
        packager = builder.Packager()
        packager.unpack(source)

        if arguments.no_gui:
            e = manifest.Endpoint(packager.endpoint_path())
            if arguments.server != None:
                e.put_server(arguments.server)
            e.write()

            permissions = set(android.permissions)
        else:
            permissions = set([])

        if arguments.permission != None:
            permissions = permissions.union(arguments.permission)

        defined_permissions = {}
        if arguments.define_permission != None:
            defined_permissions = dict(
                itertools.izip_longest(*[iter(arguments.define_permission)] *
                                       2,
                                       fillvalue=""))

        # add extra permissions to the Manifest file
        m = manifest.Manifest(packager.manifest_path())

        m_ver = m.version()
        c_ver = meta.version.__str__()

        if m_ver != c_ver:
            print "Version Mismatch: Consider updating your build(s)"
            print "Agent Version: %s" % m_ver
            print "drozer Version: %s" % c_ver

        for p in permissions:
            m.add_permission(p)

        for name, protectionLevel in defined_permissions.iteritems():
            m.define_permission(name, protectionLevel)

        m.write()

        built = packager.package()

        print "Done:", built
コード例 #3
0
ファイル: exploit.py プロジェクト: 4cce1er/drozer-py3
    def build_agent(self, arguments):
        source = arguments.no_gui and "rogue-agent" or "standard-agent"

        packager = builder.Packager()
        packager.unpack(source)

        if arguments.no_gui:
            e = manifest.Endpoint(packager.endpoint_path())
            if arguments.server != None:
                e.put_server(arguments.server)
            e.write()

        permissions = set(android.permissions)
        if arguments.permission != None:
            permissions = permissions.union(arguments.permission)

        m = manifest.Manifest(packager.manifest_path())
        for p in permissions:
            m.add_permission(p)
        m.write()

        return fs.read(packager.package())
コード例 #4
0
ファイル: manager.py プロジェクト: zyw-200/drozer
    def do_build(self, arguments):
        """build a drozer Agent"""

        source = arguments.no_gui and "rogue-agent" or "standard-agent"
        packager = builder.Packager()
        packager.unpack(source)
        
        if arguments.no_gui:
            e = manifest.Endpoint(packager.endpoint_path())
            if arguments.server != None:
                e.put_server(arguments.server)
            e.write()
            
            permissions = set(android.permissions)
        else:
            permissions = set([])
        
        if arguments.permission != None:
            permissions = permissions.union(arguments.permission)

        # add extra permissions to the Manifest file
        m = manifest.Manifest(packager.manifest_path()) 
        
        m_ver = m.version()
        c_ver = meta.version.__str__()

        if m_ver != c_ver:
            print "Version Mismatch: Consider updating your build(s)"
            print "Agent Version: %s" % m_ver
            print "drozer Version: %s" % c_ver

        for p in permissions:
            m.add_permission(p)
        m.write()
        
        built = packager.package()
        
        print "Done:", built