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

Why keep structs weirdly? #12

Open
rew1nter opened this issue Sep 7, 2023 · 1 comment
Open

Why keep structs weirdly? #12

rew1nter opened this issue Sep 7, 2023 · 1 comment

Comments

@rew1nter
Copy link

rew1nter commented Sep 7, 2023

Why do you have ports listed in the masscanresult when you already have it in hosts? :/

	MasscanResult struct {
		Hosts []Hosts `json:"hosts"`
		Ports []Ports `json:"ports"`
	}

	// Hosts  masscan hosts output struct
	Hosts struct {
		IP        string  `json:"ip"`
		Ports     []Ports `json:"ports"`
		Timestamp string  `json:"timestamp"`
	}

	// Ports  masscan ports output struct
	Ports struct {
		Port   int    `json:"port"`
		Proto  string `json:"proto"`
		Status string `json:"status"`
		Reason string `json:"reason"`
		TTL    int    `json:"ttl"`
	}

)

why not just do this?

	MasscanResult struct {
		Hosts []Hosts `json:"hosts"`
	}

	// Hosts  masscan hosts output struct
	Hosts struct {
		IP        string  `json:"ip"`
		Ports     []Ports `json:"ports"`
		Timestamp string  `json:"timestamp"`
	}

	// Ports  masscan ports output struct
	Ports struct {
		Port   int    `json:"port"`
		Proto  string `json:"proto"`
		Status string `json:"status"`
		Reason string `json:"reason"`
		TTL    int    `json:"ttl"`
	}
@zan8in
Copy link
Owner

zan8in commented Sep 8, 2023

Sorry, the code is a bit old, your suggestion is better👏

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