helper.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:FuzzFlow 作者: talos-vulndev 项目源码 文件源码
def update(self):
        print "[*] Trying to update the client..."
        try:
            with open("client.zip", "rb") as f:
                cli = f.read()
                hsh = hashlib.md5(cli).hexdigest()
        except IOError:
            hsh = "INVALID"

        path = Rest.get_update(hsh)
        if path is not None:
            shutil.rmtree('engine')
            shutil.rmtree('client')
            os.remove('client.py')
            os.remove('requirements.txt')

            f = zipfile.ZipFile(path, "r")
            f.extractall('tmp')
            f.close()

            root = 'tmp' + os.sep + 'client' + os.sep
            shutil.move(root + 'client', '.')
            shutil.move(root + 'engine', '.')
            shutil.move(root + 'client.py', '.')
            shutil.move(root + 'requirements.txt', '.')
            shutil.rmtree('tmp')

            args = sys.argv[:]
            print "[*] Update installed successfully, restarting...\n"

            args.insert(0, sys.executable)
            if sys.platform == 'win32':
                args = ['"%s"' % arg for arg in args]

            os.execv(sys.executable, args)
            sys.exit(1)

        else:
            print "[!] Client is already the latest version."
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号