Skip to content

Commit f88dfb5

Browse files
committed
v1.0
1 parent 4150322 commit f88dfb5

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

check.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import os
2-
import re
3-
import numpy as np
42

53
from sklearn.feature_extraction.text import CountVectorizer
64
from sklearn.feature_extraction.text import TfidfTransformer
@@ -57,23 +55,23 @@ def check_webshell(dir):
5755
for filename in filelist:
5856
fulpath=os.path.join(path, filename)
5957
all += 1
60-
if filename.endswith('.php'):
58+
if filename.endswith('.php') or filename.endswith('.txt'):
6159
all_php += 1
6260
t = load_str(fulpath)
6361
t_list=[]
6462
t_list.append(t)
6563
x = CV1.transform(t_list).toarray()
6664
x = transformer.fit_transform(x).toarray()
6765
y_pred = clf1.predict(x)
68-
elif filename.endswith('.asp'):
66+
elif filename.endswith('.asp') or filename.endswith('.txt'):
6967
all_asp += 1
7068
t = load_str(fulpath)
7169
t_list=[]
7270
t_list.append(t)
7371
x = CV2.transform(t_list).toarray()
7472
x = transformer.fit_transform(x).toarray()
7573
y_pred = clf2.predict(x)
76-
elif filename.endswith('.jsp'):
74+
elif filename.endswith('.jsp') or filename.endswith('.txt'):
7775
all_jsp += 1
7876
t = load_str(fulpath)
7977
t_list=[]

train_asp.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import re
21
import os
3-
import numpy as np
42

53
from sklearn.feature_extraction.text import CountVectorizer
64
from sklearn.model_selection import train_test_split
@@ -32,7 +30,7 @@ def load_files(dir):
3230
g = os.walk(dir)
3331
for path, d, filelist in g:
3432
for filename in filelist:
35-
if filename.endswith('.asp') or filename.endswith('.txt'):
33+
if filename.endswith('.asp'):
3634
fulpath = os.path.join(path, filename)
3735
print "Load %s" % fulpath
3836
t = load_str(fulpath)

train_jsp.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import re
21
import os
3-
import numpy as np
42

53
from sklearn.feature_extraction.text import CountVectorizer
64
from sklearn.model_selection import train_test_split
@@ -32,7 +30,7 @@ def load_files(dir):
3230
g = os.walk(dir)
3331
for path, d, filelist in g:
3432
for filename in filelist:
35-
if filename.endswith('.jsp') or filename.endswith('txt'):
33+
if filename.endswith('.jsp'):
3634
fulpath = os.path.join(path, filename)
3735
print "Load %s" % fulpath
3836
t = load_str(fulpath)

train_php.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import re
21
import os
3-
import numpy as np
42

53
from sklearn.feature_extraction.text import CountVectorizer
64
from sklearn.model_selection import train_test_split
@@ -32,7 +30,7 @@ def load_files(dir):
3230
g = os.walk(dir)
3331
for path, d, filelist in g:
3432
for filename in filelist:
35-
if filename.endswith('.php') or filename.endswith('.txt'):
33+
if filename.endswith('.php'):
3634
fulpath = os.path.join(path, filename)
3735
print "Load %s" % fulpath
3836
t = load_str(fulpath)

0 commit comments

Comments
 (0)