Some more easy noqas or invalid escape fixes

This commit is contained in:
Shay Nehmad 2020-08-31 18:06:08 +03:00
parent accd6bd0fa
commit 5696c3e536
9 changed files with 16 additions and 15 deletions

View File

@ -7,8 +7,9 @@ import sys
import traceback
from multiprocessing import freeze_support
# dummy import for pyinstaller
# noinspection PyUnresolvedReferences
import infection_monkey.post_breach # dummy import for pyinstaller
import infection_monkey.post_breach # noqa: F401
from common.version import get_version
from infection_monkey.config import EXTERNAL_CONFIG_FILE, WormConfiguration
from infection_monkey.dropper import MonkeyDrops

View File

@ -1,4 +1,4 @@
from infection_monkey.model.host import VictimHost
from infection_monkey.model.host import VictimHost # noqa: F401
__author__ = 'itamar'

View File

@ -12,7 +12,7 @@ __author__ = 'itamar'
PING_COUNT_FLAG = "-n" if "win32" == sys.platform else "-c"
PING_TIMEOUT_FLAG = "-w" if "win32" == sys.platform else "-W"
TTL_REGEX_STR = '(?<=TTL\=)[0-9]+'
TTL_REGEX_STR = r'(?<=TTL\=)[0-9]+'
LINUX_TTL = 64
WINDOWS_TTL = 128

View File

@ -6,7 +6,7 @@ from infection_monkey.network.tools import check_tcp_port
SSH_PORT = 22
SSH_SERVICE_DEFAULT = 'tcp-22'
SSH_REGEX = 'SSH-\d\.\d-OpenSSH'
SSH_REGEX = r'SSH-\d\.\d-OpenSSH'
TIMEOUT = 10
BANNER_READ = 1024
LINUX_DIST_SSH = ['ubuntu', 'debian']

View File

@ -1,5 +1,5 @@
SCHEDULED_TASK_NAME = 'monkey-spawn-cmd'
SCHEDULED_TASK_COMMAND = 'C:\windows\system32\cmd.exe'
SCHEDULED_TASK_COMMAND = r'C:\windows\system32\cmd.exe'
# Commands from: https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1053.005/T1053.005.md

View File

@ -1 +1 @@
from infection_monkey.transport.http import HTTPServer, LockedHTTPServer
from infection_monkey.transport.http import HTTPServer, LockedHTTPServer # noqa: F401

View File

@ -65,7 +65,7 @@ class TcpProxy(TransportProxyBase):
dest = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
dest.connect((self.dest_host, self.dest_port))
except socket.error as ex:
except socket.error:
source.close()
dest.close()
continue

View File

@ -5,8 +5,8 @@ from infection_monkey.utils.linux.hidden_files import (
get_linux_commands_to_delete, get_linux_commands_to_hide_files,
get_linux_commands_to_hide_folders)
from infection_monkey.utils.windows.hidden_files import (
get_winAPI_to_hide_files, get_windows_commands_to_delete,
get_windows_commands_to_hide_files, get_windows_commands_to_hide_folders)
get_windows_commands_to_delete, get_windows_commands_to_hide_files,
get_windows_commands_to_hide_folders)
def get_commands_to_hide_files():

View File

@ -52,12 +52,12 @@ def get_winAPI_to_hide_files():
fileFlags = win32file.FILE_ATTRIBUTE_HIDDEN # make hidden
_ = win32file.CreateFile(HIDDEN_FILE_WINAPI,
fileAccess,
0, # sharing mode: 0 => can't be shared
None, # security attributes
fileCreation,
fileFlags,
0) # template file
fileAccess,
0, # sharing mode: 0 => can't be shared
None, # security attributes
fileCreation,
fileFlags,
0) # template file
return "Succesfully created hidden file: {}".format(HIDDEN_FILE_WINAPI), True
except Exception as err: