You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.3 KiB
39 lines
1.3 KiB
# -*- 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_suffix = ".apk"
|
|
elif path.endswith("ipa"):
|
|
types = "iOS"
|
|
file_suffix = ".ipa"
|
|
else:
|
|
types = "WEB"
|
|
file_suffix = ".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, create_time + file_suffix)
|
|
thread = DownloadThreads(path,cache_path,types)
|
|
thread.start()
|
|
thread.join()
|
|
|
|
return {"path":cache_path,"type":types} |