# Teletraffic Analysis of DoS and Malware Cyber Attacks on P2P Networks under Exponential Assumptions
## Appendix A Algorithms  
```
1x=0;
2y=1;
3 fori=1 to 100,000 do
4 tau = min(M(-N(-x+y)),C-x);
5T1 = (-1/L) \(\cdot\) ln(1-u(0));
6T2 = (-1/(H(-x)) \(\cdot\) ln(1-u(0));
7T3 = (-1/(G-y)) \(\cdot\) ln(1-u(0));
8T4 = (-1/tau) \(\cdot\) ln(1-u(0));
9T = min(T1,T2,T3,T4);
10;
11 ifT=T1 then
12 x+=1 ;
13 elseifT=T2 then
14 x=1 ;
15 elseifT=T3 then
16 x=1 ;
17 y=1 ;
18 else
19 x+=1 ;
20 y+=1 ;
21 end if
22 Result: Number of x and y in total and at each step. ```  
**Algorithm A1**Simple Chain```
1 xn=0;
2 yn=1;
3 xi=0;
4 yi=1;
5 fori=1 to 100,000 do
6 Pn = (xn\(\cdot\)M+yn)/(xn+(yn+yi));
7 tauni = min(C\(\cdot\)(1-Pn)\(\cdot\)xi,M\(\cdot\)(N\(\cdot\)xn+yn)\(\cdot\)(1-Pn));
8 taunn = min(C\(\cdot\)P\(\cdot\)n\(\cdot\)xn,M\(\cdot\)(N\(\cdot\)xn+yn));
9 taui = min(C\(\cdot\)xi,((xn+xi)\(\cdot\)N+(yn+yi)\(\cdot\)(xi/(xn+xi))));
10 tauC = min(C\(\cdot\)K-(1-Pn)\(\cdot\)xn,M\(\cdot\)K-(M\(\cdot\)(xn+xi)+(yn+yi))\(\cdot\)(1-Pn));
11T1 = -(1/L) \(\cdot\) In(1-u(1));
12T2 = -(1/(H\(\cdot\)xn)) \(\cdot\) In(1-u(0));
13T3 = -(1/(H\(\cdot\)xi)) \(\cdot\) In(1-u(0));
14T4 = -(1/G\(\cdot\)yn) \(\cdot\) In(1-u(0));
15T5 = -(1/(G\(\cdot\)yi)) \(\cdot\) In(1-u(0));
16T6 = -(1/(tauC)) \(\cdot\) In(1-u(0));
17T7 = -(1/(tauui)) \(\cdot\) In(1-u(0));
18T8 = -(1/taui) \(\cdot\) In(1-u(0));
19T9 = -(1/tau) \(\cdot\) In(1-u(0));
20T = min(T1,T2,T3,T4,T5,T6,T7,T8,T9);
21 ifT=T1 then
22 xn += 1 ;
23 elseifT=T2 then
24 xn = 1 ;
25 elseifT=T3 then
26 xi -= 1 ;
27 elseifT=T4 then
28 yn -= 1 ;
29 elseifT=T5 then
30 yi -= 1 ;
31 elseifT=T6 then
32 xn = 1 ;
33 xi += 1 ;
34 elseifT=T7 then
35 xi -= 1 ;
36 xi += 1 ;
37 xi += 1 ;
38 xi += 1 ;
39 xi += 1 ;
40 else
41 xn = 1 ;
42 yn += 1 ;
43
44
45 end for
```

**Algorithm A2**Chain with infected nodes

**Result:** Number of \(xn\), \(xi\), \(yn\), and \(yi\) in total and at each step. ## References

* (1) [PERSON]; [PERSON], [PERSON]. _Peer-to-Peer Computing: Principles and Applications_; Springer: Berlin/Heidelberg, Germany, 2010; Volume 16. * (2) [PERSON]; [PERSON]; [PERSON] Priority scheme for mobile nodes in P2P bit-torrent based networks. In Proceedings of the 2014 28 th International Conference on Advanced Information Networking and Applications Workshops, Victoria, BC, Canada, 13-16 May 2014; IEEE: Piscataway, NJ, USA, 2014; pp. 469-473. * (3) [PERSON]; [PERSON]; [PERSON] Combating index poisoning in P2P file sharing. _Adv. Inf. Secur. Assur._**2009**, 5576, 358-367. [CrossRef]
* (4) [PERSON]; [PERSON] Model the P2P Attack in Computer Networks. In Proceedings of the International Conference on Logistics, Engineering, Management and Computer Science, Shenyang, China, 29-31 July 2015; pp. 1303-1307. [CrossRef]* [PERSON] and [PERSON] (2010) [PERSON]; [PERSON]. Unstructured peer-to-peer network architectures. In _Handbook of Peer-to-Peer Networking_; Springer: Boston, MA, USA 2010; pp. 117-142. * [PERSON] et al. (2022) [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON] A Comprehensive Review of Denial of Service Attacks in Blockchain Ecosystem and Open Challenges. _IEEE Access_**2022**, _10_, 96538-96555. [CrossRef]
* [PERSON] et al. (2016) [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON] [PERSON] Resolving Problems Based on Peer to Peer Network Security Issue's. In Proceedings of the Procedia Computer Science, Nagpur, India, 11-12 December 2015; Elsevier B.V.: Amsterdam, The Netherlands, 2016; Volume 78, pp. 652-659. [CrossRef]
* [PERSON] et al. (2019) [PERSON]; [PERSON]; [PERSON] Intelligent simulation of network worm propagation using the code red as an example. _Telecommun. Radio Eng._**2019**, _78_, 443-464. [CrossRef]
* [PERSON] et al. (2015) [PERSON]; [PERSON]; [PERSON]. A survey paper on malicious computer worms. _Int. J. Adv. Res. Comput. Sci. Technol._**2015**, \(3\), 161-167. * [PERSON] (2012) [PERSON] _Mathematical Modeling in Epidemiology_; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2012. * [PERSON] and [PERSON] (2020) [PERSON]; [PERSON] [PERSON] Analysis of Virus Propagation: A Transition Model Representation of Stochastic Epidemiological Models.