Beispiel #1
0
func main() {
	lsplog.SetVerbose(3)
	lsplog.Vlogf(3, "[Request] Request has started")
	lsplog.Vlogf(3, "[Request] Args: %s", os.Args)
	hostport := os.Args[1]
	var e error
	client, e = lsp12.NewLspClient(hostport, &lsp12.LspParams{5, 2000})
	if e != nil {
		lsplog.Vlogf(3, "[Worker] Connection to server failed.")
	}
	joinRequest := "J"
	lsplog.Vlogf(3, "[worker] Sending: %s", joinRequest)
	client.Write([]byte(joinRequest))
	for {
		response, err := client.Read()
		if err != nil {
			return
		}

		lsplog.Vlogf(3, "[Worker] Recieved: %s", string(response))
		responseParts := strings.Split(string(response), " ")
		if len(responseParts) == 4 {
			hash := responseParts[1]
			lsplog.Vlogf(3, "[Worker] Hash: %s", hash)
			lower, _ := strconv.Atoi(responseParts[2])
			upper, _ := strconv.Atoi(responseParts[3])
			go getPassword(hash, lower, upper)
		} else {
			suspended = true
		}
	}
}
Beispiel #2
0
func main() {
	lsplog.SetVerbose(3)
	lsplog.Vlogf(3, "[Request] Request has started")
	lsplog.Vlogf(3, "[Request] Args: %s", os.Args)
	if len(os.Args) != 4 {
		lsplog.Vlogf(3, "[Request] Please give arguments \"host:port hash len\"")
		return
	}

	hostport := os.Args[1]
	hash := os.Args[2]
	length, _ := strconv.Atoi(os.Args[3])
	lower := "0"
	upper := strings.Repeat("9", length)
	client, e := lsp12.NewLspClient(hostport, &lsp12.LspParams{5, 2000})
	if e != nil {
		lsplog.Vlogf(3, "[Request] Connection to server failed.")
	}
	crackRequest := fmt.Sprintf("C %s %s %s", hash, lower, upper)
	lsplog.Vlogf(3, "[Request] Sending: %s", crackRequest)
	client.Write([]byte(crackRequest))
	response, err := client.Read()
	lsplog.Vlogf(3, string(response))
	if err != nil {
		lsplog.Vlogf(3, "Disconnected")
		return
	}
	responseString := string(response)

	if responseString == "X" {
		lsplog.Vlogf(3, "Not Found")
		return
	} else {
		response := strings.Split(responseString, " ")
		lsplog.Vlogf(3, "Found: %s", response[1])
	}
}