Skip to content

Commit 4b193b9

Browse files
authored
Merge pull request #14 from wh0am1i/tmp
update actions/checkout version & feat: add html plugins copy result …
2 parents 25b5b77 + 70f61bb commit 4b193b9

File tree

6 files changed

+81
-30
lines changed

6 files changed

+81
-30
lines changed

.github/workflows/test.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,28 @@ jobs:
55
test:
66
strategy:
77
matrix:
8-
python-version: [3.7, '3.10']
8+
python-version: ['3.9', '3.11']
99
os: [ubuntu-latest, macos-latest, windows-latest]
1010
runs-on: ${{ matrix.os }}
1111
timeout-minutes: 30
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- name: Cache for pip
15-
uses: actions/cache@v1
15+
uses: actions/cache@v4
1616
id: cache-pip
1717
with:
1818
path: ~/.cache/pip
1919
key: ${{ matrix.os }}-cache-pip
2020

2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v1
22+
uses: actions/setup-python@v4
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525

2626
- name: Install dependencies & Test
2727
run: |
28+
pip install --upgrade pip
29+
pip install --upgrade setuptools
2830
pip install --upgrade -r requirements.txt
2931
python setup.py install
30-
python test.py
32+
python test.py

pocsuite3/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = 'pocsuite3'
2-
__version__ = '2.0.8'
2+
__version__ = '2.0.9'
33
__author__ = 'Knownsec 404 Team'
44
__author_email__ = '404-team@knownsec.com'
55
__license__ = 'GPLv2'

pocsuite3/lib/controller/controller.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,13 @@ def task_run():
136136
else:
137137
logger.warn("No libpcap is detected, and the poc will continue to execute without fetching the packet")
138138
conf.pcap = False
139+
info_msg = "running poc:'{0}' target '{1}'".format(
140+
poc_name,
141+
mosaic(target)
142+
)
139143

140-
info_msg = "running poc:'{0}' target '{1}'".format(poc_name, mosaic(target))
144+
if len(kb.targets) > 1:
145+
info_msg += ", {0} tasks waiting to be executed.".format(kb.task_queue.qsize())
141146

142147
logger.info(info_msg)
143148

pocsuite3/plugins/html_report.py

+65-21
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,36 @@ def _writer_footer(self):
8686
self.html.addcontent('<span class="text-muted">{0}</span>'.format(text))
8787
self.html.div.close()
8888
self.html.footer.close()
89+
self.html.addcontent('<script type="text/javascript">'
90+
'function copyAll() {'
91+
'var targetValue = $("#all-target").val();'
92+
'navigator.clipboard.writeText(targetValue).then(function() {'
93+
'alert("复制成功");'
94+
'}, function(err) {'
95+
'alert("复制失败");'
96+
'});'
97+
'}'
98+
'</script>')
99+
self.html.addcontent('<script type="text/javascript">'
100+
'function copySuc() {'
101+
'var targetValue = $("#suc-target").val();'
102+
'navigator.clipboard.writeText(targetValue).then(function() {'
103+
'alert("复制成功");'
104+
'}, function(err) {'
105+
'alert("复制失败");'
106+
'});'
107+
'}'
108+
'</script>')
109+
89110
self.html.body.close()
90111
self.html.html.close()
91112

