Git Product home page Git Product logo

Comments (2)

DemianSteelstone avatar DemianSteelstone commented on June 30, 2024

Also, maybe this will help

#include <arpa/inet.h>
#include <resolv.h>
res_state res = malloc(sizeof(struct __res_state));
     
int result = res_ninit(res);
     
if(result == 0){
    // pass
         
    int nscount = 0;
    union res_sockaddr_union u[MAXNS];
    nscount = res_getservers(res, u, MAXNS);
    NSLog(@"nscount = %d", nscount);
    int i;
    for(i = 0; i < nscount; i++){
        if(u[i].sin.sin_family == PF_INET){
            NSLog(@"IPv4");
            char straddr[INET_ADDRSTRLEN];
            inet_ntop(PF_INET, &u[i].sin.sin_addr, straddr, sizeof(straddr));
            NSString *s = [NSString stringWithCString:straddr encoding:NSASCIIStringEncoding];
            NSLog(@"%@", s);
        }
        if(u[i].sin6.sin6_family == PF_INET6){
            NSLog(@"IPv6");
            //struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&u[i].sin6;
            char straddr[INET6_ADDRSTRLEN];
            inet_ntop(PF_INET6, &u[i].sin6.sin6_addr, straddr, sizeof(straddr));
            NSString *s = [NSString stringWithCString:straddr encoding:NSASCIIStringEncoding];
            NSLog(@"%@", s);
        }
    }
         
}else{
    // fail
}

https://hirooka.pro/?p=6169

from mmlanscan.

mavris avatar mavris commented on June 30, 2024

Hi,
MMLanScan doesn't support IPV6. It's entirely different concept and that's why you get an IP 169.* It cant get it's subnet and its assumes that is /1, that's why is crashing. I should add a case to not scan IPv6 networks. If you implement it feel free to send me a pull request

from mmlanscan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.