mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-05 09:21:00 +00:00
ruff checked
This commit is contained in:
parent
b845fe9356
commit
c23d2adefa
4
base.py
4
base.py
|
@ -115,7 +115,7 @@ def find_openssl_binpath():
|
||||||
path = result.stdout.decode().strip()
|
path = result.stdout.decode().strip()
|
||||||
if path:
|
if path:
|
||||||
return path
|
return path
|
||||||
except Exception as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return "openssl"
|
return "openssl"
|
||||||
|
@ -143,7 +143,7 @@ class Extension:
|
||||||
module = importlib.import_module(module_path)
|
module = importlib.import_module(module_path)
|
||||||
_class = getattr(module, class_name)
|
_class = getattr(module, class_name)
|
||||||
cls.extensions.append(_class())
|
cls.extensions.append(_class())
|
||||||
except (ImportError, AttributeError) as e:
|
except (ImportError, AttributeError):
|
||||||
raise ImportError(class_name + " in the extension " + module_name)
|
raise ImportError(class_name + " in the extension " + module_name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -124,7 +124,7 @@ class AlwaysOnline(Extension):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.type = "connector" # this is a connector
|
self.type = "connector" # this is a connector
|
||||||
self.connection_type = "alwaysonline"
|
self.connection_type = "alwaysonline"
|
||||||
self.buffer_size = 8192;
|
self.buffer_size = 8192
|
||||||
|
|
||||||
def connect(self, conn, data, webserver, port, scheme, method, url):
|
def connect(self, conn, data, webserver, port, scheme, method, url):
|
||||||
logger.info("[*] Connecting... Connecting...")
|
logger.info("[*] Connecting... Connecting...")
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
# Updated at: 2024-07-02
|
# Updated at: 2024-07-02
|
||||||
#
|
#
|
||||||
|
|
||||||
import json
|
|
||||||
from Bio.Seq import Seq
|
from Bio.Seq import Seq
|
||||||
from Bio.SeqUtils import gc_fraction
|
from Bio.SeqUtils import gc_fraction
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#
|
#
|
||||||
import sys
|
import sys
|
||||||
import nmap
|
import nmap
|
||||||
import json
|
|
||||||
|
|
||||||
from base import Extension
|
from base import Extension
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,11 @@ import base64
|
||||||
import json
|
import json
|
||||||
import ssl
|
import ssl
|
||||||
import time
|
import time
|
||||||
import hashlib
|
|
||||||
import traceback
|
import traceback
|
||||||
import textwrap
|
import textwrap
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from platform import python_version
|
from platform import python_version
|
||||||
|
|
||||||
import re
|
|
||||||
import requests
|
import requests
|
||||||
from requests.auth import HTTPBasicAuth
|
from requests.auth import HTTPBasicAuth
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
@ -35,9 +33,7 @@ from decouple import config
|
||||||
from base import (
|
from base import (
|
||||||
Extension,
|
Extension,
|
||||||
extract_credentials,
|
extract_credentials,
|
||||||
jsonrpc2_create_id,
|
|
||||||
jsonrpc2_encode,
|
jsonrpc2_encode,
|
||||||
jsonrpc2_result_encode,
|
|
||||||
find_openssl_binpath,
|
find_openssl_binpath,
|
||||||
Logger,
|
Logger,
|
||||||
)
|
)
|
||||||
|
@ -467,7 +463,7 @@ def proxy_server(webserver, port, scheme, method, url, conn, addr, data):
|
||||||
result = query.json()["result"]
|
result = query.json()["result"]
|
||||||
resolved_address_list.append(result["data"])
|
resolved_address_list.append(result["data"])
|
||||||
logger.info("[*] resolved IP: %s" % (result["data"]))
|
logger.info("[*] resolved IP: %s" % (result["data"]))
|
||||||
except requests.exceptions.ReadTimeout as e:
|
except requests.exceptions.ReadTimeout:
|
||||||
pass
|
pass
|
||||||
proxy_data["data"]["client_address"] = resolved_address_list[0]
|
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)
|
logger.info("[*] waiting for the relay... %s" % id)
|
||||||
max_reties = 30
|
max_reties = 30
|
||||||
t = 0
|
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)
|
time.sleep(1)
|
||||||
t += 1
|
t += 1
|
||||||
if t < max_reties:
|
if t < max_reties:
|
||||||
|
|
5
smtp.py
5
smtp.py
|
@ -11,20 +11,15 @@
|
||||||
#
|
#
|
||||||
import asyncio
|
import asyncio
|
||||||
from aiosmtpd.controller import Controller
|
from aiosmtpd.controller import Controller
|
||||||
from aiosmtpd.handlers import Message
|
|
||||||
from email.message import EmailMessage
|
from email.message import EmailMessage
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
|
||||||
import requests
|
import requests
|
||||||
from platform import python_version
|
from platform import python_version
|
||||||
from decouple import config
|
from decouple import config
|
||||||
from requests.auth import HTTPBasicAuth
|
from requests.auth import HTTPBasicAuth
|
||||||
from base import (
|
from base import (
|
||||||
extract_credentials,
|
extract_credentials,
|
||||||
jsonrpc2_create_id,
|
|
||||||
jsonrpc2_encode,
|
jsonrpc2_encode,
|
||||||
jsonrpc2_result_encode,
|
|
||||||
Logger,
|
Logger,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user