-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathis_onion_list_up.py
33 lines (30 loc) · 1.29 KB
/
is_onion_list_up.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
import requests
import re
from time import sleep
import datetime
#print(requests.get('http://verified2ebdpvms.onion/favicon.ico').status_code)
# /!\ Activate Kalitorify first /!\
statuscodes = (200,301,302,401,403,504)
while(1):
fin = open("test.md", "r")
content = [x.strip() for x in fin.readlines()]
fin.close()
fin = open("test.md", "w+")
for line in content:
s = re.search('([a-zA-Z0-9.\/:[\]()-]*]*).\|.([a-zA-Z0-9.\/:[\]()-]*]*).\|.([a-zA-Z0-9.\/:[\]()!-]*]*)', line)
if s :
if ".onion" in s.groups()[1]:
try :
if ping := requests.get(s.groups()[1], timeout=20, verify = False).status_code in statuscodes:
fin.write(line.replace(s.groups()[2], '![up](https://img.shields.io/badge/Statut-UP-green)')+'\n')
else :
fin.write(line.replace(s.groups()[2], '![down](https://img.shields.io/badge/Statut-DOWN-red)')+'\n')
except :
fin.write(line.replace(s.groups()[2], '![down](https://img.shields.io/badge/Statut-DOWN-red)')+'\n')
else :
fin.write(line+'\n')
else :
fin.write(line+'\n')
fin.close()
print(f"Fichier actualisé le {str(datetime.datetime.now())}")
sleep(1800)