Skip to content

Commit c9e0c71

Browse files
committed
Adds cleanup method
1 parent 744188f commit c9e0c71

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/exploits/linux/http/pivotx_index_php_overwrite.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,18 @@ def restore
144144
vprint_error('Failed to restore original content') unless res&.code == 200 && res.body.include?('Wrote contents to file index.php')
145145
end
146146

147+
def cleanup
148+
super
149+
# original content can be any string, it cannot be nil
150+
restore if @original_value.nil?
151+
end
152+
147153
def exploit
148154
vprint_status('Logging in PivotX')
149155
login
150156
vprint_status('Modifying file and injecting payload')
151157
modify_file
152158
vprint_status('Triggering payload')
153159
trigger_payload
154-
restore
155160
end
156161
end

0 commit comments

Comments
 (0)