-
Notifications
You must be signed in to change notification settings - Fork 0
/
vargenerator.py
89 lines (72 loc) · 2.33 KB
/
vargenerator.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
class Generator:
def __init__(self):
self.countstack = 0
self.countdata = 0
self.count = 0
def gen_stack_var(self):
self.countstack += 1
return "s" + str(self.countstack)
def gen_data_var(self):
self.countdata += 1
return "Id_" + str(self.countdata)
def gen_data_var(self, position):
self.countdata += 1
return "Id_" + str(self.countdata)
def gen_data_size(self):
return "Id_size"
def gen_mem_var(self, address):
return "mem_" + str(address)
def gen_arbitrary_var(self):
self.count += 1
return "some_var_" + str(self.count)
def gen_arbitary_hash_var(self):
self.count += 1
return "some_hash_" + str(self.count)
def gen_arbitrary_address_var(self):
self.count += 1
return "some_address_" + str(self.count)
def gen_owner_store_var(self, position, var_name=""):
return "Ia_store-%s-%s" % (str(position), var_name)
def gen_gas_var(self):
self.count += 1
return "gas_" + str(self.count)
def gen_gas_price_var(self):
return "Ip"
def gen_address_var(self):
return "Ia"
def gen_caller_var(self):
return "Is"
def gen_origin_var(self):
return "Io"
def gen_balance_var(self):
self.count += 1
return "balance_" + str(self.count)
def gen_code_var(self, address, position, bytecount):
return "code_" + str(address) + "_" + str(position) + "_" + str(bytecount)
def gen_code_size_var(self, address):
return "code_size_" + str(address)
def checkArtificial(self, var):
flag = False
var = str(var)
# if "Id_" in var:
# flag = True
# elif "mem_" in var:
# flag = True
# elif "some_var_" in var:
# flag = True
# elif "some_address_" in var:
# flag = True
# elif "Ia_store-" in var:
# flag = True
# elif "gas_" in var:
# flag = True
# elif "Ip" in var or "Ia" in var or "Io" in var or "Is" in var:
# flag = True
# elif "balance_" in var:
# flag = True
# elif "code_" in var:
# flag = True
if "some_hash_" in var:
flag = True
flag = False
return flag