示例#1
0
def feature(PATH):

	#filename = './fuzzdb/attack-payloads/sql-injection/detect/MySQL.fuzz.txt'
	filename = PATH
	test_case_list = file_operation.fileopt_line(filename)
	full_list = file_operation.fileopt_all(filename)
	full_stat_list = testcase_stat.stat_all(full_list)
	test_case_stat_list = testcase_stat.stat(test_case_list)
	tf_matrix = testcase_stat.compute_tf(test_case_stat_list)
	test_case_stat_list = testcase_stat.stat(test_case_list)
	idf_matrix = testcase_stat.compute_idf(test_case_stat_list, full_stat_list)
	tf_idf_list = testcase_stat.compute_tf_idf(tf_matrix, idf_matrix)
	test_case_feature_list = testcase_stat.feature_vector_quantify(tf_idf_list, full_stat_list)

	return test_case_feature_list
示例#2
0
import os
import json

#------------------------------------------------------------------
#
#	Init part, this section can be described as the initiation part 
#		of test cases
#	All test cases need to be counted should be loaded in this part
#
#-------------------------------------------------------------------
filename = './Input_data/test.txt'
#This part should be replaced as user input or configure files

test_case_list = file_operation.fileopt_line(filename)
full_list = file_operation.fileopt_all(filename)
full_stat_list = testcase_stat.stat_all(full_list)
test_case_stat_list = testcase_stat.stat(test_case_list)
json.dump(full_stat_list, open('./statistics/full_stat_list.json', 'w'))
json.dump(test_case_stat_list, open('./statistics/test_case_stat_list.json', 'w'))
#-------------------------------------------------------------------
#	test_case_list is the list stored the test cases read from files
#	Sample : [
#				['alice', 'dod', 'alice', 'bob', 'alice', 'tom'],
#			 	['alice', 'dod', 'alice', 'bob', 'alice', 'tom']
#			 ]
#
#	full_list is the total list without split
#	full_stat_list is used to stat full list
#	test_case_stat_list is the split test cases list statistic list
#
#-------------------------------------------------------------------
示例#3
0
import os
import json

#------------------------------------------------------------------
#
#	Init part, this section can be described as the initiation part
#		of test cases
#	All test cases need to be counted should be loaded in this part
#
#-------------------------------------------------------------------
filename = './Input_data/test.txt'
#This part should be replaced as user input or configure files

test_case_list = file_operation.fileopt_line(filename)
full_list = file_operation.fileopt_all(filename)
full_stat_list = testcase_stat.stat_all(full_list)
test_case_stat_list = testcase_stat.stat(test_case_list)
json.dump(full_stat_list, open('./statistics/full_stat_list.json', 'w'))
json.dump(test_case_stat_list,
          open('./statistics/test_case_stat_list.json', 'w'))
#-------------------------------------------------------------------
#	test_case_list is the list stored the test cases read from files
#	Sample : [
#				['alice', 'dod', 'alice', 'bob', 'alice', 'tom'],
#			 	['alice', 'dod', 'alice', 'bob', 'alice', 'tom']
#			 ]
#
#	full_list is the total list without split
#	full_stat_list is used to stat full list
#	test_case_stat_list is the split test cases list statistic list
#