Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
d4eccca
use with to open and close a file
Nov 26, 2015
8c00bba
write log to stdout
Nov 26, 2015
47e8900
Merge pull request #41 from WKPlus/master
NARKOZ Nov 26, 2015
4688d52
Ported fucking_coffee to PHP. I'm not porting anymore.
Nov 26, 2015
44d5c57
Add powershell script smack_my_bitch_up.ps1
chenghuang-mdsol Nov 26, 2015
61f7950
Merge pull request #46 from chenghuang-mdsol/master
NARKOZ Nov 26, 2015
61dbe67
Merge pull request #44 from dialtoneuk/master
NARKOZ Nov 26, 2015
e6bb45f
Update README.md
Nov 26, 2015
b9c6dad
Update cron job to be executed on weekdays only
JulioOrdonezV Nov 27, 2015
95a25f2
fucking coffee using coffeescript
waksana Nov 27, 2015
5606672
Update smack_my_bitch_up.rb
Nov 27, 2015
d42fb57
Merge pull request #45 from JulioOrdonezV/JulioOrdonezV-patch-1
NARKOZ Nov 27, 2015
4b10764
Merge pull request #47 from Goldenson/patch-1
NARKOZ Nov 27, 2015
0bbaae7
Merge pull request #49 from waksana/master
NARKOZ Nov 27, 2015
1366360
Merge pull request #50 from Goldenson/patch-2
NARKOZ Nov 27, 2015
3bcd684
Add perl/smack-my-bitch-up.pl
robaganrab Nov 27, 2015
4e17743
Add perl/hangover.pl
robaganrab Nov 27, 2015
c7bce55
Add perl/fucking-coffee.pl
robaganrab Nov 27, 2015
3c4205c
Add perl/kumar-asshole.pl
robaganrab Nov 27, 2015
a1716b8
fix ruby script
NARKOZ Nov 27, 2015
ac6edc5
The coffee machines uses telnet not SSH
Nov 25, 2015
8853685
Merge pull request #52 from robaganrab/perl-implementation
NARKOZ Nov 27, 2015
4334409
fixed issue with gmail, kumars_email variable scope
bitsapien Nov 28, 2015
46dcd9e
Merge pull request #58 from bitsapien/kumar_asshole_script_constants_…
NARKOZ Nov 28, 2015
213ee55
Error on line 33
Nov 29, 2015
98cb989
Update kumar-asshole.pl
zenlaboratory Nov 29, 2015
667627d
Merge pull request #63 from chowraid/master
NARKOZ Nov 29, 2015
f46cd2d
Merge pull request #64 from zenlaboratory/patch-1
NARKOZ Nov 29, 2015
480bb62
R version: smack_my_bitch_up.R
samzer Nov 29, 2015
a60ed71
Proper check if user is logged in
alexesprit Nov 29, 2015
ab3d661
Fix sms sending
alexesprit Nov 29, 2015
fedb6fa
Get random reason easier
alexesprit Nov 29, 2015
fe4b87d
Merge pull request #67 from samzer/master
NARKOZ Nov 29, 2015
eb7f1d8
Merge pull request #68 from alexesprit/powershell
NARKOZ Nov 29, 2015
793c49a
keep things simple
Nov 30, 2015
752e1c2
lib added to composer
Nov 30, 2015
8788a76
no need to check date. handeled by cronjob
Nov 30, 2015
5625956
oops! newline end of file.
Nov 30, 2015
7e9149e
Ported hangover script to golang
arjunnambiartc Nov 30, 2015
7ff2fc8
Removed parenthesis
lipis Nov 30, 2015
c0096a1
Merge pull request #75 from lipis/patch-1
NARKOZ Nov 30, 2015
a72a622
Merge pull request #71 from Stunt/master
NARKOZ Nov 30, 2015
3288f96
Merge pull request #77 from arjunnambiartc/master
NARKOZ Nov 30, 2015
7c5686a
golang smacked my bitch up
tillenium Nov 30, 2015
617122a
Merge pull request #79 from xer0k00l/smacked_my_bitch_added_to_go
NARKOZ Nov 30, 2015
cb105c8
removed .mess bug of smack_my_bitch_up
tillenium Dec 1, 2015
66de802
require phpdotenv
zhiephie Dec 1, 2015
c989c42
load phpenv
zhiephie Dec 1, 2015
7dfbc71
Merge pull request #81 from xer0k00l/removed_bug_of_smack_my_bitch_up
NARKOZ Dec 1, 2015
17a16a7
Merge pull request #82 from zhiephie/patch-1
NARKOZ Dec 1, 2015
3ba1206
NodeJS Implementation
Dec 1, 2015
4518052
Merge pull request #86 from kashyapakshay/master
NARKOZ Dec 2, 2015
7c9a8e9
NodeJS for hangover and smack_my_bitch_up
Dec 2, 2015
d006970
Merge pull request #88 from kashyapakshay/master
NARKOZ Dec 2, 2015
8d18571
Added powershell files
Dec 2, 2015
7bf95ed
NodeJS for kumar_asshole
Dec 2, 2015
ded4526
Merge pull request #89 from RandomlyKnighted/powershell
NARKOZ Dec 2, 2015
a65bf49
Merge pull request #90 from kashyapakshay/master
NARKOZ Dec 2, 2015
ef18224
NodeJS for fucking_coffee to trigger using Yo.
kashyapakshay Dec 2, 2015
6ec31b4
no need to load .env file for this script
Dec 3, 2015
bedd801
Merge pull request #94 from Stunt/master
NARKOZ Dec 3, 2015
d956aa1
Merge pull request #93 from kashyapakshay/master
NARKOZ Dec 3, 2015
1d54a8e
add hangover php port
Dec 4, 2015
5422e24
Merge pull request #96 from Stunt/master
NARKOZ Dec 4, 2015
7f9d6b1
Indentation fix
topless Dec 4, 2015
a78bc2d
Added java directory + fucking_coffee.java
farnasirim Dec 4, 2015
2c40ffd
Merge pull request #101 from topless/patch-1
NARKOZ Dec 5, 2015
c300bc5
Merge pull request #103 from colonelmo/master
NARKOZ Dec 5, 2015
7d11758
Implement Scala version of the fucking-coffee script using Ammonite s…
amirkarimi Dec 7, 2015
7669e87
Added a groovy version of fucking_coffee
Dec 7, 2015
895b922
Run script from bash
amirkarimi Dec 7, 2015
5e63de9
Merge pull request #107 from geoand/groovy
NARKOZ Dec 7, 2015
30ca9dc
Merge pull request #105 from AmirKarimi/master
NARKOZ Dec 7, 2015
48f2da4
Update smack_my_bitch_up.go
yoannduc Dec 8, 2015
cf679b5
Merge pull request #109 from yoannduc/patch-1
NARKOZ Dec 8, 2015
01f3571
fix never detecting no password prompt
Dec 9, 2015
546df67
Merge pull request #110 from DonkeyCore/patch-1
NARKOZ Dec 9, 2015
d33d1f5
Created "smack_my_bitch_up" in php
sugar Dec 10, 2015
c92451e
Merge pull request #113 from receive/master
NARKOZ Dec 10, 2015
3eeb95f
Update kumar_asshole.py
lgmoneda Dec 29, 2015
533b8b4
Merge pull request #119 from lgmoneda/patch-1
NARKOZ Dec 30, 2015
66d694c
added hangout.R, improved smack-my-bitch-up.R
matthew-z Jan 21, 2016
7b541bb
Merge pull request #121 from matthew-z/master
NARKOZ Jan 22, 2016
0937bac
Added Kumar_Asshole.java
syedautherabbas Jan 27, 2016
73e27a8
Added SmackMyBitch.java
ausshadu Jan 27, 2016
1c53ad6
Added Hangover.java
ausshadu Jan 27, 2016
61b8619
Merge pull request #124 from syedautherabbas/master
NARKOZ Jan 27, 2016
f8478c4
Merge pull request #125 from ausshadu/master
NARKOZ Jan 27, 2016
08c6099
Changed naming conventions to be in line with java. Added dependency
syedautherabbas Jan 27, 2016
3b29406
Merge pull request #127 from syedautherabbas/master
NARKOZ Feb 29, 2016
01e916f
rm extra files
NARKOZ Feb 29, 2016
7a82ced
Update fucking_coffee.psm1
ww40 Mar 31, 2016
0347b0c
Added Hangover.cs and implementation
destromas1 Jan 31, 2016
e06146e
go fmt on smack_my_bitch_up.go
penguwin Oct 8, 2016
bc5f24a
Merge pull request #130 from destromas1/master
NARKOZ May 5, 2017
bba94d8
Merge pull request #138 from penguwin/master
NARKOZ May 5, 2017
64f2d1b
Merge pull request #132 from ww40/patch-1
NARKOZ May 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions CSharp/Hangover.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace Hacker_Scripts
{
using System;
using Twilio;
using System.Linq;

class Hangover
{
public static string TWILIO_ACCOUNT_SID = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
public static string AUTH_TOKEN = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

public static string YOUR_NUMBER = "9879789978";
public static string BOSS_NUMBER = "3213213233";

static void Main(string[] args)
{
var twilio = new TwilioRestClient(TWILIO_ACCOUNT_SID, AUTH_TOKEN);

string[] randomMessages = {
"Locked out",
"Pipes broke",
"Food poisoning",
"Not feeling well"
};

int randomIndex = new Random().Next(randomMessages.Count());
String messageToSend = (randomMessages[randomIndex]);

var message = twilio.SendMessage(YOUR_NUMBER, BOSS_NUMBER, messageToSend);
Console.WriteLine(message.Sid);
}
}
}

