Created
June 8, 2016 16:37
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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