## 4 Materials and Methods
### Feature Extraction Process  
In the scenario where a UAV spoofer is present, the TWR protocol is susceptible to deception, particularly in relation to the received request message and the replay time. The adversary emits undesired signals \(S\) toward the target, leading to an elevation in the level of noise experienced at the receiver. Consequently, the processing time required to decode the noisy signal is increased. Furthermore, the transmission time for the response message may also be extended due to the utilization of a channel by the adversary or the spoofer. Consequently, this can result in an extension of the sensing time required to identify an available channel. Therefore, the power received at the AP is considered have a significant amount of noise due to the spoofing signal, as presented in the following equation:  
\[P_{r}(AP)=P_{t}-10 nlog(d)+S \tag{14}\]  
In the presence of a spoofing signal \(S\), which is considered noise at the receiving side, the \(SNR\) at the \(AP\) from the target node decreases depending on the position of the UAV spoofer. To estimate the ToA or \((t_{prop})\), we utilized the power received at the \(AP\) by employing the following approach. The spoofing signal received by the \(AP\), including the received power from the target node, can be presented as follows:  
\[P_{r}(N,AP)=P_{t}(N)-10 nlog(d_{NAP})+S \tag{15}\]  
where the \(P_{r}(N,AP)\) is the total power received by the AP and S is the spoofing signal. To estimate the \((t_{prop})\) between two nodes in presence of a spoofer, we extended the concept of the distance ratio \(\beta\), which was described in [38], to estimate the ToA at different points. The distance ratio concept is based on the received power and SNR level at the receiving node. When the noise increases, the \(SNR\) decreases to reach the threshold value of the system. This means that the \(AP\) is located at the edge of the spoofing region, as shown in Figure 5, in which \(E\) is the edge node, \(N\) is the node, and \(AP\) is the AP. The distance between the spoofer and the \(AP\) is denoted by \(d_{SN}\), and the distance from the spoofer to the edge node is \(d_{SE}\). In this scenario, the edge node is assumed to be a virtual node in order to estimate the ratio of the distance between the spoofer to the edge and from the edge to the AP. Figure 4: Mechanism of the two-way ranging (TWR) approach. In accordance with Equation (15), we posited the scenario where the \(AP\) resides at the boundary of the spoofing region and may receive a spoofing signal while its \(SNR\) equals the prescribed system threshold. As a result, the ToA at the \(AP\) coincides with the ToA observed at the edge node \(E\). In this context, the distances between the spoofer, AP, and edge node remain uniform. For this scenario, the distance ratio is computed as follows:  
\[\beta=\frac{d_{SE}}{d_{SN}}\approx 1 \tag{16}\]  
We also noted a relationship between the distance ratio, the received power, the system threshold value \(\gamma\), and the noise received (including the spoofing signal), as follows:  
\[\beta=10^{\frac{\gamma-\hat{P}_{\gamma}(NAP)+\hat{S}_{AB}}{10\times n}} \tag{17}\]  
In our dataset, \(\beta\) serves as the foundational metric for training the deep learning model, thus enabling the detection of the adversary's presence and its subsequent localization.