Skip to content

Instantly share code, notes, and snippets.

@rshipp
Created March 4, 2019 16:05
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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