WSN (Wireless Sensor Network) is considered as one of the promising technologies which are utilized in various fields for various applications. Along with it, MANET (Mobile Ad Hoc Network) has attracted a distinct attention, as they serve communication means across innumerable domain. In recent years, due to the development of both wired and wireless technologies, attacks are becoming more frequent and these attacks can be in various form such as worm hole, black hole, grey-hole, sinkhole and others. These attacks can cause loss of security, increase the number of drop packets, decrease packet delivery ratio which result in poor routing performance. In order to overcome these issues, the proposed study employs PBCS (Particle Bee Colony Swarm) algorithm for finding the shortest path between the nodes, which helps in reducing the routing cost and makes the model more efficient and effective. In addition to this, Hybrid AdaBoost-Random forest algorithm is utilized in proposed model. This model helps in reducing the training time which makes the model more reliable and efficient than existing models. It can be implemented in huge dataset and in Hybrid AdaBoost-Random Forest algorithm, estimator of random forest is used, which result in high accuracy and low loss. AODV (Ad-Hoc on Demand Vector) protocol helps to identify the prevention of attack as this routing protocol perform better for longer and extensive duration of traffic than other protocols. The performance of the proposed model is evaluated using different metrics which includes accuracy, recall, precision, sensitivity and specificity. Besides, energy consumption, throughput, network lifetime, delay of the proposed model is also evaluated. The proposed model is then compared with various existing models in order to determine the efficiency and effectiveness of the proposed framework.