with open("maillog", "r") as file_read:
for text in file_read:
email_pattern = re.compile(r'[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+')
email_from_raw_string = email_pattern.search(text).group()
new_string = email_pattern.sub('test@mail.ru', text)
print(email_from_raw_string)
print(new_string)
import requests
from bs4 import BeautifulSoup
def get_html(site):
r = requests.get(site)
return r.text
def get_page_data(html): #sources
soup = BeautifulSoup(html, 'lxml') #(format_in, parser)
line = soup.find('table', id='theProxyList').find_all('tr') #resolve table
for tr in line:
td = tr.find_all('td')
print (td)
#ip = td[0].text
#print(ip)
#port = td[2].text
#country = td[3].text
#anonym = td[4].text
#types = td[5].text
#time = td[6].text
#data = {'ip': ip,
# 'Port': port,
# 'Country': country,
# 'Anonymize': anonym,
# 'Type': types,
# 'Time': time}
def main():
url = 'http://foxtools.ru/Proxy'
get_page_data(get_html(url))
if __name__ == '__main__':
main()