File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -78,12 +78,19 @@ def calculate_score(expr)
78
78
case expr
79
79
when / & 0xf/ then 0.95
80
80
when /GOT address/ then 0.9
81
- when /^writable/ then 0.81
82
- when / == NULL$/ then calculate_null_score ( expr . slice ( 0 ... expr . rindex ( ' == NULL' ) ) )
83
- when / <= 0$/ then calculate_null_score ( expr . slice ( 0 ... expr . rindex ( ' <= ' ) ) )
81
+ when /^writable/ then calculate_writable_score ( expr . sub ( 'writable: ' , '' ) )
82
+ when / == NULL$/ then calculate_null_score ( expr . sub ( ' == NULL' , '' ) )
83
+ when / <= 0$/ then calculate_null_score ( expr . sub ( ' <= 0' , '' ) )
84
84
end
85
85
end
86
86
87
+ def calculate_writable_score ( identity )
88
+ lmda = OneGadget ::Emulators ::Lambda . parse ( identity )
89
+ return 0.81 if lmda . deref_count != 0
90
+
91
+ OneGadget ::ABI . stack_register? ( lmda . obj ) ? 0.95 : 0.81
92
+ end
93
+
87
94
def calculate_null_score ( identity )
88
95
# remove <CAST>
89
96
identity . sub! ( /^\( [s|u]\d +\) / , '' )
You can’t perform that action at this time.
0 commit comments