Beispiel #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)
	}

	gryffin.SetLogWriter(w)

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

	linkChannels(scan)

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

}
Beispiel #2
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)
	}

	gryffin.SetLogWriter(logWriter)

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

	t = gryffin.NewScan("GET", url, "")

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

	store = gryffin.NewSharedGryffinStore()
	gryffin.SetMemoryStore(store)

	captureCtrlC()

	switch service {

	case "crawl":
		shareCache()
		crawl()

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

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

}