Подскажите скрипт на петоне или софт что может вытаскивать с файлов корпа емайли?
import os
import re
pattern = r'([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})\:(.*?)\.'
email_password_pairs = []
# Function to extract email:password pairs from a file
def extract_pairs_from_file(file_path):
with open(file_path, 'r', encoding='utf-8', errors='ignore') as file:
for line in file:
# Extract email:password pairs from each line
matches = re.findall(pattern, line)
for match in matches:
email_password_pairs.append(':'.join(match))
directory = 'папка с тхт файлами'
for filename in os.listdir(directory):
if filename.endswith('.txt'):
file_path = os.path.join(directory, filename)
extract_pairs_from_file(file_path)
with open('output.txt', 'w', encoding='utf-8') as output_file:
for pair in email_password_pairs:
output_file.write(pair + '\n')
output_file.flush()
print("Output saved to output.txt")
domains_to_exclude = ['gmail', 'yahoo', 'outlook', 'live']
with open('output.txt', 'r', encoding='utf-8') as input_file:
lines = input_file.readlines()
filtered_lines = [line for line in lines if not any(domain in line.lower() for domain in domains_to_exclude)]
with open('notbigs.txt', 'w', encoding='utf-8') as output_file:
output_file.writelines(filtered_lines)
print("Done")