<s> '''<STR_LIT>''' <EOL> import xml . etree . ElementTree as ET <EOL> import argparse , sys , os , shutil , re <EOL> import TARDIS <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> os . chdir ( '<STR_LIT>' ) <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , help = '<STR_LIT>' , dest = '<STR_LIT:file>' , required = True ) <EOL> args = parser . parse_args ( ) <EOL> file = args . file <EOL> try : <EOL> tree = ET . parse ( file ) <EOL> root = tree . getroot ( ) <EOL> except : <EOL> sys . exit ( "<STR_LIT>" ) <EOL> if os . path . exists ( '<STR_LIT>' ) : <EOL> shutil . rmtree ( '<STR_LIT>' ) <EOL> numHosts = <NUM_LIT:0> <EOL> for host in root . findall ( "<STR_LIT>" ) : <EOL> numHosts = numHosts + <NUM_LIT:1> <EOL> directory = '<STR_LIT>' <EOL> if not os . path . exists ( directory ) : <EOL> os . makedirs ( directory ) <EOL> for ip in host . findall ( "<STR_LIT>" ) : <EOL> sourceIP = ip . text <EOL> if not os . path . exists ( directory + '<STR_LIT:/>' + sourceIP ) : <EOL> os . makedirs ( directory + '<STR_LIT:/>' + sourceIP ) <EOL> for hostname in host . findall ( "<STR_LIT>" ) : <EOL> sourceHost = hostname . text <EOL> for vulnerability in host . findall ( "<STR_LIT>" ) : <EOL> internalVulnerabilityID = vulnerability . get ( '<STR_LIT:id>' ) <EOL> vulnName = internalVulnerabilityID <EOL> for line in open ( "<STR_LIT>" ) : <EOL> if internalVulnerabilityID in line : <EOL> vulnName = re . sub ( '<STR_LIT>' , '<STR_LIT>' , line ) <EOL> vulnName = re . sub ( '<STR_LIT>' , '<STR_LIT>' , vulnName ) <EOL> internalVulnerabilityID = vulnName <EOL> numResults = TARDIS . main ( vulnName , sourceIP , sourceHost ) <EOL> if numHosts < <NUM_LIT:1> : <EOL> sys . exit ( "<STR_LIT>" ) </s>
