-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathidentify_df.py
More file actions
45 lines (34 loc) · 1.12 KB
/
identify_df.py
File metadata and controls
45 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import re
import sys
import pickle
import pandas as pd
import tensorflow as tf
from check_malware import check_malware
def get_data():
'''
Extracting data from dataset
'''
no_of_arg = len(sys.argv)-1
arg = sys.argv[1:]
for i in range(no_of_arg):
if((arg[i][0]=="'") or (arg[i][0]=='"')):
arg[i] = arg[i][1:-1]
for k in arg:
# reading csv file
j = pd.read_csv(k)
j.drop(columns=['TimeDateStamp'], inplace=True)
classes, prob, pred = check_malware(j)
print('\n', k)
print('--------------------------------------')
print('Application => Category => Probability')
print('--------------------------------------')
for i in range(j.shape[0]):
# for ML model
# print(app[i], ' => ', classes[i], ' => ', prob[i][pred[i]])
# for DL model
print(i, ' => ', classes[i], ' => ', prob[i][0])
# tupled_data.extend(j.values.tolist())
# test_df = pd.DataFrame(data=tupled_data, columns=j.columns)
# check_malware(test_df)
if __name__ == "__main__":
get_data()