| Algorithm 1: Botnet detection using one-class KNN | |
| Input: datasets d1, d2, d3 | |
| 1. | Convert datasets d1, d2, d3 into PCAP format |
| 2. | Apply filtering based on source and destination IP |
| 3. | |
| 4. | Data preprocessing to eliminate missing, infinite, NAN and HEX values |
| 5. | Perform feature selection using |
| 6. | Filter method |
| 7. | Wrapper method |
| 8. | End feature selection |
| 9. | For each dataset d1, d2, d3 apply one-class KNN |
| 10. | Load the training dataset |
| 11. | Choose the value of k |
| 12. | Train the model |
| 13. | Load the test dataset |
| 14. | For each point in the test data until point = NULL |
| 15. | Find Euclidian distance d to all training data points |
| 16. | Store d in a list L and sort it |
| 17. | Choose the first k points |
| 18. | Assign class to the test points |
| 19. | End For |
| 20. | End For |