utils.py 436 B

123456789101112131415
  1. # Testing utilities
  2. # Copyright (c) 2013, Jouni Malinen <j@w1.fi>
  3. #
  4. # This software may be distributed under the terms of the BSD license.
  5. # See README for more details.
  6. def get_ifnames():
  7. ifnames = []
  8. with open("/proc/net/dev", "r") as f:
  9. lines = f.readlines()
  10. for l in lines:
  11. val = l.split(':', 1)
  12. if len(val) == 2:
  13. ifnames.append(val[0].strip(' '))
  14. return ifnames