[Python] simple ip range
2016.12.19 16:37
def ipRange(start_ip, end_ip): start = list(map(int, start_ip.split("."))) end = list(map(int, end_ip.split("."))) temp = start ip_range = [] ip_range.append(start_ip) while temp != end: start[3] += 1 for i in (3, 2, 1): if temp[i] == 256: temp[i] = 0 temp[i-1] += 1 ip_range.append(".".join(map(str, temp))) return ip_range # sample usage ip_range = ipRange("192.168.2.0", "192.168.2.10") print ip_range
http://cmikavac.net/2011/09/11/how-to-generate-an-ip-range-list-in-python/
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
16 | [Python] 데이터 분류 좋은 예 | Leekyu | 2017.05.11 | 8617 |
15 | [Python] 객체를 파일로 저장하는 pickle | Leekyu | 2017.02.08 | 3019 |
14 | [Python] py2exe | Leekyu | 2017.02.02 | 826 |
» | [Python] simple ip range | Leekyu | 2016.12.19 | 430 |
12 | [Go] Web Shell Finder [작성중] | Leekyu | 2016.11.09 | 517 |
11 | [Python] Python Malware Crawler [1] | Leekyu | 2016.09.11 | 3399 |
10 | [Go] Memory address sample | Leekyu | 2016.09.06 | 781 |
9 | [Python] Python 파일업로드 예시 [1] | Leekyu | 2016.08.27 | 1803 |
8 | [Python] Python Request를 이용한 세션유지 | Leekyu | 2016.08.25 | 7912 |
7 | [Python] Python을 사용한 간단한 트래픽 생성 | Leekyu | 2016.08.18 | 865 |
6 | [웹] ajax & php를 사용한 시계 예제 | Leekyu | 2016.01.24 | 1403 |
5 | [C] 함수 포인터에 설명이 잘되있는 블로그 | Leekyu | 2014.11.18 | 2645 |
4 | [Python] Python을 이용한 Tor 접속 | Leekyu | 2014.11.15 | 8177 |
3 | [Python] Web page Screenshot | Leekyu | 2014.11.15 | 11815 |
2 | 콜백함수 | Leekyu | 2014.02.09 | 890 |
1 | LoadLibray 함수 | Leekyu | 2014.01.27 | 684 |