提问人:Fhyruz 提问时间:11/2/2023 更新时间:11/2/2023 访问量:15
自定义邮件抓取工具无法获取目标邮件
custom mail scrapper tool is unable to get targeting mails
问:
我正在尝试在我的 python 系统中运行此代码(这是来自网站的代码,我正在尝试运行它以用于理解目的)。但是我没有收到任何废弃的电子邮件或子域。它只是在第一次尝试后终止。谁能帮我?
from bs4 import BeautifulSoup
import requests
import requests.exceptions
import urllib.parse
from collections import deque
import re
user_url= str(input('[+]Enter targer URL to scan: '))
urls= deque([user_url])
#two puposes 1.visiting the url and 2.extracting email
scrapped_url= set()
email= set()
count= 0
try:
while len(urls):
count += 1
if count == 100:
break
url= urls.popleft()
scrapped_url.add(url)
parts= urllib.parse.urlsplit(url)
base_url = '{0.scheme}://{0.netloc}'.format(parts)
path= url[:url.rfind('/')+1] if '/' in parts.path else url
print('[%d] Processsing %s' % (count, url))
try:
response= requests.get(url)
except(requests.exceptions.MissingSchema, requests.exceptions.ConnectionError):
continue
new_emails = set(re.findall(r'[a-z0-9\. \-+_]+@[a-z0-9\. \-+_]+\.[a-z]+', response.text, re.I))
email.update(new_emails)
soup= BeautifulSoup(response.text, features="lxml")
for anchor in soup.find_all("a"):
link= anchor.attrs['href'] if 'href' in anchor.attrs else ''
if link.startswith('/'):
link= base_url+ link
elif not link.startswith('http'):
link = path + link
if not link in urls and not link in scrapped_url:
urls.append(link)
except KeyboardInterrupt:
print('[-] Closing!')
for mail in email:
print(mail)
答: 暂无答案
评论
soup.find_all("a")
link
for
KeyboardInterrupt