Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d6a6a4d

Browse files
committedApr 25, 2023
feat: reduced interval for next packet, standard time: 1s, -i now 0.2ms. This prevents DOS
1 parent 40acce8 commit d6a6a4d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

‎cron_job/python2port.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def pingStatistics(ip):
5858
print " > GETTING STATISTICS FOR [ ", ip, " ]"
5959

6060
try:
61-
command = "ping6 -W 1 -c "+str(pingcount)+" "+str(ip)
61+
command = "ping6 -i 0.2 -W 1 -c "+str(pingcount)+" "+str(ip)
6262
process = Popen(command, stdout=PIPE, stderr=None, shell=True)
6363
output = process.communicate()[0]
6464

@@ -86,7 +86,8 @@ def pingStatistics(ip):
8686
def pingSuccess(ip):
8787
hostname = ip
8888
# -i for duration, -c for packet count
89-
response = os.system("ping6 -W 1 -c " + str(pingcount)+" " + str(hostname))
89+
response = os.system("ping6 -i 0.2 -W 1 -c " +
90+
str(pingcount)+" " + str(hostname))
9091
if response == 0:
9192
return 0
9293
else:

‎python2port.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def pingStatistics(ip):
6868
print " > GETTING STATISTICS FOR [ ", ip, " ]"
6969

7070
try:
71-
command = "ping6 -W 1 -c " + str(pingcount) + " " + str(ip)
71+
command = "ping6 -i 0.2 -W 1 -c " + str(pingcount) + " " + str(ip)
7272
process = Popen(command, stdout=PIPE, stderr=None, shell=True)
7373
output = process.communicate()[0]
7474

@@ -96,7 +96,7 @@ def pingStatistics(ip):
9696
def pingSuccess(ip):
9797
hostname = ip
9898
# -i for duration, -c for packet count
99-
response = os.system("ping6 -W 1 -c " +
99+
response = os.system("ping6 -i 0.2 -W 1 -c " +
100100
str(pingcount) + " " + str(hostname))
101101
if response == 0:
102102
return 0

0 commit comments

Comments
 (0)
Please sign in to comment.