35 changes: 35 additions & 0 deletions CSharp/SmackMyBitch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Twilio;

namespace Hacker_Scripts
{
class SmackMyBitch
{
public static string TWILIO_ACCOUNT_SID = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
public static string AUTH_TOKEN = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

public static string YOUR_NUMBER = "9879789978";
public static string HER_NUMBER = "3213213233";

static void Main(string[] args)
{
var twilio = new TwilioRestClient(TWILIO_ACCOUNT_SID, AUTH_TOKEN);

string[] randomMessages = {
"Working hard",
"Gotta ship this feature",
"Someone fucked the system again"
};

int randomIndex = new Random().Next(randomMessages.Count());
String messageToSend = (randomMessages[randomIndex]);

var message = twilio.SendMessage(YOUR_NUMBER, HER_NUMBER, messageToSend);
Console.WriteLine(message.Sid);
}
}
}
35 changes: 35 additions & 0 deletions R/hangover.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
library(httr)

today = Sys.Date()

# skip weekends
if( weekdays(today) %in% c('Saturday','Sunday') ){
quit()
}

# exit if no sessions with my username are found
output = system("who", intern = TRUE)
if( !( grep('^my_user_name', output) ) ){
quit()
}

# returns 'None' if the key doesn't exist
TWILIO_ACCOUNT_SID = Sys.getenv('TWILIO_ACCOUNT_SID')
TWILIO_AUTH_TOKEN = Sys.getenv('TWILIO_AUTH_TOKEN')

