diff options
author | Padeso <padeso@duck.com> | 2024-11-27 14:29:09 +0000 |
---|---|---|
committer | Padeso <padeso@duck.com> | 2024-11-27 14:29:09 +0000 |
commit | 33bdbd42b5ba85144a3e702e2bf74bdb5e70c9c1 (patch) | |
tree | 89094e55abfc337ff550da69b5cd547a1bfa7550 /non-empty-sites.sh | |
parent | b672d10b67204ddd9271f4cb8582dae57d14032e (diff) | |
download | non-empty-sites-33bdbd42b5ba85144a3e702e2bf74bdb5e70c9c1.tar.gz |
Tweaks
Diffstat (limited to 'non-empty-sites.sh')
-rwxr-xr-x | non-empty-sites.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/non-empty-sites.sh b/non-empty-sites.sh new file mode 100755 index 0000000..87647ac --- /dev/null +++ b/non-empty-sites.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import array +import sys +import os +from datetime import datetime + +sites_file = "./sites" +mtime = datetime.fromtimestamp(os.path.getmtime(sites_file)).strftime("%Y-%m-%d %H:%M") + +sites_list = ['<ul class="sites">'] +with open(sites_file) as file: + for line in file: + l = line.rstrip() + sites_list.append("<li><a href='https://% s.tilde.institute/'>%s</a></li>" % (l, l)) +sites_list.append("</ul>") + +payload = ("<!doctype html>" + '<html lang="en">' + "<head>" + "<meta charset=\"utf-8\">" + "<title>Non-Empty Sites</title>" + "<link href='non-empty-sites.css' rel='stylesheet' type='text/css'" + "</head>" + "<body>" + "<h1>Apparently non-empty sites at tilde.institute</h1>" + '<p>As of {}, the following <b>tilde.institute</b> users had at least one file in their <i>public_html</i> folder, so you might find some sort of web site there.</p>' + "{}" + "<p>I put this together to learn something about writing shell and CGI scripts on tilde.institue. <a href='https://git.tilde.institute/padeso/non-empty-sites/'>[source]</a></p>" + "</body>" + "</html>").format(mtime, "".join(sites_list)) +print(payload) |