2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-22 18:37:10 +00:00

go fmt on smack_my_bitch_up.go

This commit is contained in:
PenguWin 2016-10-08 18:16:55 +02:00
parent 01e916f59c
commit e06146e10a

View File

@ -1,39 +1,38 @@
package main package main
import( import (
"os/exec" "fmt"
"fmt" "math/rand"
"strings" "os"
"os" "os/exec"
"math/rand" "strings"
"time" "time"
) )
func main(){ func main() {
output1,err := exec.Command("who").Output() output1, err := exec.Command("who").Output()
output2 := os.Getenv("USER") output2 := os.Getenv("USER")
users := string(output1[:]) users := string(output1[:])
current_user := string(output2[:]) current_user := string(output2[:])
if(!strings.Contains(users,current_user)){ if !strings.Contains(users, current_user) {
return return
} }
reasons := []string{"Working hard", "Gotta ship this feature", "Someone fucked the system again"}
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))]
rand.Seed(time.Now().UTC().UnixNano()) TWILIO_ACCOUNT_SID := string(os.Getenv("TWILIO_ACCOUNT_SID"))
message := "Late at work. " + reasons[rand.Intn(len(reasons))] TWILIO_AUTH_TOKEN := string(os.Getenv("TWILIO_AUTH_TOKEN"))
MY_NUMBER := string(os.Getenv("MY_NUMBER"))
HER_NUMBER := string(os.Getenv("HER_NUMBER"))
TWILIO_ACCOUNT_SID := string(os.Getenv("TWILIO_ACCOUNT_SID")) 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()
TWILIO_AUTH_TOKEN := string(os.Getenv("TWILIO_AUTH_TOKEN")) if err != nil {
MY_NUMBER := string(os.Getenv("MY_NUMBER")) fmt.Printf("Failed to send SMS: %s", err)
HER_NUMBER := string(os.Getenv("HER_NUMBER")) return
}
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() fmt.Printf("Message Sent Successfully with response: %s ", response)
if(err != nil){
fmt.Printf("Failed to send SMS: %s",err)
return
}
fmt.Printf("Message Sent Successfully with response: %s ",response)
} }