mirror of
https://github.com/frohoff/ysoserial.git
synced 2026-09-21 22:50:46 +08:00
testing
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import itertools
|
||||
import json
|
||||
import operator
|
||||
import sys
|
||||
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
import pytablewriter
|
||||
except:
|
||||
subprocess.check_call(['pip', 'install', 'pytablewriter'])
|
||||
import pytablewriter
|
||||
|
||||
def ver(v):
|
||||
return v.split(".", 1)[1] if v.startswith("1.") else v
|
||||
|
||||
def status(s):
|
||||
return ':green_circle:' if s == 'SUCCESS' else ':red_square:'
|
||||
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
with open(sys.argv[1]) as f:
|
||||
data = [json.loads(line) for line in f.readlines()]
|
||||
else:
|
||||
data = [json.loads(line) for line in sys.stdin.readlines()]
|
||||
|
||||
for da in data:
|
||||
del da['out']
|
||||
|
||||
# print(repr(data))
|
||||
|
||||
GET_VER = operator.itemgetter('java.version')
|
||||
GET_PAY = operator.itemgetter('payload')
|
||||
|
||||
by_payload = {payload:
|
||||
{ver(version): status(list(o2)[0]['status'])
|
||||
for version, o2 in itertools.groupby(sorted(o1, key=GET_VER), GET_VER)}
|
||||
for payload, o1 in itertools.groupby(sorted(data, key=GET_PAY), GET_PAY)}
|
||||
|
||||
# print(repr(by_payload))
|
||||
|
||||
vers = list(list(by_payload.items())[0][1].keys())
|
||||
|
||||
# print(vers)
|
||||
|
||||
md = pytablewriter.MarkdownTableWriter()
|
||||
md.table_name = ''
|
||||
md.header_list = [''] + vers
|
||||
md.value_matrix = [[p] + [o[v] for v in vers] for p, o in sorted(by_payload.items())]
|
||||
|
||||
md.write_table()
|
||||
@@ -38,6 +38,11 @@ jobs:
|
||||
name: jar
|
||||
path: target/ysoserial-*-all.jar
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: results
|
||||
path: .github/workflow/results.py
|
||||
|
||||
set-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
container: dwdraju/alpine-curl-jq
|
||||
@@ -55,10 +60,10 @@ jobs:
|
||||
- build
|
||||
strategy:
|
||||
matrix:
|
||||
# version: ${{ fromJson(needs.set-matrix.outputs.versions) }} # broken in act
|
||||
version:
|
||||
- 7u21-jdk
|
||||
- 7u25-jdk
|
||||
version: ${{ fromJson(needs.set-matrix.outputs.versions) }} # broken in act
|
||||
# version:
|
||||
# - 7u21-jdk
|
||||
# - 7u25-jdk
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: vulhub/java:${{ matrix.version }}
|
||||
@@ -83,8 +88,13 @@ jobs:
|
||||
with:
|
||||
path: artifacts
|
||||
- run: cat artifacts/out*/*.txt > out.txt
|
||||
|
||||
- run: cat out.txt | python artifacts/results/results.py > matrix.md
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: out
|
||||
path: out.txt
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: matrix
|
||||
path: matrix.md
|
||||
|
||||
@@ -47,7 +47,7 @@ public class PayloadListener extends RunListener {
|
||||
|
||||
Status status = statuses.get(description);
|
||||
String payload = getPayload(description.getDisplayName());
|
||||
String out = outs.get(description).toString();
|
||||
String out = outs.get(description).toString().trim();
|
||||
|
||||
Map<String,String> props = new HashMap<String, String>();
|
||||
props.put("payload", payload);
|
||||
|
||||
Reference in New Issue
Block a user