Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif validators.email(sys.argv[2]) and '--fullcontact' == sys.argv[3] and len(sys.argv) == 4:
if fullcontact_key == '':
print ("[*] FullContact API key don't exist.")
sys.exit()
else:
figlet_print()
fullcontact(sys.argv[2], pipl_key)
sys.exit()
elif validators.email(sys.argv[2]) and '--pwned' == sys.argv[3] and len(sys.argv) == 4:
figlet_print()
haveibeenpwned(sys.argv[2])
sys.exit()
elif validators.email(sys.argv[2]) and '--validate' == sys.argv[3] and len(sys.argv) == 4:
if towerdata_api_key == '':
print ("[*] TowerData API key don't exist.")
sys.exit()
else:
figlet_print()
emailValidator(sys.argv[2], towerdata_api_key)
sys.exit()
else:
menu_bad_execution()
elif sys.argv[1] == '-p' and sys.argv[3] == '--callerID' and len(sys.argv) == 4:
figlet_print()
if phonenumbers.is_valid_number(phonenumbers.parse(sys.argv[2], None)):
if caller_sid == '' or caller_auth == '':
:param resp:
"""
doc = req.context["doc"]
data_keys = doc.keys()
required_fields = {
"username": str,
"password": str,
"first_name": str,
"last_name": str,
"settings": dict
}
field_errors = []
# Required settings
required_settings = {
"location": tools.location_validator,
"email": validators.email
}
# TODO: validate settings
for field, field_type in required_fields.items():
if field in data_keys:
if type(doc[field]) != field_type:
field_error = {
"type": 'error',
"id": "FIELD_{}_INVALID_TYPE".format(field.upper()),
"text": "Field {0} must be of type {1}".format(field, type(field_type).__name__),
"status": falcon.HTTP_BAD_REQUEST
}
field_errors.append(field_error)
# After validating that settings exist in the doc and is a dict, validate that
# the required settings exist
elif field == "settings":
for setting in required_settings:
def validate_result(current, default, type):
"""
Validates the data, whether it needs to be url, twitter, linkedin link etc.
"""
if current is None:
current = ""
if default is None:
default = ""
if type == "URL" and validators.url(current, require_tld=True) and not validators.url(default, require_tld=True):
return current
if type == "EMAIL" and validators.email(current) and not validators.email(default):
return current
return default
def check_text(self, text):
if validators.email(text, whitelist=self.whitelist or None):
return True
return False
valid = []
for possible in m:
if check_luhn(possible):
valid.append(possible)
#print('After luhn', len(valid))
return valid
validator_functions = {
'ipv4_address' : validators.ipv4,
'ipv4_network' : validators.ipv4_cidr,
'ipv6_address' : validators.ipv6,
'ipv6_network' : validators.ipv6_cidr,
'domain' : validators.domain,
'email' : validators.email,
'url' : validators.url,
'mac_address' : validators.mac_address,
'md5' : validators.md5,
'sha1' : validators.sha1,
'sha224' : validators.sha224,
'sha256' : validators.sha256,
'sha512' : validators.sha512,
'pan' : credit_card,
}
def guess_item_type(item):
for item_type, function in validator_functions.items():
if function(item):
return item_type
return None
def validate(self, value):
"""
Validate the given string is an email.
Args:
value (str): the string to validate.
"""
super().validate(value)
if not validators.email(value):
raise ValidationError('{!r} is not a valid email'.format(value))
def search_managed_devices(self, device):
if validators.uuid(device):
return list(filter(lambda iter_device: iter_device['userId'] == device or iter_device['id'] == device,
self._call_api("GET", f"deviceManagement/managedDevices")["value"]))
elif validators.email(device):
filtering_params = ['emailAddress']
else:
filtering_params = ['deviceName']
filtering_params = " or ".join(map(lambda param: f"{param} eq '{device}'", filtering_params))
return self._call_api("GET", f"deviceManagement/managedDevices?$filter={filtering_params}")["value"]
# searching for filenames
types = ["exe", "dll", "bat", "sys", "htm", "html", "js", "jar", "jpg",
"png", "vb", "scr", "pif", "chm", "zip", "rar", "cab", "pdf",
"doc", "docx", "ppt", "pptx", "xls", "xlsx", "swf", "gif", "pdb", "cpp"]
salir = False
for pat in types:
if(s.find("." + pat) != -1):
interesting.append(s)
salir = True
break
if salir:
continue
# searching email
if(validators.email(evaluado)):
email.append(s)
continue
# searching url
if(validators.url(evaluado)):
url.append(s)
continue
# searching ips
if(validators.ipv4(evaluado)): # or validators.ipv6(evaluado)):
ip_l.append(s)
continue
# searching registry
if(s.find("HKLM\\") != -1 or s.find("HKCU\\") != -1):
registry.append(s)
def __init__(self, assistant_data, project):
default = "identicon"
size = 45
self.email = assistant_data["coll_email"]
if self.email is not None:
if validators.email(self.email):
gravatar_url = (
"https://www.gravatar.com/avatar/"
+ hashlib.md5(self.email.lower().encode("utf8")).hexdigest()
+ "?"
)
gravatar_url += urllib.parse.urlencode({"d": default, "s": str(size)})
self.gravatarURL = gravatar_url
else:
self.gravatarURL = ""
else:
self.gravatarURL = ""
self.assistantData = assistant_data
self.login = assistant_data["coll_id"]
self.projectID = project
self.fullName = assistant_data["coll_name"]