Fixed more warnings and lowered the linter upper limit to double digits

This commit is contained in:
Shay Nehmad 2020-08-31 14:40:03 +03:00
parent b26727d5e0
commit f23199c4a3
4 changed files with 7 additions and 11 deletions

View File

@ -72,7 +72,7 @@ script:
## Display the linter issues
- cat flake8_warnings.txt
## Make sure that we haven't increased the amount of warnings.
- PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT=120
- PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT=90
- if [ $(tail -n 1 flake8_warnings.txt) -gt $PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many python linter warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi
## Check import order

View File

@ -44,7 +44,7 @@ class CommunicateAsNewUser(PBA):
@staticmethod
def get_random_new_user_name():
return USERNAME_PREFIX + ''.join(random.choice(string.ascii_lowercase) for _ in range(5))
return USERNAME_PREFIX + ''.join(random.choice(string.ascii_lowercase) for _ in range(5)) # noqa: DUO102
@staticmethod
def get_commandline_for_http_request(url, is_windows=is_windows_os()):

View File

@ -7,14 +7,10 @@ from infection_monkey.system_info.windows_cred_collector.mimikatz_cred_collector
MimikatzCredentialCollector
sys.coinit_flags = 0 # needed for proper destruction of the wmi python module
# noinspection PyPep8
import infection_monkey.config
# noinspection PyPep8
from common.utils.wmi_utils import WMIUtils
# noinspection PyPep8
from infection_monkey.system_info import InfoCollector
# noinspection PyPep8
from infection_monkey.system_info.wmi_consts import WMI_CLASSES
import infection_monkey.config # noqa: E402
from common.utils.wmi_utils import WMIUtils # noqa: E402
from infection_monkey.system_info import InfoCollector # noqa: E402
from infection_monkey.system_info.wmi_consts import WMI_CLASSES # noqa: E402
LOG = logging.getLogger(__name__)
LOG.info('started windows info collector')

View File

@ -51,7 +51,7 @@ def get_winAPI_to_hide_files():
fileCreation = win32file.CREATE_ALWAYS # overwrite existing file
fileFlags = win32file.FILE_ATTRIBUTE_HIDDEN # make hidden
hiddenFile = win32file.CreateFile(HIDDEN_FILE_WINAPI,
_ = win32file.CreateFile(HIDDEN_FILE_WINAPI,
fileAccess,
0, # sharing mode: 0 => can't be shared
None, # security attributes