2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-23 19:07:33 +00:00
hacker-scripts/python3/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

35 lines
672 B
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import telnetlib
import time
from hackerutils import sh
COFFEE_MACHINE_ADDR = '10.10.42.42'
COFFEE_MACHINE_PASS = '1234'
COFFEE_MACHINE_PROM = 'Password: '
def main():
# Exit early if no sessions with my_username are found.
if not any(s.startswith(b'my_username ') for s in sh('who').split(b'\n')):
return
time.sleep(17)
conn = telnetlib.Telnet(host=COFFEE_MACHINE_ADDR)
conn.open()
conn.expect([COFFEE_MACHINE_PROM])
conn.write(COFFEE_MACHINE_PASS)
conn.write('sys brew')
time.sleep(64)
conn.write('sys pour')
conn.close()
if __name__ == '__main__':
main()