I have built(modified) a python script to download the csv file for phishing_phishtank_feed which rather is not possible to download by scripting as it requires token to download and they have stopped giving access to their API
SA Plugin options
Code: Select all
ifplugin Mail::SpamAssassin::Plugin::Phishing
phishing_openphish_feed /etc/spamassassin/feed.txt
phishing_phishtank_feed /etc/spamassassin/verified_online.csv
phishing_phishstats_feed /etc/spamassassin/phish_score.csv
body URI_PHISHING eval:check_phishing()
describe URI_PHISHING Url match phishing in feed
score URI_PHISHING 2.1
phishing_phishstats_minscore 5
endif
phishing_openphish_feed "https://openphish.com/feed.txt" --Updated 6 hours in Free
phishing_phishstats_feed "https://phishstats.info/phish_score.csv" --Updated every 90 minutes
The problematic database
phishing_phishtank_feed "http://data.phishtank.com/data/online-valid.csv"
Python Script (required python 2.7 minimum, pip and selenium)
Code: Select all
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os
import time
# Script downloaded from https://www.onlinetutorialspoint.com/selenium/python-selenium-download-a-file-in-headless-mode.html
# modified as per needs
#
DOWNLOAD_URL = "https://data.phishtank.com/data/online-valid.csv"
download_dir = "C:\\Program Files\\JAM Software\\SpamAssassin for Windows\\etc\\spamassassin\\"
driver_path = "C:\\Scripts\\SpamAssassin\\Download_phish\\chromedriver.exe"
def enable_download(driver):
driver.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command')
params = {'cmd':'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': download_dir}}
driver.execute("send_command", params)
def setting_chrome_options():
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument('--no-sandbox')
chrome_options.add_experimental_option("prefs", {
"download.prompt_for_download": False,
"download.directory_upgrade": True,
"safebrowsing_for_trusted_sources_enabled": False,
"safebrowsing.enabled": False
})
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--disable-software-rasterizer')
return chrome_options;
def isFileDownloaded():
file_path = download_dir+"\\verified_online.csv"
while not os.path.exists(file_path):
time.sleep(1)
if os.path.isfile(file_path):
print("File Downloaded successfully..")
if __name__ == '__main__':
driver = webdriver.Chrome(executable_path=driver_path,options=setting_chrome_options())
enable_download(driver)
driver.get(DOWNLOAD_URL)
isFileDownloaded()