From 30fde36fa9471a407d0e540e4b477aa4cd3a146a Mon Sep 17 00:00:00 2001 From: notacoder69 Date: Tue, 9 Oct 2018 00:20:38 +0530 Subject: [PATCH 1/4] Added the 17 second delay to the nodeJS implementation of fucking-coffee --- nodejs/fucking_coffee.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/nodejs/fucking_coffee.js b/nodejs/fucking_coffee.js index b30a6b4..7652568 100644 --- a/nodejs/fucking_coffee.js +++ b/nodejs/fucking_coffee.js @@ -19,22 +19,25 @@ exec("who", function(error, stdout, stderr) { var password = 'xxxx'; var con = new telnet(); + con.on('ready', function(prompt) { - con.exec('Password: ' + password, function(error, res) { + setTimeout(function(){ + con.exec('Password: ' + password, function(error, res) { - // Brew Coffee! - con.exec('sys brew', function(error, res) { + // Brew Coffee! + con.exec('sys brew', function(error, res) { - // Wait for 24s - setTimeout(function() { + // Wait for 24s + setTimeout(function() { - // Pour Coffee! - con.exec('sys pour', function(error, res) { - con.end(); - }); - }, 24000); + // Pour Coffee! + con.exec('sys pour', function(error, res) { + con.end(); + }); + }, 24000); + }); }); - }); + },17000); }); con.connect({host: coffee_machine_ip}); From 7ef1cda7593e3c2b414fdd25b33f04d17807393d Mon Sep 17 00:00:00 2001 From: notacoder69 Date: Tue, 9 Oct 2018 00:39:49 +0530 Subject: [PATCH 2/4] Fixed delays to the python implementation of fucking-coffee --- python/fucking_coffee.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/fucking_coffee.py b/python/fucking_coffee.py index c19572f..f553a4c 100755 --- a/python/fucking_coffee.py +++ b/python/fucking_coffee.py @@ -14,13 +14,14 @@ password = '1234' password_prompt = 'Password: ' +time.sleep(17) 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) +time.sleep(24) # love the smell! con.write("sys pour\n") From 313a70b0805e60b10594ed6afbc223bf1a1470fe Mon Sep 17 00:00:00 2001 From: notacoder69 Date: Tue, 9 Oct 2018 00:43:51 +0530 Subject: [PATCH 3/4] Fixed delays to the python3 implementation of fucking-coffee --- python3/fucking_coffee.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python3/fucking_coffee.py b/python3/fucking_coffee.py index 0268b79..80c65b9 100755 --- a/python3/fucking_coffee.py +++ b/python3/fucking_coffee.py @@ -17,14 +17,13 @@ def main(): 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) + time.sleep(24) conn.write('sys pour') conn.close() From 46fa0d8e77606a907d36f4a8a0c83ee58297b8f2 Mon Sep 17 00:00:00 2001 From: notacoder69 Date: Tue, 9 Oct 2018 10:45:41 +0530 Subject: [PATCH 4/4] Swift implementation of the hacker-scripts --- Swift/fucking-coffee.swift | 0 Swift/hangover.swift | 40 +++++++++++++++++++++++++++++++++++ Swift/kumar-asshole.swift | 0 Swift/smack-my-bitch-up.swift | 39 ++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 Swift/fucking-coffee.swift create mode 100644 Swift/hangover.swift create mode 100644 Swift/kumar-asshole.swift create mode 100644 Swift/smack-my-bitch-up.swift diff --git a/Swift/fucking-coffee.swift b/Swift/fucking-coffee.swift new file mode 100644 index 0000000..e69de29 diff --git a/Swift/hangover.swift b/Swift/hangover.swift new file mode 100644 index 0000000..67a096e --- /dev/null +++ b/Swift/hangover.swift @@ -0,0 +1,40 @@ +import Foundation + +let accountSID = "TWILLIO_ACCOUNT_SID" +let authToken = "TWILLIO_AUTH_TOKEN" + +let myNumber = "+XXX" +let bossNumber = "+XXX" + +func Smackmybitch(){ + let url = "https://api.twilio.com/2010-04-01/Accounts/\(accountSID)/Messages" + let parameters = ["From": "\(myNumber)", "To": "\(herNumber)", "Body": "\(message)"] + let auth = ["user": accountSID, "password": authToken] + + + var request = URLRequest(url: url) + request.setValue("Application/json", forHTTPHeaderField: "Content-Type") + request.httpMethod = "POST" + guard let httpBody = try? JSONSerialization.data(withJSONObject: parameters, options: []) else { + return + } + request.httpBody = httpBody + var authEncoded = "\(auth[user]!):\(auth[password]!)".dataUsingEncoding(NSASCIIStringEncoding, allowLossyConversion: true)!.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.allZeros); + var authValue = "Basic \(authEncoded)" + urlRequest.setValue(authValue, forHTTPHeaderField: "Authorization") + + let session = NSURLSession(configuration: config) + session.dataTaskWithRequest(request) { (data, response, error) -> Void in }.resume() +} + +let excuses = [ + "Locked out.", + "Pipes Broke.", + "Food Poisoning", + "Not feeling well" +] + +let random = Int(arc4random_uniform(2)) +let randomReason = reasons[random] +let message = "Gonna work from Home, \(randomReason)" +Smackmybitch() \ No newline at end of file diff --git a/Swift/kumar-asshole.swift b/Swift/kumar-asshole.swift new file mode 100644 index 0000000..e69de29 diff --git a/Swift/smack-my-bitch-up.swift b/Swift/smack-my-bitch-up.swift new file mode 100644 index 0000000..7df0609 --- /dev/null +++ b/Swift/smack-my-bitch-up.swift @@ -0,0 +1,39 @@ +import Foundation + +let accountSID = "TWILLIO_ACCOUNT_SID" +let authToken = "TWILLIO_AUTH_TOKEN" + +let myNumber = "+XXX" +let herNumber = "+XXX" + +func Smackmybitch(){ + let url = "https://api.twilio.com/2010-04-01/Accounts/\(accountSID)/Messages" + let parameters = ["From": "\(myNumber)", "To": "\(herNumber)", "Body": "\(message)"] + let auth = ["user": accountSID, "password": authToken] + + + var request = URLRequest(url: url) + request.setValue("Application/json", forHTTPHeaderField: "Content-Type") + request.httpMethod = "POST" + guard let httpBody = try? JSONSerialization.data(withJSONObject: parameters, options: []) else { + return + } + request.httpBody = httpBody + var authEncoded = "\(auth[user]!):\(auth[password]!)".dataUsingEncoding(NSASCIIStringEncoding, allowLossyConversion: true)!.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.allZeros); + var authValue = "Basic \(authEncoded)" + urlRequest.setValue(authValue, forHTTPHeaderField: "Authorization") + + let session = NSURLSession(configuration: config) + session.dataTaskWithRequest(request) { (data, response, error) -> Void in }.resume() +} + +let reasons = [ + "Working Hard", + "Gotta ship this feature", + "Somebody fucked the system again." +] + +let random = Int(arc4random_uniform(2)) +let randomReason = reasons[random] +let message = "Late at work. \(randomReason)" +Smackmybitch() \ No newline at end of file