Skip to content

Host file assumes host is IP address only #238

@bee-san

Description

@bee-san

Because of the way the host file works, it can only work on IP addresses.

    for ip_or_host in &opts.addresses {
        match IpCidr::from_str(ip_or_host) {
            Ok(cidr) => cidr.iter().for_each(|ip| ips.push(ip)),
            _ => match format!("{}:{}", &ip_or_host, 80).to_socket_addrs() {
                Ok(mut iter) => ips.push(iter.nth(0).unwrap().ip()),
                _ => {
                    match read_ips_from_file(ip_or_host.to_owned()) {
                        Ok(x) => ips.extend(x),
                        _ => {
                            warning!(
                                format!("Host {:?} could not be resolved.", ip_or_host),
                                opts.greppable,
                                opts.accessible
                            );
                        },
                    }

                }
            },
        }

    }

So the code checks:

  1. CIDR
  2. Host
  3. File
    In this order.

But if the file contains:

google.com
192.168.0.0/30

This will not work, as those conversions are done before the file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions