theHarvester/cymonparser.py
Christian Martorella 53703ffd0f Minor Lee fixes
2018-12-22 21:29:11 +01:00

18 lines
539 B
Python
Executable file

from bs4 import BeautifulSoup
import re
class parser:
def __init__(self, results):
self.results = results
self.ipaddresses = []
self.soup = BeautifulSoup(results.results, features="html.parser")
def search_ipaddresses(self):
try:
tags = self.soup.findAll('td')
allip = re.findall(r'[0-9]+(?:\.[0-9]+){3}',str(tags))
self.ipaddresses = set(allip)
return self.ipaddresses
except Exception as e:
print("Error occurred: " + str(e))