-
Notifications
You must be signed in to change notification settings - Fork 1
/
Python-paris-traceroute-script-for-shell.py
44 lines (40 loc) · 1.64 KB
/
Python-paris-traceroute-script-for-shell.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Subprocess makes it possible to run other languages inside a Python script.
import subprocess
# A mini python program is defined, so that it runs only when you call it.
def pinger():
# The batch script file is called from the folder it was saved in my PC.
subprocess.call([r'sh', './shell.sh'])
# Here I try to run the code three times using a "for loop" concept.
for number_of_runs in range(10):
# Here I specify that when the batchh script runs the first time, it shows an
# an output specifying the first one has ran successfully, etc.
if number_of_runs == 0:
pinger()
print('First Paris Traceroute has been completed')
elif number_of_runs == 1:
pinger()
print('Second Paris Traceroute has been completed')
elif number_of_runs == 2:
pinger()
print('Third Paris Traceroute has been completed')
elif number_of_runs == 3:
pinger()
print('Fourth Paris Traceroute has been completed')
elif number_of_runs == 4:
pinger()
print('Fifth Paris Traceroute has been completed')
elif number_of_runs == 5:
pinger()
print('Sixth Paris Traceroute has been completed')
elif number_of_runs == 6:
pinger()
print('Seventh Paris Traceroute has been completed')
elif number_of_runs == 7:
pinger()
print('Eight Paris Traceroute has been completed')
elif number_of_runs == 8:
pinger()
print('Nineth Paris Traceroute has been completed')
elif number_of_runs == 9:
pinger()
print('Tenth Paris Traceroute has been completed')