()
| 115 | |
| 116 | |
| 117 | def list_routes(): |
| 118 | if sys.platform == 'win32': |
| 119 | routes = _list_routes(['route', 'PRINT', '-4'], _route_windows) |
| 120 | else: |
| 121 | if which('ip'): |
| 122 | routes = _list_routes(['ip', 'route'], _route_iproute) |
| 123 | elif which('netstat'): |
| 124 | routes = _list_routes(['netstat', '-rn'], _route_netstat) |
| 125 | else: |
| 126 | log('WARNING: Neither "ip" nor "netstat" were found on the server. ' |
| 127 | '--auto-nets feature will not work.') |
| 128 | routes = [] |
| 129 | |
| 130 | for (family, ip, width) in routes: |
| 131 | if not ip.startswith('0.') and not ip.startswith('127.'): |
| 132 | yield (family, ip, width) |
| 133 | |
| 134 | |
| 135 | def _exc_dump(): |
no test coverage detected