refactor: small perflint improvements

main
Marshall Hallenbeck 2023-05-05 14:37:20 -04:00
parent 574fc5a212
commit 788701cb2c
2 changed files with 7 additions and 10 deletions

View File

@ -28,7 +28,7 @@
# #
import logging import logging
import os from os.path import join as path_join
from time import sleep from time import sleep
from cme.helpers.misc import gen_random_string from cme.helpers.misc import gen_random_string
@ -241,7 +241,7 @@ class MMCEXEC:
while True: while True:
try: try:
with open( with open(
os.path.join("/tmp", "cme_hosted", self.__output), "r" path_join("/tmp", "cme_hosted", self.__output), "r"
) as output: ) as output:
self.output_callback(output.read()) self.output_callback(output.read())
break break

View File

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
from os.path import join as path_join
from time import sleep from time import sleep
from impacket.dcerpc.v5 import transport, scmr from impacket.dcerpc.v5 import transport, scmr
from cme.helpers.misc import gen_random_string from cme.helpers.misc import gen_random_string
@ -120,9 +121,7 @@ class SMBEXEC:
else: else:
command = self.__shell + data command = self.__shell + data
with open( with open(path_join("/tmp", "cme_hosted", self.__batchFile), "w") as batch_file:
os.path.join("/tmp", "cme_hosted", self.__batchFile), "w"
) as batch_file:
batch_file.write(command) batch_file.write(command)
self.logger.debug("Hosting batch file with command: " + command) self.logger.debug("Hosting batch file with command: " + command)
@ -168,7 +167,7 @@ class SMBEXEC:
sleep(2) sleep(2)
pass pass
else: else:
logger.debug(e) self.logger.debug(e)
pass pass
self.__smbconnection.deleteFile(self.__share, self.__output) self.__smbconnection.deleteFile(self.__share, self.__output)
@ -187,9 +186,7 @@ class SMBEXEC:
else: else:
command = self.__shell + data command = self.__shell + data
with open( with open(path_join("/tmp", "cme_hosted", self.__batchFile), "w") as batch_file:
os.path.join("/tmp", "cme_hosted", self.__batchFile), "w"
) as batch_file:
batch_file.write(command) batch_file.write(command)
self.logger.debug("Hosting batch file with command: " + command) self.logger.debug("Hosting batch file with command: " + command)
@ -227,7 +224,7 @@ class SMBEXEC:
while True: while True:
try: try:
with open( with open(
os.path.join("/tmp", "cme_hosted", self.__output), "rb" path_join("/tmp", "cme_hosted", self.__output), "rb"
) as output: ) as output:
self.output_callback(output.read()) self.output_callback(output.read())
break break