'If a path disclosure was found, I can create a list of full paths to
all URLs ever visited. This method updates that list.'

def _update_kb_path_list(self):

    path_disc_vulns = kb.kb.get('path_disclosure', 'path_disclosure')
    url_list = kb.kb.get_all_known_urls()
    longest_match = ''
    longest_path_disc_vuln = None
    for path_disc_vuln in path_disc_vulns:
        for url in url_list:
            path_and_file = url.get_path()
            if path_disc_vuln['path'].endswith(path_and_file):
                if (len(longest_match) < len(path_and_file)):
                    longest_match = path_and_file
                    longest_path_disc_vuln = path_disc_vuln
    if (not longest_match):
        return
    webroot = longest_path_disc_vuln['path'].replace(longest_match, '')
    if (not webroot):
        return
    path_sep = ('/' if webroot.startswith('/') else '\\')
    remote_locations = []
    for url in url_list:
        remote_path = url.get_path().replace('/', path_sep)
        remote_locations.append((webroot + remote_path))
    remote_locations = list(set(remote_locations))
    kb.kb.raw_write(self, 'list_files', remote_locations)
    kb.kb.raw_write(self, 'webroot', webroot)