92113
def write_results(self, results=None):
93114
if results:
115+
self.html.addcontent('<button onclick="copyAll()" class="btn btn-primary" '
116+
'style="margin-bottom: 10px">复制所有目标</button>')
117+
self.html.addcontent('<button onclick="copySuc()" class="btn btn-success"'
118+
' style="margin-bottom: 10px">复制成功目标</button>')
94119
self.html.addcontent('<table class="table table-striped table-bordered table-hover">'
95120
'<thead class="thead-dark"><tr>'
96121
'<th scope="col">Target</th>'
@@ -99,40 +124,59 @@ def write_results(self, results=None):
99124
'<th scope="col">Component</th>'
100125
'<th scope="col">Version</th>'
101126
'<th scope="col">Status</th>'
127+
'<th scope="col">Extra</th>'
102128
'</tr></thead><tbody>'
103129
)
104-
for result in results:
105-
content = (
106-
'<tr>'
107-
'<td><a href="{0}" target="_blank">{1}</a></td>'
108-
'<td>{2}</td>'
109-
'<td><a href="https://www.seebug.org/vuldb/ssvid-{3}" target="_blank">{4}</a></td>'
110-
'<td>{5}</td>'
111-
'<td>{6}</td>'
112-
'<td><span class="badge badge-success">{7}</span></td>'
113-
'</tr>'
114-
) if result.status == 'success' else (
115-
'<tr>'
116-
'<td><a href="{0}" target="_blank">{1}</a></td>'
117-
'<td>{2}</td>'
118-
'<td><a href="https://www.seebug.org/vuldb/ssvid-{3}" target="_blank">{4}</a></td>'
119-
'<td>{5}</td>'
120-
'<td>{6}</td>'
121-
'<td><span class="badge badge-secondary">{7}</span></td>'
122-
'</tr>'
123-
)
130+
all_target = []
131+
suc_target = []
124132

133+
for result in results:
134+
all_target.append(result.target)
135+
if result.status == 'success':
136+
suc_target.append(result.target)
137+
content = (
138+
'<tr>'
139+
'<td><a href="{0}" target="_blank">{1}</a></td>'
140+
'<td>{2}</td>'
141+
'<td><a href="https://www.seebug.org/vuldb/ssvid-{3}" target="_blank">{4}</a></td>'
142+
'<td>{5}</td>'
143+
'<td>{6}</td>'
144+
'<td><span class="badge badge-success">{7}</span></td>'
145+
'<td>{8}</td>'
146+
'</tr>'
147+
)
148+
else:
149+
content = (
150+
'<tr>'
151+
'<td><a href="{0}" target="_blank">{1}</a></td>'
152+
'<td>{2}</td>'
153+
'<td><a href="https://www.seebug.org/vuldb/ssvid-{3}" target="_blank">{4}</a></td>'
154+
'<td>{5}</td>'
155+
'<td>{6}</td>'
156+
'<td><span class="badge badge-secondary">{7}</span></td>'
157+
'<td>{8}</td>'
158+
'</tr>'
159+
)
160+
result.result.get('VerifyInfo').pop('URL')
161+
extra_info = '/'.join([item for item in result.result.get('VerifyInfo').values()])
125162
self.html.addcontent(content.format(result.target,
126163
result.target,
127164
result.poc_name,
128165
result.vul_id,
129166
result.vul_id,
130167
result.app_name,
131168
result.app_version,
132-
result.status)
169+
result.status,
170+
extra_info)
133171
)
134172

135173
self.html.addcontent('</tbody></table>')
174+
self.html.addcontent('<textarea id="all-target" style="display:none">{}</textarea>'.format(
175+
'\n'.join(all_target)
176+
))
177+
self.html.addcontent('<textarea id="suc-target" style="display:none">{}</textarea>'.format(
178+
'\n'.join(suc_target)
179+
))
136180

137181
def write_html(self, results=None):
138182
menus = {

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def find_packages(where='.'):
2121

2222
setup(
2323
name='pocsuite3',
24-
version='2.0.8',
24+
version='2.0.9',
2525
url='https://pocsuite.org',
2626
description='Open-sourced remote vulnerability testing framework.',
2727
long_description=long_description,

tests/test_api_diy_options.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def tearDown(self):
1515

1616
def verify_result(self):
1717
config = {
18-
'url': ['https://www.baidu.com/'],
18+
'url': ['http://httpbin.org/post'],
1919
'poc': [os.path.join(paths.POCSUITE_ROOT_PATH, "../tests/login_demo.py")],
2020
'username': "asd",
2121
'password': 'asdss',

0 commit comments

Comments
 (0)