From ce1d2a08149f1e06c4f7f17e3d0e5723407aa38d Mon Sep 17 00:00:00 2001 From: Marshall Hallenbeck Date: Thu, 26 Oct 2023 18:26:44 -0400 Subject: [PATCH] ruff: linting stuff (some was from my conflict resolution I messed up) --- nxc/protocols/ftp.py | 10 +++++----- nxc/protocols/ssh.py | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/nxc/protocols/ftp.py b/nxc/protocols/ftp.py index 8ae36cbf..a6a2b35b 100644 --- a/nxc/protocols/ftp.py +++ b/nxc/protocols/ftp.py @@ -1,9 +1,9 @@ +import os from nxc.config import process_secret from nxc.connection import connection from nxc.helpers.logger import highlight from nxc.logger import NXCAdapter -from ftplib import FTP - +from ftplib import FTP, error_perm class ftp(connection): def __init__(self, args, db, host): @@ -126,7 +126,7 @@ class ftp(connection): def get_file(self, filename): # Extract the filename from the path - downloaded_file = filename.split("/")[-1] + downloaded_file = filename.split("/")[-1] try: # Check if the current connection is ASCII (ASCII does not support .size()) if self.conn.encoding == "utf-8": @@ -135,7 +135,7 @@ class ftp(connection): # Check if the file exists self.conn.size(filename) # Attempt to download the file - self.conn.retrbinary(f"RETR {filename}", open(downloaded_file, "wb").write) + self.conn.retrbinary(f"RETR {filename}", open(downloaded_file, "wb").write) #noqa: SIM115 except error_perm as error_message: self.logger.fail(f"Failed to download the file. Response: ({error_message})") self.conn.close() @@ -155,7 +155,7 @@ class ftp(connection): def put_file(self, local_file, remote_file): try: # Attempt to upload the file - self.conn.storbinary(f"STOR {remote_file}", open(local_file, "rb")) + self.conn.storbinary(f"STOR {remote_file}", open(local_file, "rb")) #noqa: SIM115 except error_perm as error_message: self.logger.fail(f"Failed to upload file. Response: ({error_message})") return False diff --git a/nxc/protocols/ssh.py b/nxc/protocols/ssh.py index 850bab5b..96a0ff8d 100644 --- a/nxc/protocols/ssh.py +++ b/nxc/protocols/ssh.py @@ -1,6 +1,3 @@ -import logging - -from io import StringIO import paramiko import re import uuid