コード例 #1
0
def updatemd5(conffile=None):
    commands = Commands(conffile)

    try:
        commands.logger.info('> Recompiling')
        recompile(conffile)
        commands.logger.info('> Generating the md5 (client)')
        commands.gathermd5s(CLIENT)
        commands.logger.info('> Generating the md5 (server)')
        commands.gathermd5s(SERVER)
    except Exception:  # pylint: disable-msg=W0703
        commands.logger.exception('FATAL ERROR')
        sys.exit(1)
コード例 #2
0
def updatemd5(conffile=None):
    commands = Commands(conffile)

    try:
        commands.logger.info('> Recompiling')
        recompile(conffile)
        commands.logger.info('> Generating the md5 (client)')
        commands.gathermd5s(CLIENT)
        commands.logger.info('> Generating the md5 (server)')
        commands.gathermd5s(SERVER)
    except Exception:  # pylint: disable-msg=W0703
        commands.logger.exception('FATAL ERROR')
        sys.exit(1)
コード例 #3
0
def verify_config(options):
    # Defaults
    if not options.logport:
        options.logport = 8888
    if not options.proxyport:
        options.proxyport = 8080
    
    # Must have settings:
    if not options.dumpdir:
        return 0
    if not options.logdir:
        return 0
    if options.input and not options.landing_page:
        return 0
    if options.landing_page and not options.input:
        return 0
    if options.input and not os.path.exists(options.input):
        return 0
    if options.landing_page and not os.path.exists(options.landing_page):
        return 0
    
    # Make directories, if not existing:
    if not os.path.isdir(options.dumpdir):
        os.makedirs(options.dumpdir)
    if not os.path.isdir(options.logdir):
        os.makedirs(options.logdir)

    # Create instrumentation files from templates
    if not options.package:
        options.package = rand_str(size=8)
    if not options.namespace:
        options.namespace = rand_str(size=8)
    if not options.tag:
        options.tag = rand_str(size=8)
        
    options.quiet = True
    options.trace = True
    if not options.flash_out:
        options.flash_out = options.logdir + "/tmp.swf"
    if not recompile.recompile(options):
        return 0
    
    # Read landing page
    if options.landing_page:
        options.lbasename = os.path.basename(options.landing_page)
        options.ibasename = os.path.basename(options.input)
        with open(options.landing_page, "rb") as file:
            options.lpage = file.read()
            options.lpage = options.lpage.replace('##INPUT##', options.ibasename)

    return 1
