Relatively untested so not published to npm yet, but you can clone it from here
https://github.com/femto113/node-ifconfig All this module does is use child_process.exec to run ifconfig (with no arguments), and then parses its seizure inducing output format into nested javascript objects. From there it's relatively simple to do whatever you want with it, e.g. dig out MAC addresses. There exist far more ambitious projects<https://github.com/postwait/node-ife>that are supersets of this functionality, and also some that simply regex out the MAC addresses <https://github.com/bevry/getmac> from ifconfig without bothering to parse the output, but none of them quite fit my needs. Comments/issues/pull requests welcome. --Ken By way of explanation here's some sample ifconfig output, and below is the corresponding parsed objects: lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 options=3<RXCSUM,TXCSUM> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 en0: flags=8823<UP,BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500 ether 99:ff:99:42:4d:12 media: autoselect (<unknown type>) status: inactive en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4> ether 41:7c:9f:14:56:8c inet6 fe90::417c:8fff:fe12:567c%en1 prefixlen 64 scopeid 0x7 inet 10.0.0.140 netmask 0xffffff00 broadcast 10.0.0.255 media: autoselect (1000baseT <full-duplex>) status: active parsed: { "lo0": { "flags": "8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384", "options": "3<RXCSUM,TXCSUM>", "inet6": "fe80::1 prefixlen 128", "inet": "127.0.0.1 netmask 0xff000000" }, "en0": { "flags": "8823<UP,BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500", "ether": "99:ff:99:42:4d:12", "media": "autoselect (<unknown type>)", "status": "inactive" }, "en1": { "flags": "8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500", "options": "2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>", "ether": "41:7c:9f:14:56:8c", "inet6": "fe90::417c:8fff:fe12:567c%en1 prefixlen 64 scopeid 0x7", "inet": "10.0.0.140 netmask 0xffffff00 broadcast 10.0.0.255", "media": "autoselect (1000baseT <full-duplex>)", "status": "active" } } -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
