在Go中复制Python的Fuzzer

huangapple go评论90阅读模式
英文:

Fuzzer in go replicating Python one

问题

我正在为这个教程重新创建一个模糊测试器(实际的模糊测试器在链接中,用Python编写)。我的问题更多是关于正确的做事方式,代码中的增量数字越来越慢。有人知道是否有一个接口/库可以做到这一点?或者在Go中是否有任何功能可以更好地完成这个任务?

package main

import (
	"fmt"
	"net"
	"strings"
)

const payload = "\x41"

func main() {
	//Banner
	fmt.Printf("\nLauching Fuzzer..\n")
	payL := strings.Repeat(payload, 50)

	for {
		payL += strings.Repeat(payload, 50)
		conn, err := net.Dial("tcp", "localhost:21")
		if err != nil {
			fmt.Println("Crash Error: ", err)
		}
		final_payload := fmt.Sprint("User " + payL + "\r\n")
		_, err = conn.Write([]byte(final_payload))
		if err != nil {
			fmt.Println("Error: ", err)
			break
		} else {
			fmt.Println("Sending buffer with length: ", final_payload)
			conn.Close()
		}

	}
}

教程链接

英文:

I'm recreating a fuzzer(the actual fuzzer is on the link and it's written in python) for this tutorial:

Link for the tutorial

> well actually the objective is to do all of the code but using Go.

**My question is more in terms of a correct way to do things the process to reach big incremental numbers in the code are getting slower and slower. Anyone have any ideia if there of a interface/lib that does this. Or any functionality that i´m forgeting in Go that could be use to do it better.:

package main

import (
	"fmt"
	"net"
	"strings"
)

const payload = "\x41"

func main() {
	//Banner
	fmt.Printf("\nLauching Fuzzer..\n")
	payL := strings.Repeat(payload, 50)

	for {
		payL += strings.Repeat(payload, 50)
		conn, err := net.Dial("tcp", "localhost:21")
		if err != nil {
			fmt.Println("Crash Error: ", err)
		}
		final_payload := fmt.Sprint("User " + payL + "\r\n")
		_, err = conn.Write([]byte(final_payload))
		if err != nil {
			fmt.Println("Error: ", err)
			break
		} else {
			fmt.Println("Sending buffer with length: ", final_payload)
			conn.Close()
		}

	}

答案1

得分: 3

package fuzz

> 导入 "github.com/google/gofuzz" 包

>

> fuzz 包是一个用于为 Go 对象填充随机值的库。

关于一个高效的 Go 模糊器的示例,请参阅 Go 包 fuzz。

英文:

> package fuzz
>
> import "github.com/google/gofuzz"
>
> Package fuzz is a library for populating go objects with random
> values.

For an example of an efficient Go fuzzer, see the Go package fuzz.

huangapple
  • 本文由 发表于 2016年2月17日 06:19:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/35444119.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定