コード例 #4
0
def decompile(conffile=None, force_jad=False):
    commands = Commands(conffile)

    try:
        commands.checkupdates()

        cltdone = False
        srvdone = False

        use_ff = os.path.exists(commands.fernflower) and not force_jad

        commands.logger.info('> Creating Retroguard config files')
        commands.creatergcfg()

        srcdir = os.path.join(commands.srcclient, os.path.normpath(commands.ffsource))
        if not os.path.exists(srcdir):
            commands.logger.info('== Decompiling Client ==')
            if commands.checkjars(CLIENT):
                clienttime = time.time()
                commands.logger.info('> Creating SRGS for client')
                commands.createsrgs(CLIENT)
                commands.logger.info('> Applying Retroguard to client')
                commands.applyrg(CLIENT)
                commands.logger.info('> Applying Exceptor to client')
                commands.applyexceptor(CLIENT)
                if use_ff:
                    commands.logger.info('> Decompiling...')
                    commands.applyff(CLIENT)
                    commands.logger.info('> Unzipping the client sources')
                    commands.extractsrc(CLIENT)
                commands.logger.info('> Unzipping the client jar')
                commands.extractjar(CLIENT)
                if not use_ff:
                    commands.logger.info('> Applying jadretro')
                    commands.applyjadretro(CLIENT)
                    commands.logger.info('> Decompiling...')
                    commands.applyjad(CLIENT)
                    commands.logger.info('> Copying the client sources')
                    commands.copysrc(CLIENT)
                commands.logger.info('> Applying patches')
                if commands.osname == 'osx' and not use_ff:
                    commands.applypatches(CLIENT, False, True)
                commands.applypatches(CLIENT, use_ff)
                commands.logger.info('> Removing comments')
                commands.process_comments(CLIENT)
                commands.logger.info('> Renaming sources')
                commands.process_rename(CLIENT)
                commands.logger.info('> Reformating sources')
                commands.applyastyle(CLIENT)
                commands.logger.info('> Commenting OpenGL constants')
                commands.process_annotate(CLIENT)
                commands.logger.info('> Creating reobfuscation tables')
                commands.renamereobsrg(CLIENT)
                commands.logger.info('> Done in %.2f seconds' % (time.time() - clienttime))
        else:
            commands.logger.warn('!! Client already decompiled. Run cleanup before decompiling again !!')
            cltdone = True

        srcdir = os.path.join(commands.srcserver, os.path.normpath(commands.ffsource))
        if not os.path.exists(srcdir):
            commands.logger.info('== Decompiling Server ==')
            if commands.checkjars(SERVER):
                servertime = time.time()
                commands.logger.info('> Creating SRGS for server')
                commands.createsrgs(SERVER)
                commands.logger.info('> Applying Retroguard to server')
                commands.applyrg(SERVER)
                commands.logger.info('> Applying Exceptor to server')
                commands.applyexceptor(SERVER)
                if use_ff:
                    commands.logger.info('> Decompiling...')
                    commands.applyff(SERVER)
                    commands.logger.info('> Unzipping the server sources')
                    commands.extractsrc(SERVER)
                commands.logger.info('> Unzipping the server jar')
                commands.extractjar(SERVER)
                if not use_ff:
                    commands.logger.info('> Applying jadretro')
                    commands.applyjadretro(SERVER)
                    commands.logger.info('> Decompiling...')
                    commands.applyjad(SERVER)
                    commands.logger.info('> Copying the server sources')
                    commands.copysrc(SERVER)
                commands.logger.info('> Applying patches')
                if commands.osname == 'osx' and not use_ff:
                    commands.applypatches(SERVER, False, True)
                commands.applypatches(SERVER, use_ff)
                commands.logger.info('> Removing comments')
                commands.process_comments(SERVER)
                commands.logger.info('> Renaming sources')
                commands.process_rename(SERVER)
                commands.logger.info('> Reformating sources')
                commands.applyastyle(SERVER)
                commands.logger.info('> Creating reobfuscation tables')
                commands.renamereobsrg(SERVER)
                commands.logger.info('> Done in %.2f seconds' % (time.time() - servertime))
        else:
            commands.logger.warn('!! Server already decompiled. Run cleanup before decompiling again !!')
            srvdone = True

        commands.logger.info('== Post decompiling operations ==')
        if not cltdone or not srvdone:
            commands.logger.info('> Recompiling')
            recompile(conffile)
        if not cltdone:
            commands.logger.info('> Generating the md5 (client)')
            commands.gathermd5s(CLIENT)
        if not srvdone:
            commands.logger.info('> Generating the md5 (server)')
            commands.gathermd5s(SERVER)
    except Exception:  # pylint: disable-msg=W0703
        commands.logger.exception('FATAL ERROR')
        sys.exit(1)
