コード例 #1
0
ファイル: main.go プロジェクト: binarydreams/gryffin
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
ファイル: main_test.go プロジェクト: 0xwindows/gryffin
func TestMain(t *testing.T) {
	if os.Getenv("INTEGRATION") == "" {
		t.Skip("Skip integration tests.")
	}
	scan := gryffin.NewScan("GET", ts.URL, "", data.NewMemoryStore(), os.Stdout)
	linkChannels(scan)

}
コード例 #3
0
ファイル: base_test.go プロジェクト: 0xwindows/gryffin
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)
	}
}
コード例 #4
0
ファイル: main.go プロジェクト: binarydreams/gryffin
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()
	}

}