'Analyze responses and determine if remote web server runs on windows
or *nix.
@Return: None, the knowledge is saved in the knowledgeBase'

def _find_OS(self, fuzzable_request):

    freq_url = fuzzable_request.get_url()
    filename = freq_url.get_file_name()
    dirs = freq_url.get_directories()[:(-1)]
    if (dirs and filename):
        last_url = dirs[(-1)]
        last_url = last_url.url_string
        windows_url = URL(((last_url[0:(-1)] + '\\') + filename))
        windows_response = self._uri_opener.GET(windows_url)
        original_response = self._uri_opener.GET(freq_url)
        if fuzzy_equal(original_response.get_body(), windows_response.get_body(), 0.98):
            desc = 'Fingerprinted    this    host    as    a    Microsoft    Windows    system.'
            os_str = 'windows'
        else:
            desc = 'Fingerprinted    this    host    as    a    *nix    system.    Detection    for    this    operating    system    is    weak,    "if    not    windows    then    linux".'
            os_str = 'unix'
        response_ids = [windows_response.id, original_response.id]
        i = Info('Operating    system', desc, response_ids, self.get_name())
        i.set_url(windows_response.get_url())
        kb.kb.raw_write(self, 'operating_system_str', os_str)
        kb.kb.append(self, 'operating_system', i)
        om.out.information(i.get_desc())
        return True
    return False
