Бля, что за пиздец

This commit is contained in:
2024-03-23 21:08:38 +03:00
11 changed files with 159 additions and 3 deletions

View File

@ -0,0 +1,50 @@
"""
https://stackoverflow.com/questions/41620369/how-to-get-ssl-certificate-details-using-python
"""
import socket
import ssl
import datetime
domains = [
'iiiypuk.me',
'a2s.su',
'ya.ru'
]
def ssl_expiry_datetime(hostname):
ssl_dateformat = r'%b %d %H:%M:%S %Y %Z'
context = ssl.create_default_context()
context.check_hostname = False
conn = context.wrap_socket(
socket.socket(socket.AF_INET),
server_hostname=hostname,
)
# 5 second timeout
conn.settimeout(5.0)
conn.connect((hostname, 443))
ssl_info = conn.getpeercert()
# Python datetime object
return datetime.datetime.strptime(ssl_info["notAfter"], ssl_dateformat)
if __name__ == "__main__":
for value in domains:
now = datetime.datetime.now()
try:
expire = ssl_expiry_datetime(value)
diff = expire - now
print(
"Domain name: {} Expiry Date: {} Expiry Day: {}".format(
value, expire.strftime("%Y-%m-%d"), diff.days
)
)
except Exception as e:
print(e)

9
code/SFML/appIcon.cpp Normal file
View File

@ -0,0 +1,9 @@
// ...
auto image = sf::Image{};
if (!image.loadFromFile("cat.png"))
{
// Error handling...
}
window.setIcon(image.getSize().x, image.getSize().y, image.getPixelsPtr());
// ...