In terms of security and privacy, mobile ad-hoc network (MANET) continues to be in demand for additional debate and development. As more MANET applications become data-oriented, implementing a secure and reliable data transfer protocol becomes a major concern in the architecture. However, MANET's lack of infrastructure, unpredictable topology, and restricted resources, as well as the lack of a previously permitted trust relationship among connected nodes, contribute to the attack detection burden. A novel detection approach is presented in this paper to classify passive and active black-hole attacks. The proposed approach is based on the dipper throated optimization (DTO) algorithm, which presents a plausible path out of multiple paths for statistics transmission to boost MANETs' quality of service. A group of selected packet features will then be weighed by the DTO-based multi-layer perceptron (DTO-MLP), and these features are collected from nodes using the Low Energy Adaptive Clustering Hierarchical (LEACH) clustering technique. MLP is a powerful classifier and the DTO weight optimization method has a significant impact on improving the classification process by strengthening the weights of key features while suppressing the weights of minor features. This hybrid method is primarily designed to combat active black-hole assaults. Using the LEACH clustering phase, however, can also detect passive black-hole attacks. The effect of mobility variation on detection error and routing overhead is explored and evaluated using the suggested approach. For diverse mobility situations, the results demonstrate 1906 CMC, 2023, vol.74, no.1 up to 97% detection accuracy and faster execution time. Furthermore, the suggested approach uses an adjustable threshold value to make a correct conclusion regarding whether a node is malicious or benign.