Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
giga-a authored Jan 2, 2025
1 parent 4017ab4 commit 834f98b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tests/test_elastic_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_elastic_server(server_logs):
basic_auth=(USERNAME, PASSWORD),
verify_certs=False,
)
elastic.search(index="test", body={}, size=99)
elastic.search(index="test", body={'size':99})

logs = load_logs_from_file(server_logs)

Expand Down
22 changes: 11 additions & 11 deletions tests/test_telnet_server.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from __future__ import annotations

from telnetlib import Telnet

import pytest
from socket import socket

from honeypots import QTelnetServer
from .utils import (
Expand All @@ -13,6 +12,7 @@
PASSWORD,
USERNAME,
wait_for_server,
connect_to
)

PORT = "50023"
Expand All @@ -23,17 +23,17 @@
[{"server": QTelnetServer, "port": PORT}],
indirect=True,
)

def test_telnet_server(server_logs):
with wait_for_server(PORT):
telnet_client = Telnet(IP, int(PORT))
telnet_client.read_until(b"login: ")
telnet_client.write(USERNAME.encode() + b"\n")
telnet_client.read_until(b"Password: ")
telnet_client.write(PASSWORD.encode() + b"\n")
with wait_for_server(PORT), connect_to(IP, PORT) as connection:
data, _ = connection.recvfrom(10000)
connection.send(USERNAME.encode() + b"\n")
data, _ = connection.recvfrom(10000)
connection.send(PASSWORD.encode() + b"\n")

logs = load_logs_from_file(server_logs)

assert len(logs) == 2
connect, login = logs
assert_connect_is_logged(connect, PORT)
assert_login_is_logged(login)
connect_, login = logs
assert_connect_is_logged(connect_, PORT)
assert_login_is_logged(login)

0 comments on commit 834f98b

Please sign in to comment.