Scan Wifi using iwlist ?



  • I am trying to use iwlist or any nodeJS way of scanning for WiFi networks and generating a JSON list. I am finding that iwlist is not working. "wifisetup" works fine but I every interface I try to use iwlist on says scanning is not supported.

    Am I missing something?

    Thanks



  • @brolly759 maybe wifiscanner through node
    https://www.npmjs.com/package/wifiscanner



  • I tried that, using this JS Code:

    const wifiscanner = require("wifiscanner");

    //Returns appropriate instance of a wifi scanner
    const scanner = wifiscanner();

    scanner.scan((error, networks) => {
    if(error) {
    console.error(error);
    } else {
    console.dir(networks);
    }
    });

    I get this:

    root@Omega-1AF1:/node_modules# node test.js
    { [Error: Command failed: /bin/sh -c /sbin/iwlist scan
    /bin/sh: /sbin/iwlist: not found
    ]
    killed: false,
    code: 127,
    signal: null,
    cmd: '/bin/sh -c /sbin/iwlist scan' }



  • @brolly759 seems you either do not have iwlist installed or an incorrect path. did you try custom arguments that give the path?



  • iwlist is installed. When I try running iwlist (interface) s , every network adapter says scanning is not supported.



  • @brolly759
    Try to confirm the path to where iwlist is installed with which iwlist?
    [edit]

    root@Omega-FAF1:/# which iwlist
    /usr/sbin/iwlist
    

    But I think this is moot as it doesn't seem like iwlist functions correctly on O2's.
    I've used aps to scan for AP's before if that helps:

    # aps
    
    WRTnode AP scaner.
    Begin scaning APs, pls wait...
    Finished.
    APs available are...
    ra0       get_site_survey:
    Ch  SSID                             BSSID               Security               Signal(%)W-Mode  ExtCH  NT
    11                                   3c:47:11:8b:f1:f1   WPA1PSKWPA2PSK/TKIPAES 60       11b/g/n NONE   In
    

    [/edit]



  • iwlist is in /usr/sbin/iwlist

    aps seems to work, though no nodeJS plugin for it. Maybe I can create an app that prints the
    "aps" debug into JSON format.



Looks like your connection to Community was lost, please wait while we try to reconnect.