2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-23 10:57:13 +00:00
hacker-scripts/fucking_coffee.rb

21 lines
459 B
Ruby
Raw Permalink Normal View History

2015-11-21 23:04:28 +04:00
#!/usr/bin/env ruby
2015-11-24 03:46:12 +04:00
# Exit early if no sessions with my username are found
exit unless `who -q`.include? ENV['USER']
2015-11-21 23:04:28 +04:00
require 'net/telnet'
coffee_machine_ip = '10.10.42.42'
password = '1234'
password_prompt = 'Password: '
delay_before_brew = 17
delay = 24
2015-11-21 23:04:28 +04:00
sleep delay_before_brew
2015-11-21 23:04:28 +04:00
con = Net::Telnet.new('Host' => coffee_machine_ip)
con.cmd('String' => password, 'Match' => /#{password_prompt}/)
con.cmd('sys brew')
sleep delay
2015-11-21 23:04:28 +04:00
con.cmd('sys pour')
con.close