File tree Expand file tree Collapse file tree
misp_modules/modules/import_mod Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -170,7 +170,10 @@ def dict_handler(request: dict):
170170 for url in urls :
171171 if not url :
172172 continue
173- url_object = URLObject (url , standalone = False )
173+ try :
174+ url_object = URLObject (url , standalone = False )
175+ except ValueError :
176+ continue
174177 file_objects .append (url_object )
175178 email_object .add_reference (url_object .uuid , "includes" , "URL in email body" )
176179
@@ -344,9 +347,15 @@ def __init__(self, urls=None):
344347
345348 def handle_starttag (self , tag , attrs ):
346349 if tag == "a" :
347- self .urls .append (dict (attrs ).get ("href" ))
350+ value = self .urls .append (dict (attrs ).get ("href" ))
348351 if tag == "img" :
349- self .urls .append (dict (attrs ).get ("src" ))
352+ value = self .urls .append (dict (attrs ).get ("src" ))
353+ else :
354+ return
355+
356+ # avoid references like internal cid:
357+ if value and value .lower ().startswith (("http://" , "https://" )):
358+ self .urls .append (value )
350359
351360
352361def introspection ():
You can’t perform that action at this time.
0 commit comments