mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Changed GenerateHosts implementation to take IP, CIDR, and subnet masks arguments for scanning
This commit is contained in:
parent
555ecf679d
commit
48b2264053
3 changed files with 46 additions and 66 deletions
|
|
@ -18,7 +18,10 @@ func PathExists(path string) (bool, error) {
|
|||
return false, err
|
||||
}
|
||||
|
||||
func GetNextIP(ip net.IP, inc uint) net.IP {
|
||||
func GetNextIP(ip *net.IP, inc uint) *net.IP {
|
||||
if ip == nil {
|
||||
return &net.IP{}
|
||||
}
|
||||
i := ip.To4()
|
||||
v := uint(i[0])<<24 + uint(i[1])<<16 + uint(i[2])<<8 + uint(i[3])
|
||||
v += inc
|
||||
|
|
@ -26,7 +29,9 @@ func GetNextIP(ip net.IP, inc uint) net.IP {
|
|||
v2 := byte((v >> 8) & 0xFF)
|
||||
v1 := byte((v >> 16) & 0xFF)
|
||||
v0 := byte((v >> 24) & 0xFF)
|
||||
return net.IPv4(v0, v1, v2, v3)
|
||||
// return &net.IP{[]byte{v0, v1, v2, v3}}
|
||||
r := net.IPv4(v0, v1, v2, v3)
|
||||
return &r
|
||||
}
|
||||
|
||||
func MakeRequest(url string, httpMethod string, body []byte, headers map[string]string) (*http.Response, []byte, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue