Merge pull request #156 from VakarisZ/dropper_samefile_fix

Dropper bug fix
This commit is contained in:
Daniel Goldberg 2018-07-18 20:53:52 +03:00 committed by GitHub
commit 3e1edeac61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import sys
import time import time
from ctypes import c_char_p from ctypes import c_char_p
import filecmp
from config import WormConfiguration from config import WormConfiguration
from exploit.tools import build_monkey_commandline_explicitly from exploit.tools import build_monkey_commandline_explicitly
from model import MONKEY_CMDLINE_WINDOWS, MONKEY_CMDLINE_LINUX, GENERAL_CMDLINE_LINUX from model import MONKEY_CMDLINE_WINDOWS, MONKEY_CMDLINE_LINUX, GENERAL_CMDLINE_LINUX
@ -56,7 +57,10 @@ class MonkeyDrops(object):
return False return False
# we copy/move only in case path is different # we copy/move only in case path is different
file_moved = os.path.samefile(self._config['source_path'], self._config['destination_path']) try:
file_moved = filecmp.cmp(self._config['source_path'], self._config['destination_path'])
except OSError:
file_moved = False
if not file_moved and os.path.exists(self._config['destination_path']): if not file_moved and os.path.exists(self._config['destination_path']):
os.remove(self._config['destination_path']) os.remove(self._config['destination_path'])