Guest User

Untitled

a guest
Jun 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1.  
  2.  
  3. var child_process = require("child_process")
  4. function getIPs (cb) {
  5. child_process.exec("ifconfig -a", function (er, o) {
  6. if (er) return cb(er)
  7. cb(null, o.match(/inet ([0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3})/g).map(function (i) {
  8. return i.replace(/^inet /, '')
  9. }))
  10. })
  11. }
  12.  
  13. getIPs(function (er, ips) {
  14. console.error([er, ips])
  15. })
Add Comment
Please, Sign In to add comment