From c23d2adefab46233fb29b84aa5e5f9be0467be69 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Wed, 31 Jul 2024 15:39:48 +0900 Subject: [PATCH] ruff checked --- base.py | 4 ++-- plugins/alwaysonline.py | 2 +- plugins/bio.py | 1 - plugins/portscanner.py | 1 - server.py | 8 ++------ smtp.py | 5 ----- 6 files changed, 5 insertions(+), 16 deletions(-) diff --git a/base.py b/base.py index a844456..8816905 100644 --- a/base.py +++ b/base.py @@ -115,7 +115,7 @@ def find_openssl_binpath(): path = result.stdout.decode().strip() if path: return path - except Exception as e: + except Exception: pass return "openssl" @@ -143,7 +143,7 @@ class Extension: module = importlib.import_module(module_path) _class = getattr(module, class_name) cls.extensions.append(_class()) - except (ImportError, AttributeError) as e: + except (ImportError, AttributeError): raise ImportError(class_name + " in the extension " + module_name) @classmethod diff --git a/plugins/alwaysonline.py b/plugins/alwaysonline.py index b9308dd..6402e01 100644 --- a/plugins/alwaysonline.py +++ b/plugins/alwaysonline.py @@ -124,7 +124,7 @@ class AlwaysOnline(Extension): def __init__(self): self.type = "connector" # this is a connector self.connection_type = "alwaysonline" - self.buffer_size = 8192; + self.buffer_size = 8192 def connect(self, conn, data, webserver, port, scheme, method, url): logger.info("[*] Connecting... Connecting...") diff --git a/plugins/bio.py b/plugins/bio.py index 3e1b4fd..1633ae6 100644 --- a/plugins/bio.py +++ b/plugins/bio.py @@ -9,7 +9,6 @@ # Updated at: 2024-07-02 # -import json from Bio.Seq import Seq from Bio.SeqUtils import gc_fraction diff --git a/plugins/portscanner.py b/plugins/portscanner.py index b8c260f..a0421c4 100644 --- a/plugins/portscanner.py +++ b/plugins/portscanner.py @@ -11,7 +11,6 @@ # import sys import nmap -import json from base import Extension diff --git a/server.py b/server.py index 2d23dab..6734d0c 100644 --- a/server.py +++ b/server.py @@ -20,13 +20,11 @@ import base64 import json import ssl import time -import hashlib import traceback import textwrap from datetime import datetime from platform import python_version -import re import requests from requests.auth import HTTPBasicAuth from urllib.parse import urlparse @@ -35,9 +33,7 @@ from decouple import config from base import ( Extension, extract_credentials, - jsonrpc2_create_id, jsonrpc2_encode, - jsonrpc2_result_encode, find_openssl_binpath, Logger, ) @@ -467,7 +463,7 @@ def proxy_server(webserver, port, scheme, method, url, conn, addr, data): result = query.json()["result"] resolved_address_list.append(result["data"]) logger.info("[*] resolved IP: %s" % (result["data"])) - except requests.exceptions.ReadTimeout as e: + except requests.exceptions.ReadTimeout: pass proxy_data["data"]["client_address"] = resolved_address_list[0] @@ -503,7 +499,7 @@ def proxy_server(webserver, port, scheme, method, url, conn, addr, data): logger.info("[*] waiting for the relay... %s" % id) max_reties = 30 t = 0 - while t < max_reties and not id in accepted_relay: + while t < max_reties and id not in accepted_relay: time.sleep(1) t += 1 if t < max_reties: diff --git a/smtp.py b/smtp.py index b005b03..23d6536 100644 --- a/smtp.py +++ b/smtp.py @@ -11,20 +11,15 @@ # import asyncio from aiosmtpd.controller import Controller -from aiosmtpd.handlers import Message from email.message import EmailMessage -import re import sys -import json import requests from platform import python_version from decouple import config from requests.auth import HTTPBasicAuth from base import ( extract_credentials, - jsonrpc2_create_id, jsonrpc2_encode, - jsonrpc2_result_encode, Logger, )