Skip to content

Instantly share code, notes, and snippets.

@rshipp
Created March 4, 2019 16:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rshipp/d399491305c5d293357a800d5a51b0aa to your computer and use it in GitHub Desktop.
Save rshipp/d399491305c5d293357a800d5a51b0aa to your computer and use it in GitHub Desktop.
extract iocs from urls
#!/usr/bin/env python2
# dependencies: pip install requests bs4 iocextract
# usage: python wwwextract.py URL
import sys
import requests
import bs4
import iocextract
response = requests.get(sys.argv[1])
document = bs4.BeautifulSoup(response.content, 'html.parser')
for ioc in iocextract.extract_iocs(document.get_text(separator=' '), refang=True, strip=True):
print(ioc.encode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment