@@ -593,21 +593,35 @@ def run(self, _function, **kwargs):
593
593
except Exception as e :
594
594
return e
595
595
596
+ def consistency_check (self , entity_list , entity_type ):
597
+ """Ensures that a list of inputs contains the same entities"""
598
+ if not entity_list :
599
+ entity_list .append (entity_type )
600
+ if entity_type in entity_list :
601
+ return True
602
+ return False
603
+
596
604
def validate (self , _input : str ):
597
605
"""Functions to validate user inputs"""
598
- if self .ip .is_ip_address (_input ):
599
- return [True , "input: ipv4 address" , [option for option in self .ip .osint_options .keys ()]]
600
- elif self .email .is_valid_email (_input ):
601
- return [True , "input: email address" , [option for option in self .email .osint_options .keys ()]]
602
- elif self .domain .is_valid_domain (_input ):
603
- return [True , "input: domain" , [option for option in self .domain .osint_options .keys ()]]
604
- elif self .url .is_url (_input ):
605
- return [True , "input: url" , [option for option in self .url .osint_options .keys ()]]
606
- elif self .md5 .is_md5 (_input ):
607
- return [True , "input: md5" , [option for option in self .md5 .osint_options .keys ()]]
608
- elif self .sha256 .is_sha256 (_input ):
609
- return [True , "input: sha256" , [option for option in self .sha256 .osint_options .keys ()]]
610
- return [False , []]
606
+ _input = _input .split ("," )
607
+ _list = []
608
+ output = []
609
+ for i in _input :
610
+ if self .ip .is_ip_address (i ) and self .consistency_check (_list , "ip" ):
611
+ output .append ([True , "input: ipv4 address" , [option for option in self .ip .osint_options .keys ()]])
612
+ elif self .email .is_valid_email (i ) and self .consistency_check (_list , "email" ):
613
+ output .append ([True , "input: email address" , [option for option in self .email .osint_options .keys ()]])
614
+ elif self .domain .is_valid_domain (i ) and self .consistency_check (_list , "domain" ):
615
+ output .append ([True , "input: domain" , [option for option in self .domain .osint_options .keys ()]])
616
+ elif self .url .is_url (i ) and self .consistency_check (_list , "url" ):
617
+ output .append ([True , "input: url" , [option for option in self .url .osint_options .keys ()]])
618
+ elif self .md5 .is_md5 (i ) and self .consistency_check (_list , "hash" ):
619
+ output .append ([True , "input: md5" , [option for option in self .md5 .osint_options .keys ()]])
620
+ elif self .sha256 .is_sha256 (i ) and self .consistency_check (_list , "hash" ):
621
+ output .append ([True , "input: sha256" , [option for option in self .sha256 .osint_options .keys ()]])
622
+ else :
623
+ output .append ([False , []])
624
+ return output
611
625
612
626
def execute_transform (self , _input : str , transform : str ):
613
627
"""Function to run osint data mining tasks appropriate to each input"""
0 commit comments