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 615f92e commit 4017ab4
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions honeypots/base_http_server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from abc import ABC
from cgi import FieldStorage
from urllib.parse import parse_qs
from contextlib import suppress
from random import choice

Expand Down Expand Up @@ -95,20 +95,10 @@ def render(self, request):
and self.hp_server.username != ""
and self.hp_server.password != ""
):
form = FieldStorage(
fp=request.content,
headers=self.headers,
environ={
"REQUEST_METHOD": "POST",
"CONTENT_TYPE": self.headers.get(
b"content-type",
b"application/x-www-form-urlencoded",
),
},
)
if "username" in form and "password" in form:
username = check_bytes(form["username"].value)
password = check_bytes(form["password"].value)
form = parse_qs(request.content.read(int(self.headers.get(b"content-length"))))
if b"username" in form and b"password" in form:
username = check_bytes(form[b"username"][0])
password = check_bytes(form[b"password"][0])
self.hp_server.check_login(
username, password, client_ip, request.getClientAddress().port
)
Expand Down

0 comments on commit 4017ab4

Please sign in to comment.