2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-28 21:27:54 +00:00
hacker-scripts/fucking_coffee.rb
Ryan S. Northrup cc6585c697 Slightly-more-accurate fucking_coffee.rb
Implemented a `delay` variable, and set it to 24 instead of 64 to better reflect the original story.
2015-11-23 09:57:25 -08:00

22 lines
471 B
Ruby
Executable File

#!/usr/bin/env ruby
# Skip on weekends
exit if Time.now.saturday? || Time.now.sunday?
# Exit early if no sessions with my_username are found
exit if `who`[/my_username/].nil?
require 'net/telnet'
coffee_machine_ip = '10.10.42.42'
password = '1234'
password_prompt = 'Password: '
delay = 24
con = Net::Telnet.new('Host' => coffee_machine_ip)
con.cmd('String' => password, 'Match' => /#{password_prompt}/)
con.cmd('sys brew')
sleep delay
con.cmd('sys pour')
con.close