Skip to content

Instantly share code, notes, and snippets.

@Chiggins
Created June 8, 2016 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Chiggins/5e89daa89d5edb4d64b020116334f9e6 to your computer and use it in GitHub Desktop.
Save Chiggins/5e89daa89d5edb4d64b020116334f9e6 to your computer and use it in GitHub Desktop.
Take a look at the MalwareMustDie C&C feed and create a hosts list that can be parsed by nmap
import bs4, requests, urllib
from urlparse import urlparse
feed = requests.get('https://malwared.malwaremustdie.org/rss.php')
feedsoup = bs4.BeautifulSoup(feed.text, 'html.parser')
urls = []
hosts_file = open('hosts.txt', 'w')
# iterate over all <link>...</link> tags
for link in feedsoup.find_all('link'):
url = str(urlparse(urllib.unquote(link.text).decode('utf-8')).hostname).rstrip()
urls.append(url)
hosts_file.write(url + '\n')
hosts_file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment