-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
227 lines (185 loc) · 7.4 KB
/
main.py
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
import click
import re
import time
import random
import pyfiglet
import os
from modules.floating_pragma import *
from modules.utils.parse_contract_util import parse_contract
from modules.selfdestruct import selfdestruct
from modules.re_entrancy import *
from modules.unchecked_external_call import *
from modules.wrong_constructor_name import *
from modules.stored_credentials import *
from modules.insec_randomsource import *
from modules.tx_origin import *
from modules.assembly import *
from modules.delegate_call import *
#from modules.block_timestamp import *
from modules.ether_lock import *
from modules.delegate_call import *
from modules.utils.remove_comments import *
from modules.integer_underflow_overflow import *
from modules.rtlo import *
from modules.multiple_constructors import *
from modules.dynamic_array_length import *
from modules.utils.banner import *
from modules.looped_calls import *
from modules.hash_colission import *
from modules.functions_default_visibility import *
from modules.assert_violation import *
from modules.arbitraryfrom import *
from modules.bad_assignment_operator import *
from modules.depr_blockhash import *
from modules.depr_msggas import *
from modules.depr_now import *
from modules.depr_now import *
from modules.depr_sha3 import *
from modules.depr_throw import *
from modules.multidigits import *
from modules.strict_equality import *
@click.group()
def mycommands():
pass
def update_bar(progress_bar_iterator):
progress_bar_iterator.update(1)
print("\n")
time.sleep(0.1)
@click.command('scan', help="scan contract")
@click.argument('contract', type=click.Path(exists=True), required=1)
def scan_contract(contract):
print_banner(contract)
with click.progressbar(length=30, label="Running checks") as bar:
print("\n")
for i in range(30):
pass
update_bar(bar)
print('''
======================================
RESULTS
======================================
''')
try:
arbitraryfrom(contract)
except:
print("An error occured while checking arbitrary form. This vulnerability class was NOT checked.")
try:
assembly(contract)
except:
print("An error occured while checking assembly. This vulnerability class was NOT checked.")
try:
assert_violation(contract)
except:
print("An error occured while checking assert violation. This vulnerability class was NOT checked.")
try:
bad_assignment_operator(contract)
except:
print("An error occured while checking bad assignment operator. This vulnerability class was NOT checked.")
try:
block_timestamp(contract)
except:
print("An error occured while checking block timestamp. This vulnerability class was NOT checked.")
try:
delegate_call(contract)
except:
print("An error occured while checking delegate call. This vulnerability class was NOT checked.")
try:
blockhash(contract)
except:
print("An error occured while checking blockhash. This vulnerability class was NOT checked.")
try:
callcode(contract)
except:
print("An error occured while checking callcode. This vulnerability class was NOT checked.")
try:
msggas(contract)
except:
print("An error occured while checking msggas. This vulnerability class was NOT checked.")
try:
now(contract)
except:
print("An error occured while checking now. This vulnerability class was NOT checked.")
try:
sha3(contract)
except:
print("An error occured while checking sha3. This vulnerability class was NOT checked.")
try:
throw(contract)
except:
print("An error occured while checking throw. This vulnerability class was NOT checked.")
try:
dynamic_array_length(contract)
except:
print("An error occured while checking dynamic array length. This vulnerability class was NOT checked.")
try:
ether_lock(contract)
except:
print("An error occured while checking integer ether lock. This vulnerability class was NOT checked.")
try:
floating_pragma(contract)
except:
print("An error occured while checking floating pragma. This vulnerability class was NOT checked.")
try:
function_default_visibility(contract)
except:
print("An error occured while checking function default visibility. This vulnerability class was NOT checked.")
try:
hash_colission(contract)
except:
print("An error occured while checking hash colission. This vulnerability class was NOT checked.")
try:
insec_randomsource(contract)
except:
print("An error occured while checking insec randomsource. This vulnerability class was NOT checked.")
try:
integer_underflow_overflow(contract)
except:
print("An error occured while checking integer under/overflow. This vulnerability class was NOT checked.")
try:
looped_calls(contract)
except:
print("An error occured while checking looped calls. This vulnerability class was NOT checked.")
try:
multidigit(contract)
except:
print("An error occured while checking multidigit. This vulnerability class was NOT checked.")
try:
multiple_constructors(contract)
except:
print("An error occured while checking multiple constructors. This vulnerability class was NOT checked.")
try:
re_entrancy(contract)
except:
print("An error occured while checking reentrancy. This vulnerability class was NOT checked.")
try:
rtlo(contract)
except:
print("An error occured while checking rtlo. This vulnerability class was NOT checked.")
try:
selfdestruct(contract)
except:
print("An error occured while checking selfdestruct. This vulnerability class was NOT checked.")
try:
stored_credentials(contract)
except:
print("An error occured while checking stored credentials. This vulnerability class was NOT checked.")
try:
strict_equality(contract)
except:
print("An error occured while checking strict equality This vulnerability class was NOT checked.")
try:
tx_origin(contract)
except:
print("An error occured while checking tx origin. This vulnerability class was NOT checked.")
try:
unchecked_external_call(contract)
except:
print("An error occured while checking unchecked external call. This vulnerability class was NOT checked.")
try:
wrong_constructor_name(contract)
except:
print("An error occured while checking wrong constructor name. This vulnerability class was NOT checked.")
click.echo("Scan completed. See results above.")
mycommands.add_command(scan_contract)
if __name__ == '__main__':
mycommands()