utils.py 456 B

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