Chapter 5 – Botnet Detection with Machine Learning
As we did after every chapter, we are going to give you the opportunity to practice what you have learned and evaluate your skills. This chapter's GitHub repository contains a link to botnet traffic dataset in the practice folder at https://github.com/PacktPublishing/Mastering-Machine-Learning-for-Penetration-Testing/tree/master/Chapter5:
- Download the dataset and load it with the pandas library
- Select the suitable features
- Identify the training and testing sets, then export them into a
.pickle
file - Load the
.pickle
file - Use the same code blocks of Chapter 5, Botnet Detection with Machine Learning.
Import a support vector machine classifier:
from sklearn.svm import *
Train the SVM model:
clf= SVC(kernel='rbf') clf.fit(Xdata, Ydata)
Print out the accuracy of the built model:
Score = clf.score(XdataT,YdataT) print (“The Score of the SVM Classifier is”, Score * 100)