- 数据集使用2021年5月到2021年7月的log数据为训练.2021年8月到2021年10月为预测数据
web攻击属于机器学习的分类问题,分类问题有可以分为监督学习和无监督学习.本文使用监督学习,也就是说样本需要提前标注.1表示web受到攻击,0表示web正常.
特征提取以下特征被用作分析,这些特征都是从log日志中提取出来的
HTTP return code URL length Number of parameters in the query
提取日志的脚本为:
#Retrieve data form a a http log file (access_log)
def extract_data(log_file):
regex = '([(d.)]+) - - [(.*?)] "(.*?)" (d+) (.+) 


