Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use as library #8

Open
charles-d-burton opened this issue Dec 17, 2019 · 4 comments
Open

Use as library #8

charles-d-burton opened this issue Dec 17, 2019 · 4 comments

Comments

@charles-d-burton
Copy link

charles-d-burton commented Dec 17, 2019

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)
	}
@iDuronto
Copy link

iDuronto commented Dec 2, 2020

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.

@charles-d-burton
Copy link
Author

@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/

@003random
Copy link

003random commented Dec 9, 2020

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

@003random
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants