예제 #1
0
func main() {

	flag.Usage = usage
	flag.Parse()

	switch flag.NArg() {
	case 1:
		url = flag.Arg(0)
	default:
		usage()
		return

	}

	fmt.Println("=== Running Gryffin ===")

	var w io.Writer
	// TCP port listening messages.
	tcpout, err := net.Dial("tcp", "localhost:5000")
	if err != nil {
		// fmt.Println("Cannot establish tcp connection to log listener.")
		w = os.Stdout
	} else {
		w = io.MultiWriter(os.Stdout, tcpout)
	}

	scan := gryffin.NewScan(*method, url, *body, data.NewMemoryStore(), w)
	scan.Logm("Main", "Started")

	linkChannels(scan)

	fmt.Println("=== End Running Gryffin ===")

}
예제 #2
0
func TestMain(t *testing.T) {
	if os.Getenv("INTEGRATION") == "" {
		t.Skip("Skip integration tests.")
	}
	scan := gryffin.NewScan("GET", ts.URL, "")
	linkChannels(scan)

}
예제 #3
0
func TestFuzzer(t *testing.T) {

	f := &Fuzzer{}
	scan := gryffin.NewScan("GET", "http://www.yahoo.com", "", nil, os.Stdout)
	_, err := f.Fuzz(scan)
	if err != nil {
		t.Error(err)
	}

}
예제 #4
0
func TestFuzzer(t *testing.T) {
	if os.Getenv("INTEGRATION") == "" {
		t.Skip("Skip integration tests.")
	}
	s := &Fuzzer{}
	scan := gryffin.NewScan("GET", "http://127.0.0.1:8081/xss/reflect/full1?in=change_me", "", nil, os.Stdout)
	c, err := s.Fuzz(scan)
	if err != nil {
		t.Error(err)
	}
	if c == 0 {
		t.Error("No issue detected.")
	}
}
예제 #5
0
func testCrawlAsync(t *testing.T, r gryffin.Renderer) {
	if os.Getenv("INTEGRATION") == "" {
		t.Skip("Skip integration tests.")
	}

	url := "https://www.yahoo.com/"

	s := gryffin.NewScan("GET", url, "", data.NewMemoryStore(), os.Stdout)
	r.Do(s)
	s = <-r.GetRequestBody()
	// t.Logf("Got async body %s", s)
	for link := range r.GetLinks() {
		t.Logf("Got link %s", link.Request.URL)
	}
}
예제 #6
0
func TestFuzzer(t *testing.T) {
	if os.Getenv("INTEGRATION") == "" {
		t.Skip("Skip integration tests.")
	}

	s := &Fuzzer{}
	scan := gryffin.NewScan("GET", "http://127.0.0.1:8082/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit", "")
	c, err := s.Fuzz(scan)
	if err != nil {
		t.Error(err)
	}
	if c == 0 {
		t.Error("No issue detected.")
	}

}
예제 #7
0
func main() {

	flag.Usage = usage
	flag.Parse()

	switch flag.NArg() {
	case 1:
		// gryffin-distributed crawl
		service = flag.Arg(0)
	case 2:
		// gryffin-distributed seed "http://..."
		service = flag.Arg(0)
		if service == "seed" {
			url = flag.Arg(1)
		} else {
			usage()
			return
		}
	default:
		usage()
		return
	}

	// TCP port listening messages.
	tcpout, err := net.Dial("tcp", "localhost:5000")
	if err != nil {
		// fmt.Println("Cannot establish tcp connection to log listener.")
		logWriter = os.Stdout
	} else {
		logWriter = io.MultiWriter(os.Stdout, tcpout)
	}

	// we use a buffered channel to block when max concurrency is reach.
	maxconcurrency := 5
	wq = make(chan bool, maxconcurrency)

	t = gryffin.NewScan("GET", url, "", data.NewMemoryStore(), logWriter)

	// seed is unique case that we exit the program immediately
	if service == "seed" {
		seed(url)
		return
	}

	captureCtrlC()

	switch service {

	case "crawl":
		crawl()

	case "fuzz-sqlmap":
		fuzzWithSqlmap()
	case "fuzz-arachni":
		fuzzWithArachni()

	default:
		fmt.Println("Unrecognizated service:", service)
		usage()
	}

}