This repository was archived by the owner on Jan 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (57 loc) · 2.1 KB
/
ping.yml
File metadata and controls
57 lines (57 loc) · 2.1 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Ping Domains
on:
workflow_dispatch:
jobs:
ping_domains:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Ping domains
run: |
pip install tqdm
python - <<EOF
import subprocess
from tqdm import tqdm
def check_domain_activity(domain_list_file):
active_domains = []
inactive_domains = []
with open(domain_list_file, 'r') as f:
domains = f.readlines()
with tqdm(total=len(domains), desc="Pinging Domains") as pbar:
for domain in domains:
domain = domain.strip()
try:
subprocess.check_output(["ping", "-c", "1", domain])
active_domains.append(domain)
except subprocess.CalledProcessError:
inactive_domains.append(domain)
pbar.update(1)
return active_domains, inactive_domains
def export_to_file(filename, data):
with open(filename, 'w') as f:
for item in data:
f.write("%s\n" % item)
if __name__ == "__main__":
domain_list_file = "domainlist"
active, inactive = check_domain_activity(domain_list_file)
print("\nActive Domains:")
print("\n".join(active))
print("\nInactive Domains:")
print("\n".join(inactive))
export_to_file("domainlive", active)
print("\nActive domains exported to domainlive")
EOF
- name: Move to domainlist
run: |
mv domainlive domainlist
- name: Commit changes
run: |
git config --global user.email "gvoze32@yahoo.com"
git config --global user.name "zksbot"
git add domainlist
git commit -m "Ping domainlist"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.UPDATE_TOKEN }}