@@ -17,38 +17,23 @@ class WebTask(object):
17
17
value_list = []
18
18
result_dict = {}
19
19
20
- def __init__ (self , input , rules ,all ,threads ):
21
- self .path = input
22
- if rules :
23
- config .filter_strs .append (r'.*' + str (rules )+ '.*' )
24
- self .all = all
25
- self .threads = threads
20
+ def __init__ (self , path ):
21
+ self .path = path
26
22
self .file_queue = Queue ()
27
- self .shell_falg = False
28
23
29
24
def start (self ):
30
- # 此处判断是文件还是目录
31
- # 文件判断后缀 html,js,css,htm,xml等
32
-
33
25
if len (config .web_file_suffix ) <= 0 :
34
26
scanner_file_suffix = ["html" ,"js" ,"html" ,"xml" ]
35
27
36
28
scanner_file_suffix = config .web_file_suffix
37
- if os .path .isdir (self .path ): # 目录的话就提取
29
+ if os .path .isdir (self .path ):
38
30
self .__get_scanner_file__ (self .path ,scanner_file_suffix )
39
-
40
31
else :
41
- if not (self .path .split ("." )[- 1 ] in scanner_file_suffix ): # 内容包含进行下步处理
32
+ if not (self .path .split ("." )[- 1 ] in scanner_file_suffix ):
42
33
err_info = ("Retrieval of this file type is not supported. Select a file or directory with a suffix of %s" % "," .join (scanner_file_suffix ))
43
34
raise Exception (err_info )
44
35
self .file_queue .put (self .path )
45
-
46
- self .__start_threads ()
47
-
48
- for thread in self .thread_list :
49
- thread .join ()
50
-
51
- self .__print__ ()
36
+ return {"comp_list" :[],"shell_flag" :False ,"file_queue" :self .file_queue ,"packagename" :None }
52
37
53
38
def __get_scanner_file__ (self ,scanner_dir ,file_suffix ):
54
39
dir_or_files = os .listdir (scanner_dir )
@@ -61,22 +46,22 @@ def __get_scanner_file__(self,scanner_dir,file_suffix):
61
46
if dir_file .split ("." )[- 1 ] in file_suffix :
62
47
self .file_queue .put (dir_file_path )
63
48
64
- def __print__ (self ):
65
- print ("=========The result set for the static scan is shown below:===============" )
66
- with open (cores .result_path ,"a+" ) as f :
67
- for key ,value in self .result_dict .items ():
68
- f .write (key + "\r " )
69
- for result in value :
70
- if result in self .value_list :
71
- continue
72
- self .value_list .append (result )
73
- print (result )
74
- f .write ("\t " + result + "\r " )
75
- print ("For more information about the search, see: %s" % (cores .result_path ))
49
+ # def __print__(self):
50
+ # print("=========The result set for the static scan is shown below:===============")
51
+ # with open(cores.result_path,"a+") as f:
52
+ # for key,value in self.result_dict.items():
53
+ # f.write(key+"\r")
54
+ # for result in value:
55
+ # if result in self.value_list:
56
+ # continue
57
+ # self.value_list.append(result)
58
+ # print(result)
59
+ # f.write("\t"+result+"\r")
60
+ # print("For more information about the search, see: %s" %(cores.result_path))
76
61
77
- def __start_threads (self ):
78
- for threadID in range (1 ,self .threads ) :
79
- name = "Thread - " + str (threadID )
80
- thread = ParsesThreads (threadID ,name ,self .file_queue ,self .all ,self .result_dict )
81
- thread .start ()
82
- self .thread_list .append (thread )
62
+ # def __start_threads(self):
63
+ # for threadID in range(1,self.threads) :
64
+ # name = "Thread - " + str(threadID)
65
+ # thread = ParsesThreads(threadID,name,self.file_queue,self.all,self.result_dict)
66
+ # thread.start()
67
+ # self.thread_list.append(thread)
0 commit comments