Skip to content

Commit d5be14c

Browse files
grayddqgrayddq
authored andcommitted
bug
1 parent f52602f commit d5be14c

7 files changed

Lines changed: 41 additions & 38 deletions

File tree

GScan.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
Rootkit_Analysis().run()
8080
# WEBShell类扫描
8181
Webshell_Analysis().run()
82+
# 漏洞扫描
83+
8284

8385
# 输出报告
8486
print(u'-' * 30)

lib/.DS_Store

6 KB
Binary file not shown.

lib/History_Analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def run(self):
5151
result_output_tag(suspicious, malice)
5252

5353
# 检测结果输出到文件
54-
result_output_file(u'可疑的操作记录如下:\n', self.history)
54+
result_output_file(u'可疑的操作记录如下:', self.history)
5555

5656

5757
if __name__ == '__main__':

lib/Proc_Analysis.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ def keyi_analysis(self):
137137
except:
138138
return suspicious, malice
139139

140-
141140
def run(self):
142141
print(u'\n开始进程类安全扫描')
143142
file_write(u'\n开始进程类安全扫描\n')
@@ -166,8 +165,6 @@ def run(self):
166165
result_output_file(u'恶意进程如下:', self.process_backdoor)
167166

168167

169-
170-
171168
if __name__ == '__main__':
172169
infos = Proc_Analysis()
173170
infos.run()

lib/Rootkit_Analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ def run(self):
747747
result_output_tag(suspicious, malice)
748748

749749
# 检测结果输出到文件
750-
result_output_file(u'Rootkit类安全扫描如下:\n', self.rootkit)
750+
result_output_file(u'Rootkit类安全扫描如下:', self.rootkit)
751751

752752

753753
if __name__ == '__main__':

lib/Webshell_Analysis.py

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from lib.common import *
44
import os, platform, sys
55
from lib.Webserver import *
6+
from lib.globalvar import *
67

78

89
# 作者:咚咚呛
@@ -63,42 +64,44 @@ def scan_web(self):
6364

6465
def init_scan(self):
6566
suspicious, malice, skip = False, False, False
66-
if sys.version_info < (3, 0):
67-
DEPENDENT_LIBRARIES_2_6 = "/lib/egg/yara_python-3.5.0-py2.6-linux-2.32-x86_64.egg"
68-
DEPENDENT_LIBRARIES_3_10 = "/lib/egg/yara_python-3.5.0-py2.7-linux-3.10-x86_64.egg"
69-
DEPENDENT_LIBRARIES_4_20 = "/lib/egg/yara_python-3.8.1-py2.7-linux-4.20-x86_64.egg"
70-
DEPENDENT_LIBRARIES_16 = "/lib/egg/yara_python-3.5.0-py2.7-macosx-10.12-x86_64.egg"
71-
DEPENDENT_LIBRARIES_17 = "/lib/egg/yara_python-3.5.0-py2.7-macosx-10.13-x86_64.egg"
72-
_kernel = platform.release()
73-
if _kernel.startswith('2.6'):
74-
sys.path.append(sys.path[0] + DEPENDENT_LIBRARIES_2_6)
75-
elif _kernel.startswith('3.') and ("6." in str(platform.dist())):
76-
sys.path.append(sys.path[0] + DEPENDENT_LIBRARIES_2_6)
77-
elif _kernel.startswith('3.'):
78-
sys.path.append(sys.path[0] + DEPENDENT_LIBRARIES_3_10)
79-
elif _kernel.startswith('4.'):
80-
sys.path.append(sys.path[0] + DEPENDENT_LIBRARIES_4_20)
81-
elif _kernel.startswith('16.'):
82-
sys.path.append(sys.path[0] + DEPENDENT_LIBRARIES_16)
83-
elif _kernel.startswith('17.'):
84-
sys.path.append(sys.path[0] + DEPENDENT_LIBRARIES_17)
67+
try:
68+
SYS_PATH = get_value('SYS_PATH')
69+
if sys.version_info < (3, 0):
70+
DEPENDENT_LIBRARIES_2_6 = "/lib/egg/yara_python-3.5.0-py2.6-linux-2.32-x86_64.egg"
71+
DEPENDENT_LIBRARIES_3_10 = "/lib/egg/yara_python-3.5.0-py2.7-linux-3.10-x86_64.egg"
72+
DEPENDENT_LIBRARIES_4_20 = "/lib/egg/yara_python-3.8.1-py2.7-linux-4.20-x86_64.egg"
73+
DEPENDENT_LIBRARIES_16 = "/lib/egg/yara_python-3.5.0-py2.7-macosx-10.12-x86_64.egg"
74+
DEPENDENT_LIBRARIES_17 = "/lib/egg/yara_python-3.5.0-py2.7-macosx-10.13-x86_64.egg"
75+
_kernel = platform.release()
76+
if _kernel.startswith('2.6'):
77+
sys.path.append(SYS_PATH + DEPENDENT_LIBRARIES_2_6)
78+
elif _kernel.startswith('3.') and ("6." in str(platform.dist())):
79+
sys.path.append(SYS_PATH + DEPENDENT_LIBRARIES_2_6)
80+
elif _kernel.startswith('3.'):
81+
sys.path.append(SYS_PATH + DEPENDENT_LIBRARIES_3_10)
82+
elif _kernel.startswith('4.'):
83+
sys.path.append(SYS_PATH + DEPENDENT_LIBRARIES_4_20)
84+
elif _kernel.startswith('16.'):
85+
sys.path.append(SYS_PATH + DEPENDENT_LIBRARIES_16)
86+
elif _kernel.startswith('17.'):
87+
sys.path.append(SYS_PATH + DEPENDENT_LIBRARIES_17)
88+
else:
89+
return suspicious, malice, True
90+
import yara
8591
else:
86-
# pringf(u'跳过', suspicious=True)
8792
return suspicious, malice, True
88-
import yara
89-
else:
90-
# pringf(u'跳过', suspicious=True)
91-
return suspicious, malice, True
9293

93-
# 编译规则
94-
self.yararule = self.getRules(yara)
95-
self.scan_web()
94+
# 编译规则
95+
self.yararule = self.getRules(yara)
96+
self.scan_web()
9697

97-
if len(self.webshell_list) > 0:
98-
malice = True
99-
# 内容去重
100-
self.webshell_list = list(set(self.webshell_list))
101-
return suspicious, malice, skip
98+
if len(self.webshell_list) > 0:
99+
malice = True
100+
# 内容去重
101+
self.webshell_list = list(set(self.webshell_list))
102+
return suspicious, malice, skip
103+
except:
104+
return suspicious, malice, skip
102105

103106
def run(self):
104107
print(u'\n开始Webshell安全扫描')

lib/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ def analysis_file(file):
272272

273273
if not os.path.exists(file): return ""
274274
if os.path.isdir(file): return ""
275-
if " " in file: return ""
275+
if (" " in file) or ("GScan" in file) or ("\\" in file) or (".jpg" in file) or (")" in file) or (
276+
"(" in file): return ""
276277
if 'GScan' in file: return ""
277278
if '\\' in file: return ""
278279
if os.path.splitext(file)[1] == '.log': return ""

0 commit comments

Comments
 (0)