2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-23 02:47:14 +00:00
hacker-scripts/python/fucking_coffee.py
Julio Ordonez Viales b9c6dad2c5 Update cron job to be executed on weekdays only
Updated the cron job so that it only executes the scripts on weekdays, that way there is not need to check for this condition inside the scripts, updated the scripts as well
2015-11-26 19:26:15 -06:00

28 lines
523 B
Python
Executable File

#!/usr/bin/env python
import sys
import subprocess
import telnetlib
import time
# exit if no sessions with my username are found
output = subprocess.check_output('who')
if 'my_username' not in output:
sys.exit()
coffee_machine_ip = '10.10.42.42'
password = '1234'
password_prompt = 'Password: '
con = telnetlib.Telnet(coffee_machine_ip)
con.read_until(password_prompt)
con.write(password + "\n")
# Make some coffee!
con.write("sys brew\n")
time.sleep(64)
# love the smell!
con.write("sys pour\n")
con.close()