Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #560 from 40huo/develop
Browse files Browse the repository at this point in the history
fix #552
  • Loading branch information
FeeiCN authored Sep 7, 2017
2 parents 2d979c5 + 93973f0 commit 1bdc6a6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
5 changes: 1 addition & 4 deletions cobra/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def post():
'msg': 'success',
'sid': sid,
'status': result.get('status'),
'report': result.get('report'),
'report': request.url_root + result.get('report'),
'still_running': result.get('still_running'),
'total_target_num': r_data.get('total_target_num'),
'not_finished': int(r_data.get('total_target_num')) - len(r_data.get('sids'))
Expand Down Expand Up @@ -312,7 +312,6 @@ def summary():
key=key)

status_url = 'http://{host}:{port}/api/status'.format(host=running_host, port=running_port)
logger.critical(status_url)
post_data = {
'key': key,
'sid': a_sid,
Expand Down Expand Up @@ -340,7 +339,6 @@ def summary():
elif len(split_target) == 2:
target, branch = target_str, 'master'
else:
logger.critical('[API] Target url exception: {u}'.format(u=target_str))
target, branch = target_str, 'master'
still_running[s_sid] = {'target': target,
'branch': branch}
Expand Down Expand Up @@ -373,7 +371,6 @@ def summary():
elif len(split_target) == 2:
target, branch = target_str, 'master'
else:
logger.critical('Target url exception: {u}'.format(u=target_str))
target, branch = target_str, 'master'

target_info.update({
Expand Down
2 changes: 1 addition & 1 deletion cobra/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import csv
import json
import os
from codecs import open,BOM_UTF8
from codecs import open, BOM_UTF8

from prettytable import PrettyTable

Expand Down
6 changes: 3 additions & 3 deletions cobra/templates/asset/js/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ $(function () {
$('.commit-author').text('@' + data.commit_author);
$('.commit-time').text('@' + data.commit_time);
$('.v-level').text(score2level[data.level]);
$('.v-type').text(data.rule_name);
$('.v-type').text('CVI-' + data.id + ' ' + data.rule_name);
$('.v-solution').text(data.solution);
// $('.v-rule').text(data.match_result);
}
Expand Down Expand Up @@ -341,8 +341,8 @@ $(function () {
' data-start="1" data-line="1">' +
'<strong>MVE-' + (i + 1) + '</strong><br><span>' + list[i].file_path + line + '</span><br>' +
'<span class="issue-information">' +
'<small>' +
' => ' + list[i].commit_time +
'<small>' + 'CVI-' + list[i].id +
' => ' + list[i].rule_name +
'</small>' +
'</span>' +
'</li>';
Expand Down
22 changes: 8 additions & 14 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"code": 1001, # 状态码为1001则表示逻辑处理正常
"result": {
"msg": "Add scan job successfully.", # 消息
"sid": "afbe69gxpy6h" # 扫描的任务ID(调用任务状态查询时需要用到)
"sid": "a938e2y2vnkf", # 扫描的任务ID(调用任务状态查询时需要用到)
"total_target_num": 1 # 扫描任务的项目总数
}
}
```
Expand All @@ -45,9 +46,12 @@
"code": 1001, # 状态码为1001则表示逻辑处理正常
"result": {
"msg": "success", # 消息
"not_finished": 0, # 未完成的项目数
"report": "http://127.0.0.1/?sid=ae3ea90pkoo5", # 扫描报告页
"sid": "ae3ea90pkoo5", # 扫描的任务ID
"status": "done", # 扫描状态
"report": "?sid=afbe69v8jjme", # 扫描报告页
"sid": "sfbe69y2sjge" # 扫描的任务ID
"still_running": {}, # 正在扫描的项目
"total_target_num": 1, # 扫描任务的项目总数
}
}
```
Expand All @@ -69,24 +73,14 @@ curl -H "Content-Type: application/json" -X POST -d '{"key":"your_secret_key", "

## 查询任务状态
```bash
curl -H "Content-Type: application/json" -X POST -d '{"key":"your_secret_key","sid": "e3ea91nd1f4"}' http://127.0.0.1/api/status
```

## 查询扫描报告
```bash
curl -H "Content-Type: application/json" -X POST -d '{"key":"your_secret_key","task_id": "your_task_id"}' http://127.0.0.1/api/report
curl -H "Content-Type: application/json" -X POST -d '{"key":"your_secret_key","sid": "a938e29vdse8"}' http://127.0.0.1/api/status
```

# Web 报告页

## 任务汇总报告
```
http://127.0.0.1/?sid=afbe69p7dxva
```

## 扫描详情报告
```
http://127.0.0.1/report/afbe69p7dxva/sfbe69plo5qs
```
---
下一章:[高级功能配置](https://wufeifei.github.io/cobra/config)

0 comments on commit 1bdc6a6

Please sign in to comment.