'Detect websockets for Cross-Site WebSocket hijacking vulnerabilities.
This plugin works really well and can be improved in two different ways:
* Add new check_* methods to this class which detect websocket
vulnerabilities and then add them to known_checks
* Extend the websocket link detection in grep.websockets_links,
which is the weak part of the process, this is because we\'re doing
a very trivial regular expression match to find WS links, which
will most likely fail in "complex" web applications
:param freq: A FuzzableRequest'

def audit(self, freq, orig_response):

    ws_links = kb.kb.get('websockets_links', 'websockets_links')
    for web_socket_info_set in ws_links:
        web_socket_url = web_socket_info_set['ws_link']
        if (web_socket_url in self.already_tested_websockets):
            continue
        self.already_tested_websockets.add(web_socket_url)
        web_socket_url = URL(web_socket_url)
        web_socket_version = negotiate_websocket_version(self._uri_opener, web_socket_url)
        self.check_websocket_security(web_socket_url, web_socket_version)
