Skip to content

Commit

Permalink
Merge pull request #82 from italovalcy/main
Browse files Browse the repository at this point in the history
returning template as bytes according to twisted.web.resource.render
  • Loading branch information
giga-a authored Dec 31, 2024
2 parents 238c673 + 08445c6 commit 538390c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install OS dependencies
run: sudo apt-get install -y --no-install-recommends freetds-dev libkrb5-dev
- name: Install dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: Installation
Expand Down
15 changes: 2 additions & 13 deletions honeypots/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import psutil
from OpenSSL import crypto
from psutil import process_iter
#from psycopg2 import connect as psycopg2_connect, sql


def set_up_error_logging():
Expand Down Expand Up @@ -249,17 +248,6 @@ def __init__( # noqa: PLR0913
self.logs = logs
self.uuid = uuid
self.custom_filter = custom_filter
if config and "db_postgres_removed" in self.logs:
parsed = urlparse(config["postgres"])
#self.db["db_postgres"] = PostgresClass(
# host=parsed.hostname,
# port=parsed.port,
# username=parsed.username,
# password=parsed.password,
# db=parsed.path[1:],
# uuid=self.uuid,
# drop=drop,
####
if config and "db_sqlite" in self.logs:
self.db["db_sqlite"] = SqliteClass(
file=config["sqlite_file"], drop=drop, uuid=self.uuid
Expand Down Expand Up @@ -303,6 +291,7 @@ def emit(self, record: LogRecord): # noqa: C901,PLR0912
stdout.write(f"{json.dumps(log_entry, sort_keys=True, cls=ComplexEncoder)}\n")
stdout.flush()


class SqliteClass:
def __init__(self, file=None, drop=False, uuid=None):
self.file = file
Expand Down Expand Up @@ -501,7 +490,7 @@ def check_bytes(string: Any) -> str:

def load_template(filename: str) -> str:
file_path = Path(__file__).parent / "data" / filename
return file_path.read_text()
return file_path.read_bytes()


def get_headers_and_ip_from_request(request, options):
Expand Down

0 comments on commit 538390c

Please sign in to comment.