-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy path__init__.py
More file actions
71 lines (43 loc) · 1.7 KB
/
__init__.py
File metadata and controls
71 lines (43 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""
Exports different types of Aikido Exception
"""
from aikido_zen.helpers.attack_human_name import attack_human_name
def generate_default_message(kind):
"""Generates a default message based on kind of attack"""
return "Zen has blocked " + attack_human_name(kind)
class AikidoException(Exception):
"""General AikidoException class"""
kind = None
def __init__(self, message=None):
if isinstance(message, str):
super().__init__(self, message)
else:
super().__init__(self, generate_default_message(self.kind))
class AikidoSQLInjection(AikidoException):
"""Exception because of SQL Injection"""
def __init__(self, dialect="unknown"):
super().__init__(
generate_default_message("sql_injection") + ", dialect: " + dialect
)
class AikidoNoSQLInjection(AikidoException):
"""Exception because of NoSQL Injection"""
kind = "nosql_injection"
class AikidoRateLimiting(AikidoException):
"""Exception caused when a page was rate limited"""
def __init__(self, message="You are rate limited by Zen."):
super().__init__(message)
self.message = message
class AikidoShellInjection(AikidoException):
"""Exception becausen of Shell Injection"""
kind = "shell_injection"
class AikidoPathTraversal(AikidoException):
"""Exception because of a path traversal"""
kind = "path_traversal"
class AikidoSSRF(AikidoException):
"""Exception because of SSRF"""
kind = "ssrf"
class AikidoIDOR(AikidoException):
"""Exception because of an IDOR vulnerability (missing or wrong tenant filter)"""
def __init__(self, message):
super().__init__(message)
self.message = message