{'fraction_non_alphanumeric': 0.031056270863137815, 'fraction_numerical': 0.008226037195994278, 'mean_word_length': 4.696774193548387, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
An Efficient and Secure Malicious Node Detection Model for Wireless Sensor Networks

In wireless sensor networks (WSNs), there are many factors, such as the reciprocal interference of wireless links, battlefield applications and nodes are exposed to poor physical protection medium. All of these result in the sensor nodes being more exposed to be attacked and compromised. Since sensors are normally energy limited in WSNs, it is constantly basic to conserve the node energy and expand the lifetime of the network. Besides, hierarchical clustering is deemed as one of the numerous ways to deal with the reduction of energy consumption of nodes and increasing the network lifetime in WSNs. This paper conspicuously introduces an efficient and secure malicious node detection model based on a hybrid clustering network for WSNs (ESMCH) which is based on a trusted mobile node. WSNs are still suffering from some attacks like Man-in-the-Middle Attack and Black hole Attack, so by using the ESMCH model, we can avoid these attacks. Finally, simulation results also indicate that the proposed model can increase the network lifetime, and achieve an efficient and secure clustering network.

behind the implementation of the clustering approach is to enhance the scalability of the network (prolong), it is an imperative factor for achieving an energy-efficient routing of the data in the network [2].
In wireless sensor networks (WSN), the current cluster-based routing techniques may result in increased network workload, energy consumption and re-transmissions [3]. In order to overcome these issues, we propose an efficient and secure malicious node detection model based on a hybrid clustering network for WSNs using trusted mobile nodes. In this model, each cluster node member sends the data to the cluster head. The aggregated data from the cluster head (CH) is transmitted to the base station through another cluster head called Super Cluster Head (SCH). An energy-efficient routing protocol is also developed based on the parameters expected the number of retransmissions and link failure probability.
The remaining of this paper is sketched as follows. Section 2 describes the related work in the field. Section 3 presents our system model and has some subsections which talked about used algorithms and the energy and security mechanisms. Section 4 presents the simulation results and discussion and finally, the conclusion is presented in Section 5.

RELATED WORKS
Jin-Shyan Lee and T. Kao developed an Improved Three-Layer Low-Energy Adaptive Clustering Hierarchy for WSNs. The authors developed this model to improve the energy and increase the lifetime of the network. This paper is fully concentrated on reducing energy consumption and prolonging the lifespan of WSNs. This is the disadvantage of this paper also by introducing the LEACH protocol, the performance level is insufficient. The simulation result shows the better performance when compared to others [2].
A survey on a Secure Data Aggregation for Wireless Sensor Networks using Double Cluster Head Approach introduced by A.L. Sreenivasulu and P. Chenna Reddy discussed double cluster head based secure aggregation method (DCSDA). In this paper, authors are concentrated on achieving security as the main aim which is appropriately applicable for the cluster-based communication approach. Also, it can deal with the privacy and authentication. The performance of the DCSDA system has been shown in the experimental calculation is in terms of energy consumption, packet drop ratio and delay [4]. Behara et al. introduced an Energy-efficient modified LEACH protocol for IoT application. An existing system, a threshold limit for the cluster head selection is introduced through changing the clustering protocol as alow-energy adaptive clustering hierarchy (LEACH). To increase the WSN lifetime, the performance of the modified LEACH protocol rises 67% in throughput. The performance of the LEACH protocol is much better when compared with other energy-efficient protocols. Additionally, the simulation shows the symbolic development in terms of stability period and network lifetime in various matrices such as area, energy, and node density [5].
I.S. Akila and R. Venkatesan proposed a model based on Fuzzy Based Energy-aware Clustering Architecture for Cooperative-Communication in WSN. For cooperative communication in WSN, Fuzzy-based clustering architecture is introduced. This algorithm is used to increase the energyefficiency and to prolong the lifetime of the network. Here, the fuzzy-based clustering protocol is used to determine the cooperative node which combines the cluster. To establish the optimum path between each CN and CH data transmission, particle swarm optimization is used. To enhance the lifetime network and energy efficiency the proposed technique is used and the result shows in the simulation [6].
In [7] , a secure system is proposed that is based on Using Elliptic Curve Cryptography based Digital Signature Algorithm (ECCDSA) the nodes of this network will authenticate successfully; wireless sensor network security will indicate the security over the network by Node authentication, self-healing and Error correction process.
A new scheme known as Energy Efficient Clustering Scheme for Prolonging the Lifetime of WSN with Isolated Nodes has been introduced by JenqLeu et al. they proposed a good algorithm to reduce the energy consumption and prolonging the network lifetime (REAC-IN). The regional average energy and distance between sensors are used to enhance the lifespan of the WSN network and to be isolated from CHs. The simulation result shows the better performance when compared to others [8].
Hierarchical Clustering-Task Scheduling Policy in Cluster-Based WSN is proposed to achieve an energy-efficiency, more flexible and scalable clustering-task scheduling, the hierarchical clustering-task scheduling policy in a cluster-based algorithm (HCSP) is used. Each cluster is reconfigurable only once at each local super round based on HCSP. Hence, throughout the network, it may lead to differ from one cluster to another [9].

ESMCH MODEL
This model will be classified according to clustering head selection, the energy model and security mechanism.

Network Definition
The network consists of one cluster head. Other nodes are sub-divided into sub-clusters. Each cluster in the network consists of some main nodes as cluster head node (CH), child nodes (CN) and mobile nodes (MN). The cluster head node suffers from transferring the data directly to the Super-cluster head (SCH) due to the distance. To address these issues, mobile sink nodes are introduced. The mobile sink mode acts as an intermediate between the cluster head and Supercluster head as shown in Figure 1. Each cluster has one or more mobile sink nodes consistent with the number of child nodes located in the cluster head.

Proposed Cluster Head Selection Technique
In this research, the ESMCH proposed two algorithms named as Intelligent based Secured Fuzzy Clustering algorithm (ISFC) and Balanced Load Sub-cluster head selection to decrease the distance between the nodes and reduce energy consumption.

Balanced Load Cluster Head Selection
Balancing the load between sensor nodes is a great challenge for the long run operation of wireless sensor networks [10]. When a sensor node becomes overloaded, the prospect of higher latency, energy loss, and congestion becomes high [11]. The balanced a load cluster head selection aims at decreasing the energy consumption and increasing the network lifetime by introducing load balancing concept in it. If a few cluster nodes are heavily loaded, it leads to faster energy consumption and to get the normal depletion of energy [12]. The balanced load cluster head selection is initiated. The distance between normal child nodes and cluster head plays a major part in energy consumption. So, balanced load cluster head selection leads to nominal energy depletion of each node is presented in the network by creating transmission with closer nodes by a balanced load among the cluster heads.

Algorithm 1: Balanced Load Cluster Head Selection
Step 1 CH advertisement and the counter value are declared as (N/CH)-1 to all CH nodes.
Step 3 Eq.1 used to calculate CH and CN distance with Distancethreshold.
Step 5 If = 0, Stop comparing Step 6 If CH reaches CL (capacity limits) rejection information transmission starts.
Step 7 Rejected CN nodes will send the requests to nearby CH node.

Intelligent Based Secured Fuzzy Clustering Algorithm
This algorithm mainly comprises three parameters. They are trust value of nodes, the trust value of the path and the coverage area of the nodes that are sent to the fuzzy-based cluster module to the child nodes [13]. This method concentrates in sub cluster-based routing through using the Fuzzy S-means (FSM) mechanism and cluster head will be selected randomly and at the initial condition. All the nodes have an equal amount of power [10].

Algorithm 2: ISFC
Input -Let N be the set of 30 nodes from WSN Output -Number of CH Number of nodes is given, ϵ > 0 indicates tolerance value of matrix A, repeat for j = 1 to N do Step 1 At the initial stage, random matrix partition occur such that U0 ϵ Mfc Step 2 Distance formula to obtain distance Step 3 Threshold value computation (Tho) Node Ni identificationnode election is random Step 4 If energy of the all the node is equal then if matrix (Ni) > Tho, Elect Ni as CH so new matrix will equal matrix (CH), else step 5.
Step 5 if matrix (Ni) < new matrix then elect backup SCH Step 6 if E > min energy and dist (CH) < SCH so that Th1 = [(Enmax {Ki * Ec * t} *N)/N] (4) If matrix (Ni) > Th1and matrix (Ni) will equal new CH and call FSM algorithm and new matrix will equal matrix (CH) Step 7 Call ACO algorithm for optimal path selection Step 8 Maintain the routing table with security extension and energy updating.
Step 9 Find the neighbors of each CH Step 10 Calculate the trust score (TS) and distance of the node (D) Step 11 Calculate the sum of the distance and trust score for all the nodes Step 12 Select the node with maximum trust value and minimum total distance.

Energy Computation
The consumed energy of Child Nodes (CN) and Cluster Head (CH) nodes as well as the total energy consumption of the cluster can be calculated using the following equations: According to the distance between the CH nodes and the CN nodes, the transmission power is changed and every sub-clusterhas an equal number of CN nodes [14]. That is given by (N/H)-1.
Eachsub-cluster has the initial energy of and the energy spent by the cluster head in each round is [1]. Hence lifetime of the network is given as in Equation 5.

Proposed Security Mechanism
The security services in WSN ought to protect the data conveyed over the network and the assets from attacks and bad conduct of nodes. In ESMCHmodel, we sought to achieve the security for the aggregated date in which our security mechanism is based on using Elliptic curve cryptography [15][16].

3.4.1EECC -Enhanced Elliptic Curve Cryptography
Our security mechanism is based on Elliptic Curve Cryptography (ECC) and we modify the origin of ECC to get more security [17]. As shown in Figure 2, the block diagram indicates the process of key generation, encryption, and decryption Electronic copy available at: https://ssrn.com/abstract=3565090

Key Generation
The user creates the secret key . Since two keys are created in EECC which is private key ( ) and public key ( ). The secret key is under gone XOR operation. The best point (k,l) and is the public key, then the is given as, = * In each transmission round, an encryption key is generated for every SN. The designed encryption key is of 176-bitto overcome the memory constraints of the sensor network [17]. It consists of three components. First component (Ki) is the 148 bits generated by ECC,the second component (SNIDi) is the node ID of 13 bits and the third component (dCH,i ) is the 15 bits for encoding the distance between the CHs and node i. The second component, is allocated 13 bits to make the proposed scheme feasible even in case of large-scale networks that might comprise of thousands of nodes as it allows to represent around eight thousand node IDs [18]. The key at node i is set as {Ki, SNIDi, dCH,i}.

Algorithm: Plaintext Encryption Process
This algorithm is used to encrypt the date to be more secure so the input and output will be as: Step 1 Divide the plaintext into Z blocks (size 88 bits), S= {a1, a2,….az} .

Algorithm: Plaintext Decryption Process
For this algorithm, the output from the previous algorithm (Ciphertext) will be the input to get the original data, Input: Ciphertext represented as S ̅ = {a 1 ̅̅̅, a 2 ̅̅̅, … … a Z ̅̅̅}. Output: Plaintext represented as S = {a 1 , a 2 , … . . a Z }.
Step 1 Receive ciphertextS ̅ from the CHx Step 2 Estimate|N count |, the number of cluster members Step 3 Estimate the aggregated data as ∂ = initial (N * 176) bits of S ̅ .

Performance Analysis
The simulation of this proposed model is carried out using the NS2 simulator based on the simulation parameters in Table 1. The proposed model is contrasted with DCSDA [4], ECCDSA [7], and E2HRC [19] by thinking about the overhead, security, accuracy in the data aggregation and energy consumption. Energy consumption is portrayed as the total average amount of energy expected to send and get or forward packets to the destination [20]. Average end to end delay (E2E delay) is characterized as the total time wanted for sending the information to the sink node. The Average Packet Drop ratio is likewise decided as the total average of the dropped packets at the receiving nodes. By NS-2 simulator as shown in Figure 3, we can simulate the network of ESMCH model in which child nodes can send the data to Cluster Head (CH) to reach the base station via the Super Cluster Head (SCH).  Figure 4 depicts the packet size ratio compared to network losses. We can achieve that by the ESMCH model; the network is more efficient and has lower losses with the higher value of packet delivery ratio (about 98%) than the compared approaches.  Figure 5 shows the total energy consumption of the ESMCH model compared to different models through the network lifetime. ESMCH model has lower energy consumption than the compared approaches. This model can achieve the balancing of the energy consumption between CHs and prolongs the network lifetime. Routing overhead is known as the ratio of the number of routing-related transmissions. Figure 6 compares the Routing overhead results of ESMCH with some previous approaches in which the proposed model reduces routing overhead.

Security Analysis
In this section, we show that the ESMCH model can stand out some attacks such asMan-in-the-Middle Attack and Black Hole Attack.
a) Man-in-the-Middle Attack: An active foe can change in the transmitted messages between the child nodes and their cluster heads and between cluster heads and super cluster head making them accept that they are communicating with the proposed party. In the ESMCH model, we can encrypt the authenticated information as pursue: private key ( ) and open key ( ) are generated.
is generated as, = * to encrypt and send a message (S) with key length of 176-bits which consists of three components {Ki, SNIDi, dCH,i}. We can encrypt and decrypt data using the above algorithms in section 3.4.4. b) Black hole Attack: an attack is mounted by an external enemy on a subset of the child nodes (CNs) in the network. The enemy captures these nodes then reprograms them so that they can't transmit any data packets. In ESMCH, we can avoid this attack by calculating the distance between neighbour nodes and between cluster head nodes so the list of neighbouring nodes is maintained by each node. The Routing path is made by using AODV Protocol. The generated key is based also in the distance between nodes.

CONCLUSION
In this paper, we introduced an efficient and secure malicious node detection model based on a hybrid clustering network for WSNs, which based on the clustering process using one cluster head and mobile trusted nodes. Firstly, the ESMCH model is described with all used algorithms then we analysed the energy computation and security mechanism. The performance is calculated based on delay, packet delivery ratio, drop and throughput. ESMCH model is more secure against some attacks like Man-in-the-Middle Attack and Black hole Attack. By simulation results using NS2 we could prove that the ESMCH model is better in performance and security than these compared models (DCSDA, ECCDSA, and E2HRC) which could help in providing considerable security and reducing energy consumption to increase the network lifetime.