记录
https://github.com/ch3ngxuyuan/opencanary_web
https://vue.docschina.org/v2/guide/index.html
https://github.com/lin-xin/vue-manage-system
http://blog.gdfengshuo.com/example/work/#/dashboard
cd vue-manage-system // 进入模板目录
npm install // 安装项目依赖,等待安装完成之后
## 本地开发 ##
// 开启服务器,浏览器访问 http://localhost:8080
npm run dev
npm run serve
## 构建生产 ##
// 执行构建命令,生成的dist文件夹放在服务器下即可访问
npm run build
Some problems:
opencanary_web\vue-manage-system>npm run serve
npm ERR! missing script: serve
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2019-07-09T12_28_24_193Z-debug.log
npm run dev
如果页面有错会在命令窗口显示。
启动端口修改:
opencanary_web\vue-manage-system\node_modules\webpack-dev-server\bin\webpack-dev-server.js (2 hits)
Line 71: const DEFAULT_PORT = 8080;
登录:
http://192.168.1.11/auth/
opencanary_web\vue-manage-system\config\dev.env.js (1 hit)
Line 8: API_HOST:'"http://192.168.1.11:80"'
如果修改了接口,需重启服务
攻击列表 POST数据包:
Request Headers:
Host: ip:801
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://ip:801/v1/attacklist
Content-Type: application/json;charset=utf-8
Authorization: opencanary eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV.LP3crlxo8gkLoOnpTa5E7X_klLcR1snDc
Content-Length: 10
Connection: keep-alive
{"page":1}
跟踪:
url.py-->
(r"/log/list/*", paginationlog.GetlistJsonHandler),
handlers/paginationlog.py-->
from service.paginationlog import listpage
class GetlistJsonHandler(BaseHandler):
viewres = listpage(param)
service/paginationlog.py-->
from dbs.dal.LogOperate import LogOp
logselect = LogOp()
def listpage(param):
for i in logselect.page_select_attack(page):
dbs\dal\LogOperate.py-->
# 查询日志表攻击列表数据
def page_select_attack(self, page_index):
try:
page_size = 10
# num = 10*int(page) - 10
logselect = self.session.query(OpencanaryLog).filter(
OpencanaryLog.white == 2).order_by(
desc(OpencanaryLog.local_time),
OpencanaryLog.id).limit(page_size).offset(
(page_index - 1) * page_size)
return logselect
except InvalidRequestError:
self.session.rollback()
except Exception as e:
print(e)
finally:
self.session.close()
二次开发具体修改看GitHub
https://github.com/lin-xin/vue-manage-system
https://github.com/ch3ngxuyuan/opencanary_web
opencanary_web\vue-manage-system>npm run build
> vue-manage-system@3.1.0 build opencanary_web\vue-manage-system
> node build/build.js
- building for production...opencanary_web\vue-manage-system\node_modules\
last-call-webpack-plugin\src\index.js:170
compiler.hooks.compilation.tap(
^
TypeError: Cannot read property 'compilation' of undefined
at OptimizeCssAssetsWebpackPlugin.apply (opencanary_web\vue-manage-sys
tem\node_modules\[4mlast-call-webpack-plugin[24m\src\index.js:170:20)
at Compiler.apply (opencanary_web\vue-manage-system\node_modules\[4mt
apable[24m\lib\Tapable.js:375:16)
at webpack (opencanary_web\vue-manage-system\node_modules\[4mwebpack
[24m\lib\webpack.js:33:19)
at opencanary_web\vue-manage-system\build\build.js:19:3
at next (opencanary_web\vue-manage-system\node_modules\[4mrimraf[24m
\rimraf.js:75:7)
at CB (opencanary_web\vue-manage-system\node_modules\[4mrimraf[24m\r
imraf.js:111:9)
at opencanary_web\vue-manage-system\node_modules\[4mrimraf[24m\rimra
f.js:137:14
[90m at FSReqCallback.oncomplete (fs.js:165:21)[39m
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-manage-system@3.1.0 build: `node build/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-manage-system@3.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\123\AppData\Roaming\npm-cache\_logs\2019-07-09T16_00_44_212Z-debug.log
opencanary_web\vue-manage-system>
定位到node_modules\last-call-webpack-plugin\src\index.js文件报错
将项目中的该包(optimize-css-assets-webpack-plugin)升级或者降级到3.2.0版本
npm i optimize-css-assets-webpack-plugin@3.2.0 --save
完成后重新编译
> vue-manage-system@3.1.0 build opencanary_web\vue-manage-system
> node build/build.js
Hash: d584498cf9e84b2f98d3
Version: webpack 3.12.0
Time: 41623ms
Asset Size Chunks Chunk Name
s
static/fonts/element-icons.6f0a763.ttf 11 kB [emitted]
static/img/fontello.9354499.svg 16.2 kB [emitted]
static/fonts/fontello.e73a064.eot 15.6 kB [emitted]
static/fonts/fontello.068ca2b.ttf 15.4 kB [emitted]
static/js/0.ff1006a082ab32cf9eee.js 242 kB 0 [emitted]
static/js/1.4ad304bd4d253c4b9c95.js 42.8 kB 1 [emitted]
static/js/2.b34c1e6f50909ac4891c.js 24.9 kB 2 [emitted]
static/js/3.55d193d379c6e4389e01.js 6.66 kB 3 [emitted]
static/js/4.b2433b0043024eba0eb6.js 264 kB 4 [emitted] [big]
static/js/5.6c24c7671ce6ad312bd5.js 11.7 kB 5 [emitted]
static/js/6.4d37a250bbfd398eddfe.js 485 kB 6 [emitted] [big]
static/js/7.20847d7a71de69fc14f2.js 2.02 kB 7 [emitted]
static/js/8.55dc917c83219a4be24a.js 911 bytes 8 [emitted]
static/js/9.8f95ffd771da1feacb1c.js 819 bytes 9 [emitted]
static/js/10.74b7e80f7333b32b3e98.js 8.59 kB 10 [emitted]
static/js/11.8b5d148ead658c54146e.js 913 bytes 11 [emitted]
static/js/12.eb2f2e8b1238eae4f498.js 3.42 kB 12 [emitted]
static/js/13.6bff0931bc8fef107e1e.js 10 kB 13 [emitted]
static/js/14.1d3ca2d15e62e99e30c3.js 2.33 kB 14 [emitted]
static/js/15.22b9613419117e971801.js 1.45 kB 15 [emitted]
static/js/16.3044ea1d442a6cd2e0b0.js 1.29 kB 16 [emitted]
static/js/vendor.d18ede34db28d24cade5.js 1.57 MB 17 [emitted] [big] vendor
static/js/app.403d759311e453ea057c.js 3.73 kB 18 [emitted] app
static/js/manifest.dc86b4d39b13b409811d.js 1.81 kB 19 [emitted] manifest
static/css/app.986c9f45dde4c55c436dd68d78e8f761.css 290 kB 18 [emitted] [big] app
index.html 630 bytes [emitted]
static/css/color-dark.css 448 bytes [emitted]
static/css/main.css 2.43 kB [emitted]
static/css/theme-green/fonts/element-icons.woff 6.16 kB [emitted]
static/css/theme-green/index.css 195 kB [emitted]
static/js/vendor.dll.js 220 kB [emitted]
static/img/img.jpg 27.1 kB [emitted]
static/css/theme-green/fonts/element-icons.ttf 11 kB [emitted]
static/css/theme-green/color-green.css 701 bytes [emitted]
static/vuetable.json 1.18 kB [emitted]
static/hp.json 3.4 kB [emitted]
Build complete.
Tip: built files are meant to be served over an HTTP server.
Opening index.html over file:// won't work.
生成的dist文件夹放在服务器下即可访问