(view)
| 124 | |
| 125 | |
| 126 | def select_ipv4(view): |
| 127 | pattern = r'(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)((([\-](1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])|/(1\d|2\d|3[0-2]|[1-9]))(\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d))?)?)' |
| 128 | regions = view.find_all(pattern) |
| 129 | |
| 130 | lan_ips = [] |
| 131 | wan_ips = [] |
| 132 | for region in regions: |
| 133 | text = view.substr(region) |
| 134 | temp = text.split('-')[0].split('/')[0] |
| 135 | if is_lan(temp): |
| 136 | lan_ips.append(text) |
| 137 | else: |
| 138 | wan_ips.append(text) |
| 139 | |
| 140 | return unique_sort_ipv4(lan_ips),unique_sort_ipv4(wan_ips) |
| 141 | |
| 142 | |
| 143 | def is_lan(ip): |
no test coverage detected