With the increasing sophistication of cyber attacks, it has become essential for network security professionals to develop robust and effective methods for detecting BOT attacks. Machine learning algorithms have emerged as a promising solution in this regard, offering the ability to learn from data and detect patterns that may be indicative of malicious activity. Onion routing is a technique which protects internet user from the malicious attacks. Due to its slow performance in multi-layer of encryption and data can be routed to several servers. In our research we can combine onion routing with machine learning algorithms. In this paper, we analysed the performance of several popular machine learning algorithms, including Random Forest, Support Vector Machine (SVM), Neural Network Stochastic Gradient Descent, Neural Network Limited-memory Broyden-Fletcher-Goldfarb-Shanno, Neural Network adam, K-means Clustering, Hidden Markov Models (HMM), and Logistic Regression, for detecting BOT attacks in a network and portable executable file (PE File) modification. We begin by providing an overview of BOT attacks , PE file modification and the different machine learning algorithms used for detecting them. Next, we explore the performance metrics used to evaluate these algorithms and compare their performance based on these metrics. Finally, we identify the algorithm(s) that perform better in detecting BOT attacks and compared with initial model and resilient model of PE file. By the end of this paper, readers will have a comprehensive understanding of the strengths and weaknesses of different machine learning algorithms for detecting BOT attacks in a network.