liamg/furious

Use as library

charles-d-burton opened this issue · 4 comments

I'm attempting to reference your project as a library, it seems like a really well thought out project. I'm currently running into an issue I don't understand. When I try to reference your code from a different project I get the response of:

Scan results for host 192.168.3.5
	Host is down

Where if I run the furious tool:

sudo ./furious -s connect 192.168.3.5

Starting scan at 2019-12-17 20:55:56.545097688 +0000 UTC m=+0.026920458

Scan results for host 192.168.3.5
	Host is up with 56.66663ms latency
	PORT	STATE	SERVICE
	22/tcp    	OPEN      	ssh

Scan complete in 2.418170027s.

It seems to work fine. The code I'm using looks like this and semantically doesn't seem any different what what your project is running.

if os.Getuid() > 0 {
		fmt.Println("Access Denied: You must be a priviliged user to run this type of scan.")
		os.Exit(1)
	}
	targetIterator := scan.NewTargetIterator("192.168.3.5")
	scanner := scan.NewConnectScanner(targetIterator, 6000, 1000)
	if err := scanner.Start(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	ctx, _ := context.WithCancel(context.Background())
	results, err := scanner.Scan(ctx, scan.DefaultPorts)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	for _, result := range results {
		scanner.OutputResult(result)
	}

Same, I'm facing a similar issue where when using connect scan, it works fine, but using a syn always says that the host is down.

@iDuronto I ended up writing my own. It's not really a library but you can see how I implemented the SYN scanning, it's actually pretty straightforward.

https://github.com/charles-d-burton/scandalorian/blob/master/discovery-engine/main.go

Here's my blog on how I build it too, the build supports full multi-arch:

https://blog.thehandyhacker.com/posts/multi-arch2/

Change the duration parameter to either like 6*time.Second or to 6000000000. you are using a too fast/unrealistic timeout :)

you would think 6000 is 6 seconds but actually it is 6 microseconds