Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # this tools can be used to extracting ips from a files that contain other string apart from ip
- import re
- def extactip():
- opener = open('SAMPLE.txt', 'r').read()
- getips = re.findall(r'\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b', opener)
- for i in getips:
- print(i)
- open('IPs-List.txt', 'a').write(i + "\n")
- extactip()
Add Comment
Please, Sign In to add comment