Fwaf-Machine-Learning-driven-Web-Application-Firewall
Machine learning driven web application firewall to detect malicious queries with high accuracy.
Link: http://fsecurify.com/fwaf-machine-learning-driven-web-application-firewall/
Category: Python / Deep Learning |
Watchers: 40 |
Star: 372 |
Fork: 125 |
Last update: Jun 25, 2022 |
Machine learning driven web application firewall to detect malicious queries with high accuracy.
Link: http://fsecurify.com/fwaf-machine-learning-driven-web-application-firewall/
I improved the performance and added some evaluation output to your script as stated in my comments on http://www.kdnuggets.com/2017/02/machine-learning-driven-firewall.html
Parameters: Using sublinear scaling, n-gram range from 1 - 3 (I used the one supplied by sklearn TfidfVectorizer), cut-off of 0.0 for TF IDF and balanced class weighting in the logistic regression
Performance Evaluation on test set: Accuracy: 0.999348 Precision: 0.983826 Recall: 0.996927 --> Missing ~150 attacks F1-Score: 0.990333 AUC: 0.999981
Opposed to original parameters: Accuracy: 0.997982 Precision: 0.996632 Recall: 0.942977 --> Missing ~2,500 attacks F1-Score: 0.969063 AUC: 0.999227
Modified file opening statement to make use of with
context manager. It makes sure that the file is cleanly closed after accessing the data. Also added in os.path.join
because it prevents the code from breaking on different platforms which might use "" for path separation. :+1:
Again a small improvement in performance: I weighted the bad queries higher in the logistic regression. :-)
Greetings, I want to use the data here for a project of mine. I need to verify the source of the data and the licence it has. Could you help me out with this?
Where do you use data (goodqueries and badqueries ) from ?
Hai
Hi,
Has the ML script been run recently?
I tried to run it with python 3 and 2 and got errors.
For inst with python 2 (might be 2.7.15), I got the following logs:
"(py27) C:\Users\Thomas Lev\Documents\Fwaf\Fwaf-Machine-Learning-driven-Web-Application-Firewall-master>python script.py
C:\Users\Thomas Lev\AppData\Local\conda\conda\envs\py27\lib\site-packages\sklearn\cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
Traceback (most recent call last):
File "script.py", line 43, in
Thanks
Thomas
When i was test,there are a lot of error codes,Can you submit the code that can run to github?