Skip to content

Commit

Permalink
Do HTML unescape after submitted. Check the stdin and stdout for the …
Browse files Browse the repository at this point in the history
…tamperer process.
  • Loading branch information
Marven11 committed Jul 26, 2023
1 parent d86265b commit abcec4d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fenjing/submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from urllib.parse import quote
import logging
import subprocess
import html

from .form import Form, fill_form
from .requester import Requester
Expand All @@ -23,6 +24,7 @@ def tamperer(payload: str):
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
)
assert proc.stdin and proc.stdout
proc.stdin.write(payload.encode())
proc.stdin.close()
ret = proc.wait()
Expand Down Expand Up @@ -71,8 +73,10 @@ def submit(self, payload: str) -> Union[HTTPResponse, None]:
for tamperer in self.tamperers:
payload = tamperer(payload)
logger.debug("Submit %s", colored("blue", payload))
return self.submit_raw(payload)

resp = self.submit_raw(payload)
if resp is None:
return None
return HTTPResponse(resp.status_code, html.unescape(resp.text))

class FormSubmitter(BaseSubmitter):
"""
Expand Down

0 comments on commit abcec4d

Please sign in to comment.