def getMalc0deList(): rawList = [] logging.info("Fetching latest Malc0de list.") xml = soupParse(baseConfig.malc0deUrl) if xml: for row in xml('description'): rawList.append(row) del rawList[0] malList = [] for row in rawList: location = re.sub('&', '&', str(row).split()[1]).replace(',', '') if location.strip(): url = 'http://{0}'.format(location) if isValidUrl(url): malList.append(url) return malList else: logging.error( "Empty Malc0de XML. Potential connection error. Please try again later." ) sys.exit(1)
def getMinotaurList(): try: userAgent = {'User-agent': baseConfig.userAgent} logging.info("Fetching latest Minotaur list.") request = requests.get(baseConfig.minotaurUrl, headers=userAgent) if request.status_code == 200: malList = [] for line in request.content.split('\n'): url = line.strip() if isValidUrl(url): malList.append(url) return malList else: logging.error( "Problem connecting to Minotaur. Status code:{0}. Please try again later." .format(request.status_code)) sys.exit(1) except Exception as e: logging.error( "Problem connecting to Minotaur. Please try again later.") logging.exception(sys.exc_info()) logging.exception(type(e)) logging.exception(e.args) logging.exception(e) sys.exit(1)
def getMalShareList(): try: payload = {'action': 'getsourcesraw', 'api_key': baseConfig.malShareApiKey } userAgent = {'User-agent': baseConfig.userAgent} logging.info('Fetching latest MalShare list.') request = requests.get('http://malshare.com/api.php', params=payload, headers=userAgent) if request.status_code == 200: mal_list = [] for line in request.content.split('\n'): url = line.strip() if isValidUrl(url): mal_list.append(url) return mal_list else: logging.error('Problem connecting to MalShare. Status code:{0}. Please try again later.'.format(request.status_code)) except requests.exceptions.ConnectionError as e: logging.warning('Problem connecting to Malshare. Error: {0}'.format(e)) except Exception as e: logging.warning('Problem connecting to Malshare. Aborting task.') logging.exception(sys.exc_info()) logging.exception(type(e)) logging.exception(e.args) logging.exception(e) return []
def getVXList(): try: userAgent = {'User-agent': baseConfig.userAgent} logging.info('Fetching latest VX Vault list.') request = requests.get('http://vxvault.net/URL_List.php', headers=userAgent) if request.status_code == 200: mal_list = [] for line in request.content.split('\n'): url = line.strip() if isValidUrl(url): mal_list.append(url) return mal_list else: logging.error('Problem connecting to VX Vault. Status code:{0}. Please try again later.'.format(request.status_code)) except requests.exceptions.ConnectionError as e: logging.warning('Problem connecting to VX Vault. Error: {0}'.format(e)) except Exception as e: logging.warning('Problem connecting to VX Vault. Aborting task.') logging.exception(sys.exc_info()) logging.exception(type(e)) logging.exception(e.args) logging.exception(e) return []
def getMalc0deList(): try: raw_list = [] logging.info('Fetching latest Malc0de list.') xml = soupParse('http://malc0de.com/rss') if xml: for row in xml('description'): raw_list.append(row) del raw_list[0] malList = [] for row in raw_list: location = re.sub('&','&',str(row).split()[1]).replace(',','') if location.strip(): url = 'http://{0}'.format(location) if isValidUrl(url): malList.append(url) return malList else: logging.error('Empty Malc0de XML. Potential connection error. Please try again later.') except Exception as e: logging.warning('Problem connecting to Malc0de. Aborting task.') logging.exception(sys.exc_info()) logging.exception(type(e)) logging.exception(e.args) logging.exception(e) return []
def getVXList(): try: userAgent = {'User-agent': baseConfig.userAgent} logging.info('Fetching latest VX Vault list.') request = requests.get('http://vxvault.net/URL_List.php', headers=userAgent) if request.status_code == 200: mal_list = [] for line in request.content.split('\n'): url = line.strip() if isValidUrl(url): mal_list.append(url) return mal_list else: logging.error( 'Problem connecting to VX Vault. Status code:{0}. Please try again later.' .format(request.status_code)) except requests.exceptions.ConnectionError as e: logging.warning('Problem connecting to VX Vault. Error: {0}'.format(e)) except Exception as e: logging.warning('Problem connecting to VX Vault. Aborting task.') logging.exception(sys.exc_info()) logging.exception(type(e)) logging.exception(e.args) logging.exception(e) return []
def getMinotaurList(): logging.info("Fetching latest Minotaur list.") html = soupParse(baseConfig.minotaurUrl) if html: malList = [] urlTable = html.find("div", {"id": "mtabs-2"}).find("table", {"class": "hometable2"}) if urlTable: for row in urlTable.findAll("tr")[1:]: elements = row.findAll('td') if len(elements) == 4: url = elements[3].text.strip() if isValidUrl(url): malList.append(url) return malList else: logging.error("Failed to locate Minotaur URL table. Ensure that this is the latest ph0neutria release.") sys.exit(1) else: logging.error("Empty Minotaur XML. Potential connection error. Please try again later.") sys.exit(1)
def getMalc0deList(): try: raw_list = [] logging.info('Fetching latest Malc0de list.') xml = soupParse('http://malc0de.com/rss') if xml: for row in xml('description'): raw_list.append(row) del raw_list[0] malList = [] for row in raw_list: location = re.sub('&', '&', str(row).split()[1]).replace(',', '') if location.strip(): url = 'http://{0}'.format(location) if isValidUrl(url): malList.append(url) return malList else: logging.error( 'Empty Malc0de XML. Potential connection error. Please try again later.' ) except Exception as e: logging.warning('Problem connecting to Malc0de. Aborting task.') logging.exception(sys.exc_info()) logging.exception(type(e)) logging.exception(e.args) logging.exception(e) return []