async def vasuki_service(request, response, *args, **kwargs): #debug_request(request, response) options = DefaultMunch(None) # Transform request parameters into munch of options (subcommands). subcommand_options = {} for v in kwargs.values(): subcommand_options[v] = True options.update(subcommand_options) # Transform request parameters into munch of options (query arguments). options.update(request.params.items()) # Run command, optionally multiple times. try: command = VasukiCommand(options) results = command.run_multi() # Output identifiers to HTTP response. response.text = '\n'.join(results) except Exception as ex: log.exception('Vasuki failed') response.status_code = api.status_codes.HTTP_500 response.text = f'{ex.__class__.__name__}: {str(ex)}'
def extract_fingerprint_from_notify_message( self, http_packet: dpkt.http.Request) -> Munch: # Note that the library will accept any case of header, they are lowercase in the result fingerprint = DefaultMunch('') fingerprint.upnp_packet_type = 1 fingerprint.upnp_location = http_packet.headers.get("location") fingerprint.upnp_uns = http_packet.headers.get("usn") fingerprint.upnp_nt = http_packet.headers.get("nt") fingerprint.upnp_nts = http_packet.headers.get("nts") if http_packet.headers.get('server'): fingerprint.update( self.parse_upnp_header_information( http_packet.headers.get('server'))) if "cache-control" in http_packet.headers: fingerprint.upnp_cache = int( http_packet.headers.get("cache-control").split('=')[1]) return fingerprint