Created
November 20, 2022 20:21
-
-
Save misterhay/7c79a13019f5ad0f895040e689150522 to your computer and use it in GitHub Desktop.
Logging IP address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
from datetime import datetime | |
import requests | |
ip = socket.gethostbyname_ex(socket.gethostname())[-1] | |
ethercalc_id = 'iplog' | |
base_url = 'https://ethercalc.net/' | |
post_url = base_url+'_/'+ethercalc_id | |
date_and_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") | |
r = requests.post(post_url, data = date_and_time +','+ str(ip)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment