# -*- coding: utf-8 -*- # Author: kelvinBen # Github: https://github.com/kelvinBen/AppInfoScanner import os import re import time import config import hashlib from queue import Queue import libs.core as cores from libs.core.download import DownloadThreads class DownloadTask(object): def start(self,path,types): create_time = time.strftime("%Y%m%d%H%M%S", time.localtime()) if path.endswith("apk"): types = "Android" file_name = create_time+ ".apk" elif path.endswith("ipa"): types = "iOS" file_name = create_time + ".ipa" else: types = "WEB" file_name = create_time + ".html" if not(path.startswith("http://") or path.startswith("https://")): if not os.path.isdir(path): return {"path":self.path,"type":types} else: return {"path":self.path,"type":self.types} else: print("[*] Detected that the task is not local, preparing to download file......") cache_path = os.path.join(cores.download_path, file_name) thread = DownloadThreads(path,file_name,cache_path,types) thread.start() thread.join() return {"path":cache_path,"type":types}