コード例 #5
0
ファイル: decompile.py プロジェクト: benj02/LogBlockGUI
def decompile(conffile=None, force_jad=False):
    commands = Commands(conffile)

    try:
        commands.checkupdates()

        cltdone = False
        srvdone = False

        use_ff = os.path.exists(commands.fernflower) and not force_jad

        commands.logger.info('> Creating Retroguard config files')
        commands.creatergcfg()

        srcdir = os.path.join(commands.srcclient,
                              os.path.normpath(commands.ffsource))
        if not os.path.exists(srcdir):
            commands.logger.info('== Decompiling Client ==')
            if commands.checkjars(CLIENT):
                clienttime = time.time()
                commands.logger.info('> Creating SRGS for client')
                commands.createsrgs(CLIENT)
                commands.logger.info('> Applying Retroguard to client')
                commands.applyrg(CLIENT)
                commands.logger.info('> Applying Exceptor to client')
                commands.applyexceptor(CLIENT)
                if use_ff:
                    commands.logger.info('> Decompiling...')
                    commands.applyff(CLIENT)
                    commands.logger.info('> Unzipping the client sources')
                    commands.extractsrc(CLIENT)
                commands.logger.info('> Unzipping the client jar')
                commands.extractjar(CLIENT)
                if not use_ff:
                    commands.logger.info('> Applying jadretro')
                    commands.applyjadretro(CLIENT)
                    commands.logger.info('> Decompiling...')
                    commands.applyjad(CLIENT)
                    commands.logger.info('> Copying the client sources')
                    commands.copysrc(CLIENT)
                commands.logger.info('> Applying patches')
                if commands.osname == 'osx' and not use_ff:
                    commands.applypatches(CLIENT, False, True)
                commands.applypatches(CLIENT, use_ff)
                commands.logger.info('> Removing comments')
                commands.process_comments(CLIENT)
                commands.logger.info('> Renaming sources')
                commands.process_rename(CLIENT)
                commands.logger.info('> Reformating sources')
                commands.applyastyle(CLIENT)
                commands.logger.info('> Commenting OpenGL constants')
                commands.process_annotate(CLIENT)
                commands.logger.info('> Creating reobfuscation tables')
                commands.renamereobsrg(CLIENT)
                commands.logger.info('> Done in %.2f seconds' %
                                     (time.time() - clienttime))
        else:
            commands.logger.warn(
                '!! Client already decompiled. Run cleanup before decompiling again !!'
            )
            cltdone = True

        srcdir = os.path.join(commands.srcserver,
                              os.path.normpath(commands.ffsource))
        if not os.path.exists(srcdir):
            commands.logger.info('== Decompiling Server ==')
            if commands.checkjars(SERVER):
                servertime = time.time()
                commands.logger.info('> Creating SRGS for server')
                commands.createsrgs(SERVER)
                commands.logger.info('> Applying Retroguard to server')
                commands.applyrg(SERVER)
                commands.logger.info('> Applying Exceptor to server')
                commands.applyexceptor(SERVER)
                if use_ff:
                    commands.logger.info('> Decompiling...')
                    commands.applyff(SERVER)
                    commands.logger.info('> Unzipping the server sources')
                    commands.extractsrc(SERVER)
                commands.logger.info('> Unzipping the server jar')
                commands.extractjar(SERVER)
                if not use_ff:
                    commands.logger.info('> Applying jadretro')
                    commands.applyjadretro(SERVER)
                    commands.logger.info('> Decompiling...')
                    commands.applyjad(SERVER)
                    commands.logger.info('> Copying the server sources')
                    commands.copysrc(SERVER)
                commands.logger.info('> Applying patches')
                if commands.osname == 'osx' and not use_ff:
                    commands.applypatches(SERVER, False, True)
                commands.applypatches(SERVER, use_ff)
                commands.logger.info('> Removing comments')
                commands.process_comments(SERVER)
                commands.logger.info('> Renaming sources')
                commands.process_rename(SERVER)
                commands.logger.info('> Reformating sources')
                commands.applyastyle(SERVER)
                commands.logger.info('> Creating reobfuscation tables')
                commands.renamereobsrg(SERVER)
                commands.logger.info('> Done in %.2f seconds' %
                                     (time.time() - servertime))
        else:
            commands.logger.warn(
                '!! Server already decompiled. Run cleanup before decompiling again !!'
            )
            srvdone = True

        commands.logger.info('== Post decompiling operations ==')
        if not cltdone or not srvdone:
            commands.logger.info('> Recompiling')
            recompile(conffile)
        if not cltdone:
            commands.logger.info('> Generating the md5 (client)')
            commands.gathermd5s(CLIENT)
        if not srvdone:
            commands.logger.info('> Generating the md5 (server)')
            commands.gathermd5s(SERVER)
    except Exception:  # pylint: disable-msg=W0703
        commands.logger.exception('FATAL ERROR')
        sys.exit(1)