autoreg-skills-max: initial public release (restored, redacted, hardened)
This commit is contained in:
62
skills/firecrawl-account-farming/scripts/imap_verify.py
Normal file
62
skills/firecrawl-account-farming/scripts/imap_verify.py
Normal file
@@ -0,0 +1,62 @@
|
||||
# Firecrawl IMAP Verification Helper
|
||||
|
||||
import imaplib
|
||||
import email
|
||||
import re
|
||||
import time
|
||||
import sys
|
||||
|
||||
def get_verification_link(email_addr, imap_user, imap_pass, timeout=15):
|
||||
"""Poll IMAP for Firecrawl verification link."""
|
||||
deadline = time.time() + timeout
|
||||
while time.time() < deadline:
|
||||
try:
|
||||
mail = imaplib.IMAP4_SSL("imap.gmail.com")
|
||||
mail.login(imap_user, imap_pass)
|
||||
mail.select("INBOX")
|
||||
status, msgs = mail.search(None, f'TO "{email_addr}"')
|
||||
if status == "OK" and msgs[0]:
|
||||
ids = msgs[0].split()
|
||||
latest = ids[-1]
|
||||
status, data = mail.fetch(latest, "(RFC822)")
|
||||
raw = data[0][1]
|
||||
msg = email.message_from_bytes(raw)
|
||||
body = ""
|
||||
if msg.is_multipart():
|
||||
for part in msg.walk():
|
||||
if part.get_content_type() == "text/html":
|
||||
body = part.get_payload(decode=True).decode(errors='ignore')
|
||||
break
|
||||
else:
|
||||
body = msg.get_payload(decode=True).decode(errors='ignore')
|
||||
links = re.findall(r'https?://[^\s"<>]+', body)
|
||||
for link in links:
|
||||
if 'verify' in link or 'confirm' in link:
|
||||
mail.logout()
|
||||
return link.replace('&', '&')
|
||||
mail.logout()
|
||||
except Exception as e:
|
||||
print(f" IMAP error: {e}", file=sys.stderr)
|
||||
time.sleep(2)
|
||||
return None
|
||||
|
||||
def validate_key(key):
|
||||
"""Test a Firecrawl API key."""
|
||||
import requests
|
||||
try:
|
||||
r = requests.post(
|
||||
"https://api.firecrawl.dev/v1/scrape",
|
||||
headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"},
|
||||
json={"url": "https://httpbin.org/ip", "formats": ["markdown"]},
|
||||
timeout=15
|
||||
)
|
||||
return r.status_code == 200 and r.json().get("success", False)
|
||||
except:
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python imap_verify.py <email_addr>")
|
||||
sys.exit(1)
|
||||
link = get_verification_link(sys.argv[1], "[REDACTED-NAME]@gmail.com", "IMAP_APP_PASSWORD")
|
||||
print(link or "NOT FOUND")
|
||||
Reference in New Issue
Block a user