怎么用python解压分析jar包-创新互联
小编给大家分享一下怎么用python解压分析jar包,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
创新互联专注于阳西企业网站建设,成都响应式网站建设,商城开发。阳西网站建设公司,为阳西等地区提供建站服务。全流程按需网站建设,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务Python主要用来做什么Python主要应用于:1、Web开发;2、数据科学研究;3、网络爬虫;4、嵌入式应用开发;5、游戏开发;6、桌面应用开发。
代码如下:
# -*- coding: utf-8 -*- import os import shutil import zipfile count = 1 def getSumDir(): sumfilelist = os.listdir(os.getcwd()) for dir in sumfilelist: if ".idea" not in dir: classify(dir) def getlibDir(): sumfilelist = os.listdir(os.getcwd()) for dir in sumfilelist: if "libs" in dir: jieyajar(dir) def jieyajar(dir): files = os.listdir(dir) for jars in files: if "jar" in jars: zfile = zipfile.ZipFile('libs/' + jars, 'r') if not os.path.exists(os.getcwd() + '/jarlog/' + jars): os.makedirs(os.getcwd() + '/jarlog/' + jars) zfile.extractall(os.getcwd() + '/jarlog/' + jars) if not os.path.exists(os.getcwd() + '/jars/'): os.makedirs(os.getcwd() + '/jars/') zfile.extractall(os.getcwd() + '/jars/') zfile.close for file in os.listdir(os.getcwd()): if "jars" in file: classify(file) # def classify(path): # if os.path.isfile(path): # if ".class" not in path: # if "assets" in os.path.dirname(path): # if not os.path.exists(os.path.dirname(os.getcwd()) + '/assets/' + os.path.dirname(path)): # os.makedirs(os.path.dirname(os.getcwd()) + '/assets/' + os.path.dirname(path)) # shutil.copy(path, os.path.dirname(os.getcwd()) + '/assets/' + os.path.dirname(path)) # else: # if not os.path.exists(os.path.dirname(os.getcwd())+'/root/'+os.path.dirname(path)): # os.makedirs(os.path.dirname(os.getcwd())+'/root/'+os.path.dirname(path)) # shutil.copy(path,os.path.dirname(os.getcwd())+'/root/'+os.path.dirname(path)) # else : # list = os.listdir(path) # for dir in list: # classify(path+"/"+dir) def classify(path): global count if os.path.isfile(path): if ".class" not in path: if not os.path.exists(os.getcwd() + '/root/' + os.path.dirname(path)): os.makedirs(os.getcwd() + '/root/' + os.path.dirname(path)) shutil.copy(path, os.getcwd() + '/root/' + os.path.dirname(path)) else: if 'assets' in path and count == 1: count = count + 1 shutil.copytree(os.getcwd()+'/'+path, os.getcwd() + '/assets') elif 'META-INF' not in path: list = os.listdir(path) for dir in list: classify(path + "/" + dir) # getSumDir() getlibDir()
看完了这篇文章,相信你对“怎么用python解压分析jar包”有了一定的了解,如果想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!
网站标题:怎么用python解压分析jar包-创新互联
当前路径:http://hbruida.cn/article/dhsjje.html