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

The IP address on line 1 is invalid! #5

Open
EmilWilder opened this issue Apr 9, 2023 · 2 comments
Open

The IP address on line 1 is invalid! #5

EmilWilder opened this issue Apr 9, 2023 · 2 comments

Comments

@EmilWilder
Copy link

I have a file that consist ips from masscan that looks like this:
111.111.111.111
222.222.222.222
(has 3.5 million ip addresses)
but when I try to use -ipFile ips.txt, it returns this error:
The IP address on line 1 is invalid!
Which format should I use? I even tried masscan default format which is:
open tcp 25565 xx.xx.xx.xx 1680825136
still, no luck

@EmilWilder
Copy link
Author

EmilWilder commented Apr 9, 2023

Okay fixed it
I changed the readFromFile function on ips.go to continue even if there is an invalid ip

func readFromFile(filePath string, outputChannel chan string) int {
	log.Printf("Reading IPs from %v...\n", filePath)
	fileData, err := ioutil.ReadFile(filePath)
	if err != nil {
		log.Fatalf("Unable to read file: %v\n", err.Error())
		return 1
	}
	ips := strings.Split(strings.TrimSpace(string(fileData)), "\n")
	ok, _ := validateIps(ips)
	if !ok {
		log.Println("Some IP addresses are invalid")
	}
	log.Printf("Successfully read %v IP addresses from file\n", len(ips))
	for _, ip := range ips {
		if strings.TrimSpace(ip) != "" {
			outputChannel <- ip
		}
	}

	time.Sleep(100 * time.Millisecond)
	outputChannel <- "end"
	return 0
}

@ErrorNoInternet
Copy link
Owner

Are there trailing spaces on the lines?
Or maybe your file uses CRLF line endings?

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

2 participants