# Phone numbers
my_number = '+xxx'
number_of_boss= '+xxx'

excuse = c(
'Locked out',
'Pipes broke',
'Food poisoning',
'Not feeling well'
)

POST(paste("https://api.twilio.com/2010-04-01/Accounts/",TWILIO_ACCOUNT_SID,"/Messages.json",sep=""),
body = list(From=my_number,To=number_of_boss,Body=paste("Gonna work from home. ", sample(excuse,1))),
authenticate(TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN) )

print( paste("Message sent at",Sys.time()) )
34 changes: 34 additions & 0 deletions R/smack_my_bitch_up.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
library(httr)

today = Sys.Date()

# skip weekends
if( weekdays(today) %in% c('Saturday','Sunday') ){
quit()
}

# exit if no sessions with my username are found
output = system("who", intern = TRUE)
if( !( grep('^my_user_name', output) ) ){
quit()
}

# returns 'None' if the key doesn't exist
TWILIO_ACCOUNT_SID = Sys.getenv('TWILIO_ACCOUNT_SID')
TWILIO_AUTH_TOKEN = Sys.getenv('TWILIO_AUTH_TOKEN')

# Phone numbers
my_number = '+xxx'
her_number = '+xxx'

reasons = c(
'Working hard',
'Gotta ship this feature',
'Someone fucked the system again'
)

POST(paste("https://api.twilio.com/2010-04-01/Accounts/",TWILIO_ACCOUNT_SID,"/Messages.json",sep=""),
body = list(From=my_number,To=her_number,Body=paste("Late at work. ", sample(reasons,1))),
authenticate(TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN) )

print( paste("Message sent at",Sys.time()) )
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ story](https://www.jitbit.com/alexblog/249-now-thats-what-i-call-a-hacker/)_:

> xxx: [`hangover.sh`](https://github.com/NARKOZ/hacker-scripts/blob/master/hangover.sh) - another cron-job that is set to specific dates. Sends automated emails like "not feeling well/gonna work from home" etc. Adds a random "reason" from another predefined array of strings. Fires if there are no interactive sessions on the server at 8:45am.

> xxx: (and the oscar goes to) [`fucking-coffee.sh`](https://github.com/NARKOZ/hacker-scripts/blob/master/fucking-coffee.sh) - this one waits exactly 17 seconds (!), then opens an SSH session to our coffee-machine (we had no frikin idea the coffee machine is on the network, runs linux and has SSHD up and running) and sends some weird gibberish to it. Looks binary. Turns out this thing starts brewing a mid-sized half-caf latte and waits another 24 (!) seconds before pouring it into a cup. The timing is exactly how long it takes to walk to the machine from the dudes desk.
> xxx: (and the oscar goes to) [`fucking-coffee.sh`](https://github.com/NARKOZ/hacker-scripts/blob/master/fucking-coffee.sh) - this one waits exactly 17 seconds (!), then opens a telnet session to our coffee-machine (we had no frikin idea the coffee machine is on the network, runs linux and has a TCP socket up and running) and sends something like `sys brew`. Turns out this thing starts brewing a mid-sized half-caf latte and waits another 24 (!) seconds before pouring it into a cup. The timing is exactly how long it takes to walk to the machine from the dudes desk.

> xxx: holy sh*t I'm keeping those

Expand All @@ -37,22 +37,22 @@ GMAIL_PASSWORD=password
```

For Ruby scripts you need to install gems:
`gem install dotenv twilio gmail`
`gem install dotenv twilio-ruby gmail`

## Cron jobs

```sh
# Runs `smack-my-bitch-up.sh` daily at 9:20 pm.
20 21 * * * /path/to/scripts/smack-my-bitch-up.sh >> /path/to/smack-my-bitch-up.log 2>&1
# Runs `smack-my-bitch-up.sh` monday to friday at 9:20 pm.
20 21 * * 1-5 /path/to/scripts/smack-my-bitch-up.sh >> /path/to/smack-my-bitch-up.log 2>&1

# Runs `hangover.sh` daily at 8:45 am.
45 8 * * * /path/to/scripts/hangover.sh >> /path/to/hangover.log 2>&1
# Runs `hangover.sh` monday to friday at 8:45 am.
45 8 * * 1-5 /path/to/scripts/hangover.sh >> /path/to/hangover.log 2>&1

# Runs `kumar-asshole.sh` every 10 minutes.
*/10 * * * * /path/to/scripts/kumar-asshole.sh

# Runs `fucking-coffee.sh` hourly from 9am to 6pm.
0 9-18 * * * /path/to/scripts/fucking-coffee.sh
# Runs `fucking-coffee.sh` hourly from 9am to 6pm on weekdays.
0 9-18 * * 1-5 /path/to/scripts/fucking-coffee.sh
```

---
Expand Down
28 changes: 28 additions & 0 deletions coffee/fucking.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env coffee

username = 'name'

host = 'localhost'
port = '3000'
pass = '5555'

sh = require('child_process').execSync

# weekend
process.exit 0 if new Date().getDay() in [6, 0]

# no sessions
process.exit 0 unless new RegExp(username).test sh('who -q').toString()

conn = require('net').createConnection port, host

setTimeout ->
conn.write "#{pass}\nsys brew\n"
setTimeout ->
conn.end 'sys pour'
process.exit 0
, 2 * 1000
, 1 * 1000

# alert
sh 'say come here and take your fucking coffee'
3 changes: 0 additions & 3 deletions fucking_coffee.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/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 unless `who -q`.include? ENV['USER']

Expand Down
47 changes: 47 additions & 0 deletions go/hangover.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package main

import (
"fmt"
"log"
"math/rand"
"os"

"github.com/codeskyblue/go-sh"
"github.com/subosito/twilio"
)

const my_number string = "+xxxxx"
const boss_number string = "+yyyyy"

func main() {
//exit if sessions with my username are found
_, err := sh.Command("who").Command("grep", "my_username").Output()
if err != nil {
os.Exit(1)
}

//Grab Twilio ID and token from environment variables
Account_Sid := os.Getenv("TWILIO_ACCOUNT_SID")
Auth_Token := os.Getenv("TWILIO_AUTH_TOKEN")

//create the reasons slice and append reasons to it
reasons := make([]string, 0)
reasons = append(reasons,
"Locked out",
"Pipes broke",
"Food poisoning",
"Not feeling well")

// Initialize Twilio client and send message
client := twilio.NewClient(Account_Sid, Auth_Token, nil)
message := fmt.Sprint("Gonna work from home...", reasons[rand.Intn(len(reasons))])

params := twilio.MessageParams{
Body: message,
}
s, resp, err := client.Messages.Send(my_number, boss_number, params)

if err == nil {
log.Fatal(s, resp, err)
}
}
38 changes: 38 additions & 0 deletions go/smack_my_bitch_up.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package main

import (
"fmt"
"math/rand"
"os"
"os/exec"
"strings"
"time"
)

func main() {
output1, err := exec.Command("who").Output()
output2 := os.Getenv("USER")
users := string(output1[:])
current_user := string(output2[:])
if !strings.Contains(users, current_user) {
return
}

reasons := []string{"Working hard", "Gotta ship this feature", "Someone fucked the system again"}

rand.Seed(time.Now().UTC().UnixNano())
message := "Late at work. " + reasons[rand.Intn(len(reasons))]

TWILIO_ACCOUNT_SID := string(os.Getenv("TWILIO_ACCOUNT_SID"))
TWILIO_AUTH_TOKEN := string(os.Getenv("TWILIO_AUTH_TOKEN"))
MY_NUMBER := string(os.Getenv("MY_NUMBER"))
HER_NUMBER := string(os.Getenv("HER_NUMBER"))

response, err := exec.Command("curl", "-fSs", "-u", TWILIO_ACCOUNT_SID+":"+TWILIO_AUTH_TOKEN, "-d", "From="+MY_NUMBER, "-d", "To="+HER_NUMBER, "-d", "Body="+message, "https://api.twilio.com/2010-04-01/Accounts/"+TWILIO_ACCOUNT_SID+"/Messages").Output()
if err != nil {
fmt.Printf("Failed to send SMS: %s", err)
return
}

fmt.Printf("Message Sent Successfully with response: %s ", response)
}
26 changes: 26 additions & 0 deletions groovy/fucking_coffee.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@Grab(group='org.hidetake', module='groovy-ssh', version='1.1.8')
@GrabExclude('org.codehaus.groovy:groovy-all')
import org.hidetake.groovy.ssh.Ssh

final def ssh = Ssh.newService()

final def HOST = '10.10.42.42'
final def USER = 'my_username'
final def PASSWORD = '1234'
final def DELAY = 24

ssh.remotes {
webServer {
host = HOST
user = USER
password = PASSWORD
}
}

ssh.run {
session(ssh.remotes.webServer) {
execute 'sys brew'
execute "sleep ${DELAY}s"
execute 'sys pour'
}
}
3 changes: 0 additions & 3 deletions hangover.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env ruby

# Skip on weekends
exit if Time.now.saturday? || Time.now.sunday?

# Exit early if sessions with my username are found
exit if `who -q`.include? ENV['USER']

Expand Down
7 changes: 0 additions & 7 deletions hangover.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#!/bin/sh -e

DAYOFWEEK=$(date +%u)

# Skip on weekends
if [ "$DAYOFWEEK" -eq 6 ] || [ "$DAYOFWEEK" -eq 7 ]; then
exit
fi

# Exit early if any session with my username is found
if who | grep -wq $USER; then
exit
Expand Down
34 changes: 34 additions & 0 deletions java/FuckingCoffee.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import java.net.*;
import java.io.*;

public class FuckingCoffee{

private static final String MY_USERNAME = "my_username";
private static final String PASSWORD_PROMPT = "Password: ";
private static final String PASSWORD = "1234";
private static final String COFFEE_MACHINE_IP = "10.10.42.42";
private static int DELAY_BEFORE_BREW = 17;
private static int DELAY = 24;

public static void main(String[] args)throws Exception{
for(int i = 1; i< args.length ; i++){
if(!args[i].contains(MY_USERNAME)){
return;
}
}
Socket telnet = new Socket(COFFEE_MACHINE_IP, 23);
PrintWriter out = new PrintWriter(telnet.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(telnet.getInputStream()));
Thread.sleep(DELAY_BEFORE_BREW*1000);
if(!in.readLine().equals(PASSWORD_PROMPT)){
return ;
}
out.println(PASSWORD);
out.println("sys brew");
Thread.sleep(DELAY*1000);
out.println("sys pour");
out.close();
in.close();
telnet.close();
}
}
Loading