forked from p34709852/monkey
PEP8 + Python exception
This commit is contained in:
parent
b668a0d0f3
commit
a2b1b78f0b
|
@ -1,17 +1,17 @@
|
||||||
|
import argparse
|
||||||
|
import ctypes
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import pprint
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import ctypes
|
|
||||||
import shutil
|
|
||||||
import pprint
|
|
||||||
import logging
|
|
||||||
import subprocess
|
|
||||||
import argparse
|
|
||||||
from ctypes import c_char_p
|
from ctypes import c_char_p
|
||||||
|
|
||||||
|
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
|
||||||
from config import WormConfiguration
|
|
||||||
from system_info import SystemInfoCollector, OperatingSystem
|
from system_info import SystemInfoCollector, OperatingSystem
|
||||||
|
|
||||||
if "win32" == sys.platform:
|
if "win32" == sys.platform:
|
||||||
|
@ -65,7 +65,7 @@ class MonkeyDrops(object):
|
||||||
self._config['destination_path'])
|
self._config['destination_path'])
|
||||||
|
|
||||||
LOG.info("Moved source file '%s' into '%s'",
|
LOG.info("Moved source file '%s' into '%s'",
|
||||||
self._config['source_path'], self._config['destination_path'])
|
self._config['source_path'], self._config['destination_path'])
|
||||||
|
|
||||||
file_moved = True
|
file_moved = True
|
||||||
except (WindowsError, IOError, OSError) as exc:
|
except (WindowsError, IOError, OSError) as exc:
|
||||||
|
@ -80,7 +80,7 @@ class MonkeyDrops(object):
|
||||||
self._config['destination_path'])
|
self._config['destination_path'])
|
||||||
|
|
||||||
LOG.info("Copied source file '%s' into '%s'",
|
LOG.info("Copied source file '%s' into '%s'",
|
||||||
self._config['source_path'], self._config['destination_path'])
|
self._config['source_path'], self._config['destination_path'])
|
||||||
except (WindowsError, IOError, OSError) as exc:
|
except (WindowsError, IOError, OSError) as exc:
|
||||||
LOG.error("Error copying source file '%s' into '%s': %s",
|
LOG.error("Error copying source file '%s' into '%s': %s",
|
||||||
self._config['source_path'], self._config['destination_path'],
|
self._config['source_path'], self._config['destination_path'],
|
||||||
|
@ -95,7 +95,7 @@ class MonkeyDrops(object):
|
||||||
dropper_date_reference_path = WormConfiguration.dropper_date_reference_path_linux
|
dropper_date_reference_path = WormConfiguration.dropper_date_reference_path_linux
|
||||||
try:
|
try:
|
||||||
ref_stat = os.stat(dropper_date_reference_path)
|
ref_stat = os.stat(dropper_date_reference_path)
|
||||||
except:
|
except OSError as exc:
|
||||||
LOG.warn("Cannot set reference date using '%s', file not found",
|
LOG.warn("Cannot set reference date using '%s', file not found",
|
||||||
dropper_date_reference_path)
|
dropper_date_reference_path)
|
||||||
else:
|
else:
|
||||||
|
@ -142,10 +142,10 @@ class MonkeyDrops(object):
|
||||||
|
|
||||||
# mark the file for removal on next boot
|
# mark the file for removal on next boot
|
||||||
dropper_source_path_ctypes = c_char_p(self._config['source_path'])
|
dropper_source_path_ctypes = c_char_p(self._config['source_path'])
|
||||||
if 0 == ctypes.windll.kernel32.MoveFileExA( dropper_source_path_ctypes, None,
|
if 0 == ctypes.windll.kernel32.MoveFileExA(dropper_source_path_ctypes, None,
|
||||||
MOVEFILE_DELAY_UNTIL_REBOOT):
|
MOVEFILE_DELAY_UNTIL_REBOOT):
|
||||||
LOG.debug("Error marking source file '%s' for deletion on next boot (error %d)",
|
LOG.debug("Error marking source file '%s' for deletion on next boot (error %d)",
|
||||||
self._config['source_path'], ctypes.windll.kernel32.GetLastError())
|
self._config['source_path'], ctypes.windll.kernel32.GetLastError())
|
||||||
else:
|
else:
|
||||||
LOG.debug("Dropper source file '%s' is marked for deletion on next boot",
|
LOG.debug("Dropper source file '%s' is marked for deletion on next boot",
|
||||||
self._config['source_path'])
|
self._config['source_path'])
|
||||||
|
|
Loading…
Reference in New Issue