From 70f61bbc0d0e4a7ba72b9ae472e30376de595444 Mon Sep 17 00:00:00 2001 From: wh0am1i Date: Sun, 28 Apr 2024 18:01:30 +0800 Subject: [PATCH] update actions/checkout version & feat: add html plugins copy result button and seebug api error --- .github/workflows/test.yml | 12 ++-- pocsuite3/__init__.py | 2 +- pocsuite3/lib/controller/controller.py | 7 ++- pocsuite3/plugins/html_report.py | 86 +++++++++++++++++++------- setup.py | 2 +- tests/test_api_diy_options.py | 2 +- 6 files changed, 81 insertions(+), 30 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c02aff42..3ddd5304 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,26 +5,28 @@ jobs: test: strategy: matrix: - python-version: [3.7, '3.10'] + python-version: ['3.9', '3.11'] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} timeout-minutes: 30 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Cache for pip - uses: actions/cache@v1 + uses: actions/cache@v4 id: cache-pip with: path: ~/.cache/pip key: ${{ matrix.os }}-cache-pip - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies & Test run: | + pip install --upgrade pip + pip install --upgrade setuptools pip install --upgrade -r requirements.txt python setup.py install - python test.py + python test.py \ No newline at end of file diff --git a/pocsuite3/__init__.py b/pocsuite3/__init__.py index ff2d7367..ef74089b 100644 --- a/pocsuite3/__init__.py +++ b/pocsuite3/__init__.py @@ -1,5 +1,5 @@ __title__ = 'pocsuite3' -__version__ = '2.0.8' +__version__ = '2.0.9' __author__ = 'Knownsec 404 Team' __author_email__ = '404-team@knownsec.com' __license__ = 'GPLv2' diff --git a/pocsuite3/lib/controller/controller.py b/pocsuite3/lib/controller/controller.py index 80563caf..b0055950 100644 --- a/pocsuite3/lib/controller/controller.py +++ b/pocsuite3/lib/controller/controller.py @@ -136,8 +136,13 @@ def task_run(): else: logger.warn("No libpcap is detected, and the poc will continue to execute without fetching the packet") conf.pcap = False + info_msg = "running poc:'{0}' target '{1}'".format( + poc_name, + mosaic(target) + ) - info_msg = "running poc:'{0}' target '{1}'".format(poc_name, mosaic(target)) + if len(kb.targets) > 1: + info_msg += ", {0} tasks waiting to be executed.".format(kb.task_queue.qsize()) logger.info(info_msg) diff --git a/pocsuite3/plugins/html_report.py b/pocsuite3/plugins/html_report.py index cc86492c..b887ba83 100644 --- a/pocsuite3/plugins/html_report.py +++ b/pocsuite3/plugins/html_report.py @@ -86,11 +86,36 @@ def _writer_footer(self): self.html.addcontent('{0}'.format(text)) self.html.div.close() self.html.footer.close() + self.html.addcontent('') + self.html.addcontent('') + self.html.body.close() self.html.html.close() def write_results(self, results=None): if results: + self.html.addcontent('') + self.html.addcontent('') self.html.addcontent('' '' '' @@ -99,29 +124,41 @@ def write_results(self, results=None): '' '' '' + '' '' ) - for result in results: - content = ( - '' - '' - '' - '' - '' - '' - '' - '' - ) if result.status == 'success' else ( - '' - '' - '' - '' - '' - '' - '' - '' - ) + all_target = [] + suc_target = [] + for result in results: + all_target.append(result.target) + if result.status == 'success': + suc_target.append(result.target) + content = ( + '' + '' + '' + '' + '' + '' + '' + '' + '' + ) + else: + content = ( + '' + '' + '' + '' + '' + '' + '' + '' + '' + ) + result.result.get('VerifyInfo').pop('URL') + extra_info = '/'.join([item for item in result.result.get('VerifyInfo').values()]) self.html.addcontent(content.format(result.target, result.target, result.poc_name, @@ -129,10 +166,17 @@ def write_results(self, results=None): result.vul_id, result.app_name, result.app_version, - result.status) + result.status, + extra_info) ) self.html.addcontent('
TargetComponentVersionStatusExtra
{1}{2}{4}{5}{6}{7}
{1}{2}{4}{5}{6}{7}
{1}{2}{4}{5}{6}{7}{8}
{1}{2}{4}{5}{6}{7}{8}
') + self.html.addcontent(''.format( + '\n'.join(all_target) + )) + self.html.addcontent(''.format( + '\n'.join(suc_target) + )) def write_html(self, results=None): menus = { diff --git a/setup.py b/setup.py index fa9c52b9..9184d356 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ def find_packages(where='.'): setup( name='pocsuite3', - version='2.0.8', + version='2.0.9', url='https://pocsuite.org', description='Open-sourced remote vulnerability testing framework.', long_description=long_description, diff --git a/tests/test_api_diy_options.py b/tests/test_api_diy_options.py index e9b5cc75..08dd8fae 100644 --- a/tests/test_api_diy_options.py +++ b/tests/test_api_diy_options.py @@ -15,7 +15,7 @@ def tearDown(self): def verify_result(self): config = { - 'url': ['https://www.baidu.com/'], + 'url': ['http://httpbin.org/post'], 'poc': [os.path.join(paths.POCSUITE_ROOT_PATH, "../tests/login_demo.py")], 'username': "asd", 'password': 'asdss',