Advertisement
Dijit

logspam.go

Oct 2nd, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.99 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.         "log"
  5.         "net"
  6.         "time"
  7. )
  8.  
  9. func Connect() (connection net.Conn, _ error) {
  10.         connection, _ = net.Dial("tcp", "localhost:3333")
  11.  
  12.         log.Print("Connected to: ", connection.RemoteAddr())
  13.  
  14.         return
  15. }
  16.  
  17. func main() {
  18.         log.Print("Json Spammer")
  19.  
  20.         jsonsocket, _ := Connect()
  21.         defer jsonsocket.Close()
  22.  
  23.         for {
  24.                 t := time.Now()
  25.                 var json = []byte(`{"save_at_master":true,"logger_name":"logspammer.Host","process_guid":"31F34CE2-7BD9-4FE7-B5799726C1B52C7C","exe":"logspam.go","pid":"27660","tag":"spamserver.on_close.01","file":"logspam.go","line":"0","@timestamp":"`)
  26.                 json = append(json, []byte(t.Format(time.RFC3339))...)
  27.                 json = append(json, []byte(`","log_line":{"msg":"I'm Spamming","remote_host":"[::ffff:10.355.13.11]:41717"}}
  28. `)...)
  29.                 //log.Print("Sending: ", json)
  30.  
  31.                 jsonsocket.Write(json)
  32.         }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement