Skip to content

Commit

Permalink
fix: #240 (#245)
Browse files Browse the repository at this point in the history
* fix: #240
  • Loading branch information
13ph03nix authored Dec 9, 2021
1 parent 4e62e65 commit 33f53b7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PyLint
on: [pull_request]

jobs:
build:
pylint:
strategy:
matrix:
python-version: ['3.10']
Expand Down
1 change: 1 addition & 0 deletions pocsuite3/lib/core/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
logging.addLevelName(CUSTOM_LOGGING.WARNING, "!")

LOGGER = logging.getLogger("pocsuite")
sys.stdout = open(sys.stdout.fileno(), mode='w', encoding='utf8', buffering=1)
LOGGER_HANDLER = logging.StreamHandler(sys.stdout)
PRIMARY_FMT = (
"%(cyan)s[%(asctime)s] %(log_color)s[%(levelname)s]%(reset)s %(message)s"
Expand Down
1 change: 0 additions & 1 deletion tests/login_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def _verify(self):
result = {}
payload = "username={0}&password={1}".format(self.get_option("username"), self.get_option("password"))
r = requests.post(self.url, data=payload)
print(r.text)
if r.status_code == 200:
result['VerifyInfo'] = {}
result['VerifyInfo']['URL'] = self.url
Expand Down
9 changes: 6 additions & 3 deletions tests/test_cmd_diy_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def test_cmd_run(self):

eval_path = os.path.join(path, "../pocsuite3/cli.py")
poc_path = os.path.join(path, "login_demo.py")
command = '''python3 {0} -u http://www.baidu.com -r {1} --verify -v 2 --password mypass123 --username "asd asd" --testt abctest'''.format(
eval_path, poc_path)
command = (
f'python3 {eval_path} -u http://www.baidu.com -r {poc_path} --verify -v 2 --password mypass123 '
'--username "asd asd" --testt abctest'
)
pipeline = os.popen(command)
self.assertTrue('1 / 1' in pipeline.read())
res = pipeline.buffer.read().decode('utf-8')
self.assertTrue('1 / 1' in res)
7 changes: 5 additions & 2 deletions tests/test_show_poc_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def verify_result(self):
pass

def test_cmd_run(self):
command = 'pocsuite -r ecshop_rce.py --options'
res = os.popen(command).read()
pipeline = os.popen('pocsuite -r ecshop_rce.py --options')

# os.popen default encoding may not be utf-8
res = pipeline.buffer.read().decode('utf-8')

self.assertTrue('You can select dict_keys' in res)

0 comments on commit 33f53b7

Please sign in to comment.