31 Commits
Author SHA1 Message Date
Li4n0 830dde3cec chore(release): 0.2.1 2021-07-24 23:12:26 +08:00
Li4n0 c308bbb6b0 build: update go.sum 2021-07-24 23:12:15 +08:00
Li4n0 c818b2a9db build: upgrade gin version to fix CVE-2020-28483 2021-07-24 23:06:32 +08:00
Li4n0 ee36205ac1 feat(rule): add flag as a built-in template variable 2021-07-24 22:58:38 +08:00
Li4n0 acbdbee26a chore(release): 0.2.0 2021-07-22 22:47:22 +08:00
Li4n0 9863821dbc feat: support deleting logs based on filtering results (#35)
* feat: support deleting logs based on filtering results

* fix(record): fix the problem of wrong number of parameters when outputting delete logs
2021-07-22 22:46:11 +08:00
Li4n0 206808e83a chore(release): 0.1.7 2021-07-11 16:24:57 +08:00
Li4n0 a248c6e39e chore: release 0.1.7 2021-07-11 16:24:44 +08:00
Li4n0 5e2020efff ci: remove architectures other than amd64 2021-07-11 16:23:15 +08:00
Li4n0 c0bda707b7 fix(mysql): fix the bug that crashes when mysql port conflicts 2021-07-11 14:49:35 +08:00
Li4n0 ffc4318725 fix(http): fix the bug that http record url search does not work 2021-07-11 13:55:20 +08:00
Li4n0 8023a9b021 chore(release): 0.1.6 2021-06-25 22:38:27 +08:00
Li4n0 56153510e1 fix(cli): fix the bug that the prompt may not be output when generating config file 2021-06-25 22:37:58 +08:00
Li4n0 be7343191d ci(release.yml): use -tags netgo when compiling on linux platform
fix #32
2021-06-25 22:32:41 +08:00
Li4n0 b1773ee5e9 fix(ipinfo): fix a potential panic when downloading ip location database (#33) 2021-06-25 21:15:47 +08:00
Li4n0 18707cec47 chore: release 0.1.5 2021-06-22 21:02:34 +08:00
Li4n0 993d3867ee docs: update CHANGELOG.md 2021-06-22 20:25:49 +08:00
Li4n0 d4d7435265 chore(release): 0.1.5 2021-06-22 20:13:39 +08:00
Li4n0 70f17453fd docs: add issue templates 2021-06-22 00:01:23 +08:00
Li4n0 ef38cbc790 fix(notice): fix the buf of notice with null record field (#31) 2021-06-21 23:38:04 +08:00
Li4n0 6205772a59 docs(readme): update README (#30) 2021-06-18 21:35:53 +08:00
Li4n0 807186be61 docs(readme): add README in Chinese (#29) 2021-06-18 21:25:18 +08:00
Li4n0 1c625dd881 chore(release): 0.1.5-beta 2021-06-13 15:00:48 +08:00
Li4n0 30194479d1 chore(version): change version number 2021-06-13 15:00:24 +08:00
Li4n0 ddeced3540 fix(frontend): fix the frontend display bugs (#28)
Fix the bug that the page height does not follow the change when the sidebar is expanded.
2021-06-13 14:47:32 +08:00
Li4n0andE99p1ant dc43b6973a feat(ipinfo): support GeoIP (#26)
Co-authored-by: E99p1ant <[email protected]>
2021-06-12 22:04:45 +08:00
Li4n0 d1013c2416 fix(frontend): fix the bug of autoRefresh (#27)
Fix the bug that autoRefresh fails after switching back to log from rule.
2021-06-11 23:59:23 +08:00
Li4n0 f7be2bc2e6 feat(platform): support custom admin path prefix (#25) 2021-05-31 23:03:39 +08:00
Li4n0 42d1e35913 chore(release): 0.1.4-beta-fix-1 2021-05-28 20:01:43 +08:00
Li4n0 74f512d214 fix(http): fix the problem that ip_header setting does not take effect (#23) 2021-05-28 19:55:44 +08:00
Li4n0 b945069117 fix(frontend): fix the problem of autoRefresh failure (#24) 2021-05-28 19:55:20 +08:00
83 changed files with 1089 additions and 226 deletions
+33
View File
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Environments**
Your operating system, such as `Mac OS Catalina 10.15.7`.
**RevSuit Version**
Versions of RevSuit with bugs.
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.
+17
View File
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Describe the new feature you expect to add**
A clear and concise description.
**Why do you want to add this feature**
A clear and concise description of why you need the feature, such as in what kind of usage scenarios it would be more convenient to have a certain feature.
**Additional context**
Add any other context or screenshots about the feature request here.
+7 -15
View File
@@ -12,14 +12,11 @@ jobs:
with:
go-version: '^1.16.0'
- name: compile
env:
CGO_ENABLE: 1
CGO_LDFLAGS: -static
run: |
GOARCH="amd64" go build -v -ldflags="-s -w -extldflags=-static" -trimpath -o "bin/revsuit_linux_amd64" ./cmd/revsuit/revsuit.go
GOARCH="386" go build -v -ldflags="-s -w -extldflags=-static" -trimpath -o "bin/revsuit_linux_i386" ./cmd/revsuit/revsuit.go
GOARCH="arm" go build -v -ldflags="-s -w -extldflags=-static" -trimpath -o "bin/revsuit_linux_arm" ./cmd/revsuit/revsuit.go
GOARCH="arm64" go build -v -ldflags="-s -w -extldflags=-static" -trimpath -o "bin/revsuit_linux_arm64" ./cmd/revsuit/revsuit.go
GOARCH="amd64" go build -v -ldflags="-s -w -extldflags=-static" -tags netgo -trimpath -o "bin/revsuit_linux_amd64" ./cmd/revsuit/revsuit.go
# GOARCH="386" go build -v -ldflags="-s -w -extldflags=-static" -tags netgo -trimpath -o "bin/revsuit_linux_i386" ./cmd/revsuit/revsuit.go
# GOARCH="arm" go build -v -ldflags="-s -w -extldflags=-static" -tags netgo -trimpath -o "bin/revsuit_linux_arm" ./cmd/revsuit/revsuit.go
# GOARCH="arm64" go build -v -ldflags="-s -w -extldflags=-static" -tags netgo -trimpath -o "bin/revsuit_linux_arm64" ./cmd/revsuit/revsuit.go
- name: Upload the artifacts
uses: li4n0/upload-release-action@v2
with:
@@ -37,11 +34,9 @@ jobs:
with:
go-version: '^1.16.0'
- name: compile
env:
CGO_ENABLE: 1
run: |
GOARCH="amd64" go build -v -ldflags="-s -w" -trimpath -o "bin/revsuit_darwin_amd64" ./cmd/revsuit/revsuit.go
GOARCH="arm64" go build -v -ldflags="-s -w" -trimpath -o "bin/revsuit_darwin_arm64" ./cmd/revsuit/revsuit.go
# GOARCH="arm64" go build -v -ldflags="-s -w" -trimpath -o "bin/revsuit_darwin_arm64" ./cmd/revsuit/revsuit.go
- name: Upload the artifacts
uses: li4n0/upload-release-action@v2
with:
@@ -59,13 +54,10 @@ jobs:
with:
go-version: '^1.16.0'
- name: compile
env:
CGO_ENABLE: 1
CGO_LDFLAGS: -static
run: |
env GOARCH=amd64 go build -v -ldflags="-s -w -extldflags=-static" -trimpath -o "bin/revsuit_windows_amd64.exe" ./cmd/revsuit/revsuit.go
env GOARCH=386 go build -v -ldflags="-s -w -extldflags=-static" -trimpath -o "bin/revsuit_windows_i386.exe" ./cmd/revsuit/revsuit.go
env GOARCH=arm go build -v -ldflags="-s -w -extldflags=-static" -trimpath -o "bin/revsuit_windows_arm.exe" ./cmd/revsuit/revsuit.go
# env GOARCH=386 go build -v -ldflags="-s -w -extldflags=-static" -trimpath -o "bin/revsuit_windows_i386.exe" ./cmd/revsuit/revsuit.go
# env GOARCH=arm go build -v -ldflags="-s -w -extldflags=-static" -trimpath -o "bin/revsuit_windows_arm.exe" ./cmd/revsuit/revsuit.go
- name: Upload the artifacts
uses: li4n0/upload-release-action@v2
with:
+4 -3
View File
@@ -2,9 +2,10 @@
# local files
qqwry.dat
revsuit.db
revsuit.db-shm
revsuit.db-wal
GeoLite2-City.mmdb
*.db
*.db-shm
*.db-wal
# local config
config.yaml*
+60 -2
View File
@@ -1,7 +1,65 @@
# Changelog
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.2.1](https://github.com/Li4n0/revsuit/compare/v0.2.0...v0.2.1) (2021-07-24)
### Features
* **rule:** add `flag` as a built-in template variable ([ee36205](https://github.com/Li4n0/revsuit/commit/ee36205ac160a75d23dbb244c72f3bb2d185ab80))
## [0.2.0](https://github.com/Li4n0/revsuit/compare/v0.1.7...v0.2.0) (2021-07-22)
### Features
* support deleting logs based on filtering results ([#35](https://github.com/Li4n0/revsuit/issues/35)) ([9863821](https://github.com/Li4n0/revsuit/commit/9863821dbc351734569b7ec1eda2b6712bd02bb0))
### [0.1.7](https://github.com/Li4n0/revsuit/compare/v0.1.6...v0.1.7) (2021-07-11)
### Bug Fixes
* **http:** fix the bug that http record url search does not work ([ffc4318](https://github.com/Li4n0/revsuit/commit/ffc4318725017c7eda7ec11ca67d5de16ad1e8a8))
* **mysql:** fix the bug that crashes when mysql port conflicts ([c0bda70](https://github.com/Li4n0/revsuit/commit/c0bda707b750b7858fdd4efc414b726ee37e71da))
### [0.1.6](https://github.com/Li4n0/revsuit/compare/v0.1.5...v0.1.6) (2021-06-25)
### Bug Fixes
* **cli:** fix the bug that the prompt may not be output when generating config file ([5615351](https://github.com/Li4n0/revsuit/commit/56153510e11783c08843cbb8b0f827d5f8567842))
* **ipinfo:** fix a potential panic when downloading ip location database ([#33](https://github.com/Li4n0/revsuit/issues/33)) ([b1773ee](https://github.com/Li4n0/revsuit/commit/b1773ee5e9ebd8c8be72f315981268992c08b3f1))
### [0.1.5](https://github.com/Li4n0/revsuit/compare/v0.1.5-beta...v0.1.5) (2021-06-22 公开该项目以庆祝毕业,愿工作多年后的我,归来时仍是少年)
### Bug Fixes
* **notice:** fix the buf of notice with null record field ([#31](https://github.com/Li4n0/revsuit/issues/31)) ([ef38cbc](https://github.com/Li4n0/revsuit/commit/ef38cbc790f69716a335167321e1c7c8bdee2e41))
### [0.1.5-beta](https://github.com/Li4n0/revsuit/compare/v0.1.4-beta-fix-1...v0.1.5-beta) (2021-06-13)
### Features
* **ipinfo:** support GeoIP ([#26](https://github.com/Li4n0/revsuit/issues/26)) ([dc43b69](https://github.com/Li4n0/revsuit/commit/dc43b6973a5ac98e439d1353102ade2029b1d382))
* **platform:** support custom admin path prefix ([#25](https://github.com/Li4n0/revsuit/issues/25)) ([f7be2bc](https://github.com/Li4n0/revsuit/commit/f7be2bc2e67841178e9316995999b20f80a49df7))
### Bug Fixes
* **frontend:** fix the bug of autoRefresh ([#27](https://github.com/Li4n0/revsuit/issues/27)) ([d1013c2](https://github.com/Li4n0/revsuit/commit/d1013c2416c04bd72b9cbb0c7e6b4b3f2e717837))
* **frontend:** fix the frontend display bugs ([#28](https://github.com/Li4n0/revsuit/issues/28)) ([ddeced3](https://github.com/Li4n0/revsuit/commit/ddeced354042e0be6db5dd4feffa13ef22db231f))
### [0.1.4-beta-fix-1](https://github.com/Li4n0/revsuit/compare/v0.1.4-beta...v0.1.4-beta-fix-1) (2021-05-28)
### Bug Fixes
* **frontend:** fix the problem of autoRefresh failure ([#24](https://github.com/Li4n0/revsuit/issues/24)) ([b945069](https://github.com/Li4n0/revsuit/commit/b945069117fec6eb5de88557da5d4c2c996cfd90))
* **http:** fix the problem that ip_header setting does not take effect ([#23](https://github.com/Li4n0/revsuit/issues/23)) ([74f512d](https://github.com/Li4n0/revsuit/commit/74f512d2140fb97128acf56be803d1bd3b888fa3))
### [0.1.4-beta](https://github.com/Li4n0/revsuit/compare/v0.1.3-beta-fix1...v0.1.4-beta) (2021-05-27)
+30 -24
View File
@@ -1,5 +1,7 @@
# RevSuit - A Flexible and Powerful Reverse Connection Platform
English [简体中文](./README.zh-CN.md)
## Overview
RevSuit is a flexible and powerful reverse connection platform designed for receiving connection from target host in
@@ -7,13 +9,13 @@ penetration. It currently supports HTTP, DNS, RMI, MySQL and FTP protocols.
Flexible:
1. Revsuit can set flexible rules to capture different connections.
1. RevSuit can set flexible rules to capture different connections.
2. Deploy and run via binaries without worrying about nasty dependency errors.
Powerful:
1. Revsuit allows users to customize the response for different connections through rules and supports dynamic response
generation using template variables.
1. Allows to customize the response for different connections through rules and supports dynamic response generation
using template variables.
2. Support a variety of protocols, and support the in-depth utilization of some protocols, such as DNS rebinding, MySQL
Load Local Data, JDBC Deserialize Exploit, FTP Passive Mode SSRF, etc.
3. Native support for use with scanners.
@@ -24,13 +26,16 @@ Powerful:
### Preparation
Download the latest release firstly.
Download the latest release firstly. For the time being, only the binary for amd64 architecture is available for
download, if you need to use it in other architectures, you can compile it yourself.
RevSuit will generate default configuration file on first run. Modify the configuration file according to your needs,
then re-run.
To confirm the location of the connection IP, if there is no qqwry.dat in the current directory or its modification time
is more than 5 days ago. RevSuit will download it.(Support for GeoIP is in the planning stages).
In order to confirm the IP location, it needs to use the IP location database. `QQwry` is used as the data source by
default, you can also modify the configuration to use `GeoIP`. If the selected database is not available in the current
directory or the database is updated for more than a week, RevSuit will automatically download the latest database. If
the download fails, the `IpArea` field will always be null.
```bash
$ ./revsuit
@@ -63,8 +68,8 @@ A few notes are as follows
2. `FlagFormat` uses regular expression syntax, and for different protocols, the fields matched by flagFormat are
different, you can check the corresponding hints to get details when creating rules.
3. Rules with high rank will take effect first.
4. For different protocol rules, you can make different custom configurations, and for some protocols, template
variables can be used.
4. For different protocol rules, you can make different custom responses, and for some protocols, template variables can
be used.
5. You can set the named grouping of regular expressions in `flagFormat`, and the result of the matching grouping will
also be used as a template variable.
@@ -127,7 +132,7 @@ RevSuit was split from my scanner project, so its native support works with scan
From RevSuit's perspective, we call a scanner a client.
#### Create Connection
#### Establish connection
RevSuit
uses [HTTP Server-sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
@@ -143,8 +148,8 @@ example.
#### Multi-client
As shown above, RevSuit supports multiple clients, and each client in the connected state receives a push of `flag`, so
distributed scanning can be supported.
As shown above, RevSuit supports multiple clients, and each client **in the connected state** receives a push of `flag`,
so distributed scanning can be supported.
#### Temporary storage queue
@@ -154,15 +159,15 @@ helpful for discovering delay-triggered vulnerabilities.)
#### Use flagGroup
`FlagGroup` is the content matched by the anonymous group in the `flagFormat` field of the rule. The platform will check
the content matched in the grouping,and the flag is only pushed to the client when then content(`flagGroup`) captured
for the first time.
In a real-world vulnerability scanning scenario, you may send a large number of different payloads for a single
vulnerability point, and they may all be valid, which can result in the backlink platform receiving many requests, yet
they are caused by the same vulnerability. If you don't want the client to receive so many `flags` for the same
vulnerability, you can take advantage of the `flagGroup` feature of rule's flagFormat.
`FlagGroup` is the content matched by the anonymous group in the `flagFormat` field of the rule. The platform will check
the content matched in the grouping,and the flag is only pushed to the client when then content(`flagGroup`) captured
for the first time.
For example, SSRF scanning.
Firstly create a rule like the following:
@@ -181,23 +186,22 @@ http:
Suppose our target is `https://www.testvuln.com?url=api.com&p=useless`, and for SSRF we have 5 payloads. The final
request sent by the scanner may
be `['https://www.testvuln.com?url=http://revsuit.com/ssrfa98oni1&p=useless, ... ,'https://www.testvuln.com?url=//revsuit.com/ssrfa98oni5&p=useless`']
be `['https://www.testvuln.com?url=http://revsuit.com/ssrfa98oni1&p=useless','https://www.testvuln.com?url=http://revsuit.com/ssrfa98oni2&p=useless', ... ,'https://www.testvuln.com?url=//revsuit.com/ssrfa98oni5&p=useless`']
. They may all attack successfully.
However, because anonymous grouping is used in the rule's `flagFormat`, The platform will query the
connected `flagGroup`, in this case `ssrfa98oni`, and push `flag` to the client only at its first appearance, so the
client will only receive one flag:`ssrfa98oni1`. But this is enough, because it already proves that the `url` parameter
of the target is vulnerable.
client will only receive one flag:`ssrfa98oni1`. It already proves that the `url` parameter of the target is vulnerable.
### Multi-module collocation
In actual penetration testing scenarios, certain tasks can be done easily and quickly by combining and matching various
modules of RevSuit. The following is an example of a blind XXE scenario, showing how to use RevSuit's HTTP and FTP
modules of RevSuit. The following is an example of a blind XXE in Java Web, showing how to use RevSuit's HTTP and FTP
modules, combined with template variables, to quickly complete a port scan.
First use create an HTTP rule to return evil.dtd, customize the response to the contents of dtd so that it goes to
connect to RevSuit's FTP service, and use template variables to pass the Host and Port to be scanned to FTP via FTP's
user and password.
First create an HTTP rule to return evil.dtd, customize the response to the contents of dtd so that it goes to connect
to RevSuit's FTP service, and use template variables to pass the Host and Port to be scanned to FTP via FTP's user and
password.
![create evil.dtd rule](./images/evil_dtd_rule.png)
@@ -223,14 +227,16 @@ and 8080 are open.
A more detailed wiki is being prepared, you can explore by yourself before it.
## Advice and Communication
## Feedback, Suggestions and Communication
Submit an issue or contact me through Weixin: `Li4n06`
Submit an issue or contact me through Weixin: `TGk0bjA2Cg==`
## Acknowledgements
### Reference
This project draws on the code of the following outstanding projects:
* [https://github.com/rmb122/rogue_mysql_server](https://github.com/rmb122/rogue_mysql_server)
* [https://github.com/256dpi/newdns](https://github.com/256dpi/newdns)
+220
View File
@@ -0,0 +1,220 @@
# RevSuit - A Flexible and Powerful Reverse Connection Platform
简体中文 [English](./README.md)
## 简介
RevSuit 是一款灵活并且强大的反连平台。目前支持 HTTP、DNS、RMI、MySQL 和 FTP 协议。
灵活:
1. 通过灵活的规则来捕获连接
2. 通过二进制文件部署和运行而无需担心讨厌的依赖错误
强大:
1. 可以通过规则,为不同类型的连接自定义响应,并且可以使用模板变量实现动态响应。
2. 支持的协议数量相对较多,并且支持其中的部分协议的进一步利用,如 DNS重绑定、MySQL客户端文件读取和 JDBC 反序列化、FTP 被动模式 SSRF 等
3. 原生支持扫描器
4. 支持发送通知到流行的办公软件
5. 其它有趣或贴心的功能
## 基础使用
### 安装
在 Releases 里下载最新版本的 RevSuit。暂时只提供 amd64 架构下的二进制文件下载,如需要在其它架构下使用,可以自行编译。
RevSuit 首次运行时将会生成配置文件模板,你需要编辑其中的内容然后重新运行。
为了确认连接 IP 的归属地,RevSuit 需要依赖 IP 归属地数据库。默认情况下使用纯真 IP 库,你也可以在配置文件中指定使用 GeoIP。如果当前目录下没有被选中的数据库文件,或者数据库文件更新的时间大于一周,RevSuit
将会自动下载最新版的数据库文件到本地。如果下载失败,连接记录的`IpArea`字段将始终为空。
```bash
$ ./revsuit
2021/05/16 22:55:10 [ INFO] Downloading qqwry.dat...
____ _____ _ __
/ __ \___ _ __/ ___/__ __(_) /_
/ /_/ / _ \ | / /\__ \/ / / / / __/
/ _, _/ __/ |/ /___/ / /_/ / / /_
/_/ |_|\___/|___//____/\__,_/_/\__/
vBeta0.1
https://revsuit.pro
2021/05/16 22:55:22 [ INFO] Starting HTTP Server at :80, token:your_token
2021/05/16 22:55:22 [ INFO] Start to listen FTP PASV port at :2020, PasvIP is 10.9.8.7
2021/05/16 22:55:22 [ INFO] Starting FTP Server at :21
2021/05/16 22:55:22 [ INFO] Starting MySQL Server at :3306
2021/05/16 22:55:22 [ INFO] Starting RMI Server at :1099
2021/05/16 22:55:22 [ INFO] Starting DNS Server at :53
```
在启动之后,你可以通过访问HTTP Server的`/revsuit/admin/`路径,并输入 token 来进入控制面板。
### 创建规则与接收连接
这里以创建一个HTTP规则作为例子:
一些需要注意的内容如下:
1. 规则的 `name``flagFormat` 字段是唯一的。
2. `flagFormat` 使用正则表达式语法。对于不同的协议,其匹配的字段也是不同的。你可以在创建规则的时候查看对应的帮助信息来获知该协议的哪个字段是会被匹配的。
3. `rank` 决定了规则的优先级,如果一个请求同时满足多条规则,只有 `rank` 值最大的那条规则会生效。
4. 对于不同的协议,你可以设置不同的响应,部分协议可以使用模板变量来动态生成响应。
5. 你可以在 `flagFormat` 中使用正则表达式中的命名分组,命名分组匹配的结果将会成为自定义的模板变量。
如下图所示,我们创建一个名为 `test_create_rule` 的HTTP协议的规则,其中使用了内置的模板变量和自定义的模板变量:
![img.png](./images/create_rule.png)
然后发送一个满足这条规则的请求来进行测试,可以看到响应的内容中各个模板变量都获取到了对应的值:
![img.png](./images/do_request.png)
这条请求同时会被记录在平台:
![img.png](./images/http_log.png)
### 通知
通过配置 Webhook 地址并打开对应规则的 `Notice` 开关,你可以通过办公软件接收新连接的通知。目前支持 钉钉、企业微信、飞书 和 slack。(计划会后续支持Discord 和 Telegram
### 导入/导出规则
如果你想要迁移平台或者清除数据,重新创建规则可能是一件麻烦事。因此 RevSuit 支持导入和导出规则。
该功能位于 `Settings>RULES` 选项卡,如下所示,规则将会被以 yaml 的格式进行导入和导出:
```yaml
http:
- name: test_create_rule
flag_format: (?P<what>\w+)\?
rank: 0
push_to_client: false
notice: false
response_status_code: "302"
response_headers:
Location: ${query.url}
response_body: ${header.say} ${what}
- name: other_rule
flag_format: other
rank: 1
push_to_client: false
notice: true
response_status_code: "200"
response_headers: { }
response_body: Hello Revsuit!
dns:
... ...
```
## 高级功能
### 与扫描器适配
RevSuit 拆分自我的扫描器项目,因此它原生支持搭配扫描器使用。
从 RevSuit 的视角,我们称扫描器为客户端。
#### 建立通信管道
RevSuit
使用 [HTTP Server-sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
(SSE) 与客户端建立一条单向通信管道。
通信管道的API为 `/revsuit/api/events?message`。客户端只需携带 `Token: your token` 请求头,然后请求这个 API 来建立通信管道。这样当 RevSuit
捕获新连接的时候,匹配到的 `flag` 就会通过这条管道传递给客户端。
![img.png](./images/sse.gif)
这里是一个使用 Go 语言的 sse 库编写客户端的[简单例子](https://gist.github.com/Li4n0/21aa0bec2d626114a729ca2677efb05a) 。
#### 多客户端
如上一节的图片里所展示的,RevSuit 支持多个客户端,每个在**连接状态**的客户端都会接收到 `flag` 的推送,因此分布式扫描也是支持的。
#### 暂存队列
当没有客户端连接的时候,RevSuit 会把 `flag` 暂时存储到队列里,当有客户端连接的时候再进行推送。因此你不必担心因为客户端与 RevSuit 断开连接就错过漏洞。(这对发现延时触发的漏洞尤为有帮助)
#### 使用flagGroup
在真实的漏洞扫描情景中,对于一个漏洞点,往往会发送许多不同的 payload,它们可能全部是有效 payload,这会导致 RevSuit
收到很多个连接,然而这些连接背后的漏洞其实是同一个。如果你不想客户端收到代表同一个漏洞的 `flag`
,你可以使用 `flagGroup`
`flagGroup` 是被规则中的 `flagFormat` 中的匿名分组所匹配到的内容。RevSuit 将会检查 `flagGroup` 是否已经在之前的连接中被捕获过,只有当 `flagGroup`
是首次出现时,才会推送 `flag`
到客户端。
以针对 SSRF 漏洞扫描为例:
首先我们创建一个如下的规则:
```yaml
http:
- name: ssrf
flag_format: (ssrf[a-z0-9]{6})[0-9]{1,3}
rank: 0
push_to_client: false
notice: false
response_status_code: "200"
response_headers: { }
response_body: "Here is a SSRF!"
```
假设我们的目标是 `https://www.testvuln.com?url=api.com&p=useless`,并且针对 SSRF 漏洞,我们有5个
payload,最后被扫描器发出的请求是:`['https://www.testvuln.com?url=http://revsuit.com/ssrfa98oni1&p=useless','https://www.testvuln.com?url=http://revsuit.com/ssrfa98oni2&p=useless', ... ,'https://www.testvuln.com?url=//revsuit.com/ssrfa98oni5&p=useless`']
,它们可能全部攻击成功.
然而,因为我们在规则的 `flagFormat` 中使用了匿名分组,RevSuit 将会在数据库中查询连接的 `flagGroup`,在这个例子里也就是 `ssrfa98oni` ,只有当它是第一次出现时,才会向客户端推送 `flag`
,所以客户端只会收到 `ssrfa98oni1` 这一个 `flag` ,这足以确认这个请求的 URL 参数存在漏洞了。
### 多模块联动
在实际的渗透测试场景中,一些特定的操作可以通过 RevSuit 多个模块配合,快速、简单地完成。下面以一个 Java Web 环境中 盲XXE 漏洞利用场景为例,展示如何使用 RevSuit 的 HTTP 和 FTP
模块,配合模板变量,快速完成内网端口扫描。
首先创建一个 HTTP 规则来返回 evil.dtd, 使被攻击的目标去连接 RevSuit 的 FTP 模块,并且通过设置 FTP 连接的用户名和密码为模板变量来传递我们要扫描的 IP 和端口。
![create evil.dtd rule](./images/evil_dtd_rule.png)
然后创建一个 FTP 规则,其中 `Pasv Address` 的 Host 和 Port 通过模板变量从 FTP 连接的用户名和密码动态获取。
![create ftp scan rule](./images/ftp_scan_rule.png)
然后使用 BurpSuit 即可进行扫描,通过设置 evil.dtd 请求中的 host 和 post 参数,来指定要扫描的目标端口:
![xxe](./images/xxe.png)
运行效果如下:
![ftp-scan](images/ftp_scan.gif)
因为在 FTP被动模式 中如果 `Passive Address` 是不可达的, FTP 的连接会中断,因此我们可以通过检查 FTP 的连接是否正常退出,来判断端口是否开放。对于上面这个例子,我们成功的探测出 8005 端口和 8080
端口是开放的。
## 更多用法
一个更详细的 wiki 正在准备中,在此之前你可以自己探索...
## 反馈、建议与交流
提交 Issue 或者通过微信联系我`TGk0bjA2Cg==`
## 致谢
### 引用
本项目引用了如下优秀项目的代码:
* [https://github.com/rmb122/rogue_mysql_server](https://github.com/rmb122/rogue_mysql_server)
* [https://github.com/256dpi/newdns](https://github.com/256dpi/newdns)
### 特别感谢
感谢我的朋友[@E99p1ant](https://github.com/wuhan005/) 在我开发这个项目过程中给予非常多的建议和帮助。
## 开源许可协议
@Apache License 2.0
+1 -1
View File
@@ -1 +1 @@
.custom-icons-list[data-v-05a908c2] .anticon{margin-right:6px}body[data-v-2f6f0625],html[data-v-2f6f0625]{height:100%;margin:0}.fade-transform-enter-active[data-v-2f6f0625],.fade-transform-leave-active[data-v-2f6f0625]{transition:all .3s;opacity:0}.fade-transform-enter[data-v-2f6f0625],.fade-transform-leave[data-v-2f6f0625]{opacity:0}.fade-transform-enter-to[data-v-2f6f0625]{opacity:0}.ant-menu-item>span>a[data-v-2f6f0625]{color:hsla(0,0%,100%,.65)}.ant-menu-item-selected>span>a[data-v-2f6f0625]{color:#fff}#app[data-v-2f6f0625]{height:100%}#app .trigger[data-v-2f6f0625]{font-size:18px;line-height:64px;padding:0 24px;cursor:pointer;transition:color .3s}#app .trigger[data-v-2f6f0625]:hover{color:#1890ff}#app .logo[data-v-2f6f0625]{height:32px;background:#0a1d2d;margin:16px;text-align:center;font-size:1.2rem;color:#fff;padding-bottom:5px;border-bottom:2px solid #b6befa}.copyright[data-v-2f6f0625]{color:#888;text-align:right;margin-right:1rem}
.custom-icons-list[data-v-05a908c2] .anticon{margin-right:6px}body[data-v-3b44ba10],html[data-v-3b44ba10]{height:100%;margin:0}.fade-transform-enter-active[data-v-3b44ba10],.fade-transform-leave-active[data-v-3b44ba10]{transition:all .3s;opacity:0}.fade-transform-enter[data-v-3b44ba10],.fade-transform-leave[data-v-3b44ba10]{opacity:0}.fade-transform-enter-to[data-v-3b44ba10]{opacity:0}.ant-menu-item>span>a[data-v-3b44ba10]{color:hsla(0,0%,100%,.65)}.ant-menu-item-selected>span>a[data-v-3b44ba10]{color:#fff}#app[data-v-3b44ba10]{min-height:100%}#app .trigger[data-v-3b44ba10]{font-size:18px;line-height:64px;padding:0 24px;cursor:pointer;transition:color .3s}#app .trigger[data-v-3b44ba10]:hover{color:#1890ff}#app .logo[data-v-3b44ba10]{height:32px;background:#0a1d2d;margin:16px;text-align:center;font-size:1.2rem;color:#fff;padding-bottom:5px;border-bottom:2px solid #b6befa}.copyright[data-v-3b44ba10]{color:#888;text-align:right;margin-right:1rem}
-1
View File
@@ -1 +0,0 @@
#add-rule[data-v-1f4c0376]{margin-bottom:10px}.full-screen-icon[data-v-1f4c0376]{position:absolute;z-index:5;color:#9e9e9e;right:1px;font-size:1rem;cursor:pointer;transition:font-size .1s}.full-screen-icon[data-v-1f4c0376]:hover{font-size:1.1rem;transition:font-size .1s}
-1
View File
@@ -1 +0,0 @@
#add-rule[data-v-1361da51]{margin-bottom:10px}
-1
View File
@@ -1 +0,0 @@
#add-rule[data-v-6f29426c]{margin-bottom:10px}
+1
View File
@@ -0,0 +1 @@
#add-rule[data-v-3819ffac]{margin-bottom:10px}
+1
View File
@@ -0,0 +1 @@
#add-rule[data-v-3db1b286]{margin-bottom:10px}
+1
View File
@@ -0,0 +1 @@
#add-rule[data-v-b1cc51ba]{margin-bottom:10px}.full-screen-icon[data-v-b1cc51ba]{position:absolute;z-index:5;color:#9e9e9e;right:1px;font-size:1rem;cursor:pointer;transition:font-size .1s}.full-screen-icon[data-v-b1cc51ba]:hover{font-size:1.1rem;transition:font-size .1s}
+1 -1
View File
@@ -1 +1 @@
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>RevSuit Control Panel</title><link href="css/chunk-016c45cf.css" rel="prefetch"><link href="css/chunk-0cb5e9e6.css" rel="prefetch"><link href="css/chunk-1da7f23b.css" rel="prefetch"><link href="css/chunk-247d6284.css" rel="prefetch"><link href="css/chunk-330a7e95.css" rel="prefetch"><link href="css/chunk-3d13e56e.css" rel="prefetch"><link href="css/chunk-43748c28.css" rel="prefetch"><link href="css/chunk-49fbda44.css" rel="prefetch"><link href="css/chunk-e039e75a.css" rel="prefetch"><link href="css/chunk-fef965c2.css" rel="prefetch"><link href="js/chunk-016c45cf.js" rel="prefetch"><link href="js/chunk-08f9fbe8.js" rel="prefetch"><link href="js/chunk-0cb5e9e6.js" rel="prefetch"><link href="js/chunk-1da7f23b.js" rel="prefetch"><link href="js/chunk-247d6284.js" rel="prefetch"><link href="js/chunk-330a7e95.js" rel="prefetch"><link href="js/chunk-3d13e56e.js" rel="prefetch"><link href="js/chunk-43748c28.js" rel="prefetch"><link href="js/chunk-49fbda44.js" rel="prefetch"><link href="js/chunk-b241c712.js" rel="prefetch"><link href="js/chunk-e039e75a.js" rel="prefetch"><link href="js/chunk-fef965c2.js" rel="prefetch"><link href="css/app.css" rel="preload" as="style"><link href="css/chunk-vendors.css" rel="preload" as="style"><link href="js/app.js" rel="preload" as="script"><link href="js/chunk-vendors.js" rel="preload" as="script"><link href="css/chunk-vendors.css" rel="stylesheet"><link href="css/app.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but revsuit-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.js"></script><script src="js/app.js"></script></body></html>
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>RevSuit Control Panel</title><link href="/revsuit/admin/css/chunk-016c45cf.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-0cb5e9e6.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-193ec343.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-46a53d26.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-4ffb84ba.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-5fb70d83.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-72839f90.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-740736c7.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-ae691e78.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-f1802c3c.css" rel="prefetch"><link href="/revsuit/admin/js/chunk-016c45cf.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-0cb5e9e6.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-193ec343.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-27186dd0.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-46a53d26.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-4ffb84ba.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-5fb70d83.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-72839f90.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-740736c7.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-ae691e78.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-b241c712.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-f1802c3c.js" rel="prefetch"><link href="/revsuit/admin/css/app.css" rel="preload" as="style"><link href="/revsuit/admin/css/chunk-vendors.css" rel="preload" as="style"><link href="/revsuit/admin/js/app.js" rel="preload" as="script"><link href="/revsuit/admin/js/chunk-vendors.js" rel="preload" as="script"><link href="/revsuit/admin/css/chunk-vendors.css" rel="stylesheet"><link href="/revsuit/admin/css/app.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but revsuit-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/revsuit/admin/js/chunk-vendors.js"></script><script src="/revsuit/admin/js/app.js"></script></body></html>
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6 -6
View File
File diff suppressed because one or more lines are too long
+31 -9
View File
@@ -62,7 +62,7 @@
/>
<div v-if="isLogMode" style="float: right; min-width:60% ;padding: 12px 0;line-height: 24px;">
<a-row :gutter="24" type="flex">
<a-col :span="21">
<a-col :span="20">
<a-form-model v-show="showSettings" ref="settings" layout="inline">
<a-row :gutter="24" type="flex">
<a-col :span="9" :offset="2">
@@ -80,9 +80,23 @@
</a-row>
</a-form-model>
</a-col>
<a-col :span="3">
<a-col :span="4">
<a-popconfirm
:title="showLogNum?`This will delete all logs in the current filtered state, a total of ${this.$refs.content.pagination.total}, are you sure?`:'This will delete all logs in the current filtered state, a total of 0, are you sure?'"
ok-text="Yes"
cancel-text="No"
@visibleChange="showLogNum?delayChangeShowLogNum():showLogNum=!showLogNum"
@confirm="deleteLogs"
>
<a-icon slot="icon" type="question-circle-o" style="color: red"/>
<a-icon
:style="'font-size: 18px;padding: 12px 0;'"
type="delete"
@click="()=>{}"
/>
</a-popconfirm>
<a-icon
:style="'font-size: 18px;padding: 12px 0;'+(showSettings?'color: #1b90ff;':'')"
:style="'font-size: 18px;padding:12px 15px;'+(showSettings?'color: #1b90ff;':'')"
type="setting"
@click="showSettings = !showSettings"
/>
@@ -123,6 +137,7 @@ export default {
pageSize: store.pageSize,
collapsed: false,
showSettings: false,
showLogNum: false,
openKeys: [],
version: "",
};
@@ -130,7 +145,7 @@ export default {
computed: {
isLogMode() {
return this.$route.path.includes('logs')
}
},
},
methods: {
timing() {
@@ -145,15 +160,20 @@ export default {
getVersion().then(res => {
this.version = res.data.result
})
},
deleteLogs() {
this.$refs.content.delete()
},
delayChangeShowLogNum() {
setTimeout(() => {
this.showLogNum = !this.showLogNum
}, 1000)
}
},
mounted() {
if (localStorage.getItem("autoRefresh") === null) {
this.autoRefresh = true;
}
if (this.autoRefresh && this.isLogMode) {
this.timing()
}
this.GetVersion()
},
created() {
@@ -177,8 +197,10 @@ export default {
localStorage.setItem('autoRefresh', val)
},
isLogMode(val) {
if (!val) {
if (!val && this.timer) {
clearInterval(this.timer)
} else if (this.autoRefresh) {
this.timing()
}
},
refreshInterval(val) {
@@ -248,7 +270,7 @@ html, body {
}
#app {
height: 100%;
min-height: 100%;
}
#app .trigger {
+1 -1
View File
@@ -2,7 +2,7 @@ import axios from 'axios'
import {store} from "@/main";
const service = axios.create({
baseURL: '/revsuit/api/', // api的base_url
baseURL: location.pathname.slice(0, -'/admin/'.length) + "/api", // api的base_url
timeout: 5000, // request timeout
validateStatus: function (status) {
if (status === 403) {
+41
View File
@@ -9,6 +9,15 @@ export function getHttpRecord(params) {
})
}
export function deleteHttpRecord(params) {
return request({
url: '/record/http',
params: params,
method: 'delete',
})
}
export function getDnsRecord(params) {
return request({
url: '/record/dns',
@@ -17,6 +26,14 @@ export function getDnsRecord(params) {
})
}
export function deleteDnsRecord(params) {
return request({
url: '/record/dns',
params: params,
method: 'delete'
})
}
export function getMysqlRecord(params) {
return request({
url: '/record/mysql',
@@ -25,6 +42,14 @@ export function getMysqlRecord(params) {
})
}
export function deleteMysqlRecord(params) {
return request({
url: '/record/mysql',
params: params,
method: 'delete'
})
}
export function getRmiRecord(params) {
return request({
url: '/record/rmi',
@@ -33,10 +58,26 @@ export function getRmiRecord(params) {
})
}
export function deleteRmiRecord(params) {
return request({
url: '/record/rmi',
params: params,
method: 'delete'
})
}
export function getFtpRecord(params) {
return request({
url: '/record/ftp',
params: params,
method: 'get'
})
}
export function deleteFtpRecord(params) {
return request({
url: '/record/ftp',
params: params,
method: 'delete'
})
}
+2 -1
View File
@@ -17,7 +17,8 @@
<a-select-option value='error'>ERROR</a-select-option>
<a-select-option value='fatal'>FATAL</a-select-option>
</a-select>
<a-input :disabled="key ==='Addr' && parent==='Http'" v-else v-model="form[key]"/>
<a-input :disabled="(key ==='Addr'||key==='AdminPathPrefix') && parent==='Http'" v-else
v-model="form[key]"/>
</a-form-model-item>
</a-col>
</a-row>
+16 -1
View File
@@ -37,7 +37,7 @@
</style>
<script>
import {getDnsRecord} from '@/api/record'
import {deleteDnsRecord, getDnsRecord} from '@/api/record'
import {store} from '@/main'
import FilterDropdown from '@/components/FilterDropdown'
@@ -145,6 +145,21 @@ export default {
}
})
},
delete: function () {
let params = {
...this.filters,
}
this.loading = true;
deleteDnsRecord(params).then(() => {
this.$message.success('Deleted successfully')
this.filters = {}
this.fetch()
}).catch(e => {
if (e.response.status !== 403) {
this.$message.error('Failed to delete: ' + e.response.data.error)
}
})
},
},
mounted() {
this.fetch();
+16 -1
View File
@@ -72,7 +72,7 @@
</style>
<script>
import {getFtpRecord} from '@/api/record'
import {deleteFtpRecord, getFtpRecord} from '@/api/record'
import {store} from '@/main'
import FilterDropdown from '@/components/FilterDropdown'
@@ -234,6 +234,21 @@ export default {
}
})
},
delete: function () {
let params = {
...this.filters,
}
this.loading = true;
deleteFtpRecord(params).then(() => {
this.$message.success('Deleted successfully')
this.filters = {}
this.fetch()
}).catch(e => {
if (e.response.status !== 403) {
this.$message.error('Failed to delete: ' + e.response.data.error)
}
})
},
},
mounted() {
this.fetch();
+16 -1
View File
@@ -49,7 +49,7 @@
</style>
<script>
import {getHttpRecord} from '@/api/record'
import {getHttpRecord, deleteHttpRecord} from '@/api/record'
import {store} from '@/main'
import FilterDropdown from '@/components/FilterDropdown'
@@ -179,6 +179,21 @@ export default {
}
})
},
delete: function () {
let params = {
...this.filters,
}
this.loading = true;
deleteHttpRecord(params).then(() => {
this.$message.success('Deleted successfully')
this.filters = {}
this.fetch()
}).catch(e => {
if (e.response.status !== 403) {
this.$message.error('Failed to delete: ' + e.response.data.error)
}
})
},
},
mounted() {
this.fetch();
+16 -1
View File
@@ -70,7 +70,7 @@
</style>
<script>
import {getMysqlRecord} from '@/api/record'
import {deleteMysqlRecord, getMysqlRecord} from '@/api/record'
import {store} from '@/main'
import FilterDropdown from '@/components/FilterDropdown'
@@ -231,6 +231,21 @@ export default {
}
})
},
delete: function () {
let params = {
...this.filters,
}
this.loading = true;
deleteMysqlRecord(params).then(() => {
this.$message.success('Deleted successfully')
this.filters = {}
this.fetch()
}).catch(e => {
if (e.response.status !== 403) {
this.$message.error('Failed to delete: ' + e.response.data.error)
}
})
},
},
mounted() {
this.fetch();
+18 -2
View File
@@ -37,7 +37,7 @@
</style>
<script>
import {getRmiRecord} from '@/api/record'
import {deleteRmiRecord, getRmiRecord} from '@/api/record'
import {store} from '@/main'
import FilterDropdown from '@/components/FilterDropdown'
@@ -110,7 +110,8 @@ export default {
onShowSizeChange: (current, size) => {
store.pageSize = size
}
}, filters: {},
},
filters: {},
order: "desc",
loading: false,
columns,
@@ -146,6 +147,21 @@ export default {
}
})
},
delete: function () {
let params = {
...this.filters,
}
this.loading = true;
deleteRmiRecord(params).then(() => {
this.$message.success('Deleted successfully')
this.filters = {}
this.fetch()
}).catch(e => {
if (e.response.status !== 403) {
this.$message.error('Failed to delete: ' + e.response.data.error)
}
})
},
},
mounted() {
this.fetch();
+2 -2
View File
@@ -51,7 +51,7 @@
<span slot="label">
Value
<a-tooltip
title="Support template such as ${varname}">
title="Support template such as ${flag}/${custom_varname}">
<a-icon type="question-circle-o"/>
</a-tooltip>
</span>
@@ -90,7 +90,7 @@
</a-drawer>
<!-- rule table -->
<a-table
style="overflow-x: auto;"
style="overflow-x: auto;"
:columns="columns"
:data-source="data"
:loading="loading"
+1 -1
View File
@@ -42,7 +42,7 @@
<a-tooltip
title="1. The data to be returned when the client executes the download request.
2. Please use base64 encoding.
3. Support template such as ${user}/${password}/${varname}">
3. Support template such as ${user}/${password}/${flag}/${custom_varname}">
<a-icon type="question-circle-o"/>
</a-tooltip>
</span>
+1 -1
View File
@@ -21,7 +21,7 @@
<span slot="label">
Response Status Code
<a-tooltip
title="Number between 100-600, or template such as ${query.varname}/${body.varname}/${header.varname}">
title="Number between 100-600, or template such as ${query.varname}/${body.varname}/${header.varname}/${flag}/${custom_varname}">
<a-icon type="question-circle-o"/>
</a-tooltip>
</span>
+3 -3
View File
@@ -12,13 +12,13 @@ module.exports = {
'/api': {
target: 'http://localhost:10000',
pathRewrite: {
'^/revsuit/api': '/revsuit/api'
'^/api': '/revsuit/api'
}
}
},
},
productionSourceMap:false,
productionSourceMap: false,
runtimeCompiler: true,
filenameHashing: false,
publicPath: ''
publicPath: '/revsuit/admin/',
}
+13 -10
View File
@@ -6,26 +6,29 @@ require (
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 // indirect
github.com/fatih/color v1.10.0 // indirect
github.com/gabriel-vasile/mimetype v1.2.0
github.com/gin-gonic/gin v1.6.3
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/gin-gonic/gin v1.7.2
github.com/go-playground/validator/v10 v10.7.0 // indirect
github.com/go-sql-driver/mysql v1.5.0
github.com/golang/protobuf v1.4.3 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/jinzhu/now v1.1.2 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/mattn/go-sqlite3 v1.14.6 // indirect
github.com/miekg/dns v1.1.38
github.com/oschwald/geoip2-golang v1.5.0
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sinlov/qqwry-golang v0.0.0-20191204062238-bea9868bbbf4
github.com/stretchr/testify v1.6.1
github.com/ugorji/go v1.2.4 // indirect
github.com/stretchr/testify v1.7.0
github.com/ugorji/go v1.2.6 // indirect
github.com/urfave/cli/v2 v2.3.0
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
golang.org/x/sys v0.0.0-20210217105451-b926d437f341 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/yaml.v2 v2.4.0
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
golang.org/x/text v0.3.6 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
gorm.io/driver/sqlite v1.1.4
gorm.io/gorm v1.21.4
+39 -26
View File
@@ -137,8 +137,8 @@ github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2H
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/gin-gonic/gin v1.7.2 h1:Tg03T9yM2xa8j6I3Z3oqLaQRSmKvxPd6g/2HJ6zICFA=
github.com/gin-gonic/gin v1.7.2/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
@@ -197,9 +197,9 @@ github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8c
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/go-playground/validator/v10 v10.7.0 h1:gLi5ajTBBheLNt0ctewgq7eolXoDALQd5/y90Hh9ZgM=
github.com/go-playground/validator/v10 v10.7.0/go.mod h1:xm76BBt941f7yWdGnI2DVPFFg1UK3YY04qifoXU3lOk=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
@@ -226,8 +226,9 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
@@ -235,8 +236,8 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-github/v27 v27.0.4/go.mod h1:/0Gr8pJ55COkmv+S/yPKCczSkUPIM/LnFyubufRNIS0=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
@@ -324,8 +325,8 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
@@ -374,8 +375,9 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
@@ -427,6 +429,10 @@ github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02/go.mod h1:JNdpVEzCpXBgIiv4ds+TzhN1hrtxq6ClLrTlT9OQRSc=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/oschwald/geoip2-golang v1.5.0 h1:igg2yQIrrcRccB1ytFXqBfOHCjXWIoMv85lVJ1ONZzw=
github.com/oschwald/geoip2-golang v1.5.0/go.mod h1:xdvYt5xQzB8ORWFqPnqMwZpCpgNagttWdoZLlJQzg7s=
github.com/oschwald/maxminddb-golang v1.8.0 h1:Uh/DSnGoxsyp/KYbY1AuP0tYEwfs0sCph9p/UMXK/Hk=
github.com/oschwald/maxminddb-golang v1.8.0/go.mod h1:RXZtst0N6+FY/3qCNmZMBApR19cdQj43/NM9VkrNAis=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
@@ -518,8 +524,9 @@ github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRci
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tchap/go-patricia v0.0.0-20160729071656-dd168db6051b/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I=
github.com/tebeka/selenium v0.9.9/go.mod h1:5Fr8+pUvU6B1OiPfkdCKdXZyr5znvVkxuPd0NOdZCQc=
@@ -532,12 +539,12 @@ github.com/uber-go/atomic v1.4.0/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex
github.com/uber/jaeger-client-go v2.16.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-lib v2.0.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go v1.2.4 h1:cTciPbZ/VSOzCLKclmssnfQ/jyoVyOcJ3aoJyUV1Urc=
github.com/ugorji/go v1.2.4/go.mod h1:EuaSCk8iZMdIspsu6HXH7X2UGKw1ezO4wCfGszGmmo4=
github.com/ugorji/go v1.2.6 h1:tGiWC9HENWE2tqYycIqFTNorMmFRVhNwCpDOpWqnk8E=
github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ugorji/go/codec v1.2.4 h1:C5VurWRRCKjuENsbM6GYVw8W++WVW9rSxoACKIvxzz8=
github.com/ugorji/go/codec v1.2.4/go.mod h1:bWBu1+kIRWcF8uMklKaJrR6fTWQOwAlrIzX22pHwryA=
github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ=
github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
@@ -577,8 +584,8 @@ golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -628,8 +635,9 @@ golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -668,21 +676,25 @@ golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191224085550-c709ea063b76/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210217105451-b926d437f341 h1:2/QtM1mL37YmcsT8HaDNHDgTqqFVw+zr8UzMiBVLzYU=
golang.org/x/sys v0.0.0-20210217105451-b926d437f341/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -759,10 +771,11 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/DataDog/dd-trace-go.v1 v1.17.0/go.mod h1:DVp8HmDh8PuTu2Z0fVVlBsyWaC++fzwVCaGWylTe3tg=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=
+1
View File
@@ -16,6 +16,7 @@ func Start() {
log.ConsoleConfig{
Level: log.LevelInfo,
})
defer log.Stop()
app := &cli.App{
Name: "RevSuit",
Usage: "An Open-Sourced Reverse Platform Designed for Receive Various Kinds of Connection",
+6 -1
View File
@@ -1,11 +1,16 @@
version: 1.1
version: 1.3
addr: :10000
token:
domain:
external_ip: # You need to make sure that your target can access the server through this ip.
admin_path_prefix: "/revsuit"
database: revsuit.db
log_level: info
ip_location_database:
database: "qqwry" # qqwry or geoip.
geo_license_key: "" # Mandatory field, if you choose to use GeoIP.
http:
ip_header:
dns:
+11 -3
View File
@@ -2,11 +2,19 @@ package database
import "gorm.io/gorm"
var DB *gorm.DB
var (
DB *gorm.DB
Driver DriverType
)
func InitDB(driver, dsn string) (err error) {
type DriverType = string
const Sqlite = "sqlite"
func InitDB(driver DriverType, dsn string) (err error) {
Driver = driver
switch driver {
case "sqlite":
case Sqlite:
DB, err = NewSqlite3(dsn)
}
return err
+6
View File
@@ -0,0 +1,6 @@
package ipinfo
type Config struct {
Database string
GeoLicenseKey string `yaml:"geo_license_key"`
}
+5
View File
@@ -0,0 +1,5 @@
package ipinfo
type Database interface {
Area(string) string
}
+96
View File
@@ -0,0 +1,96 @@
package geoip
import (
"archive/tar"
"bytes"
"compress/gzip"
"crypto/tls"
"fmt"
"io"
"net/http"
"os"
"strings"
"time"
log "unknwon.dev/clog/v2"
)
const (
Url = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=%s&suffix=tar.gz"
)
func get(url string) (b []byte, err error) {
var resp *http.Response
client := http.Client{
Timeout: 90 * time.Second,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // disable verify
}}
request, _ := http.NewRequest(http.MethodGet, url, nil)
request.Header.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36")
resp, err = client.Do(request)
if err != nil {
return
}
defer func(Body io.ReadCloser) {
err := Body.Close()
if err != nil {
log.Warn("%v", err)
}
}(resp.Body)
return io.ReadAll(resp.Body)
}
func extractTarGz(gzipStream io.Reader) error {
uncompressedStream, err := gzip.NewReader(gzipStream)
if err != nil {
return err
}
tarReader := tar.NewReader(uncompressedStream)
for {
header, err := tarReader.Next()
if err == io.EOF {
break
}
if err != nil {
return err
}
switch header.Typeflag {
case tar.TypeReg:
if !strings.HasSuffix(header.Name, "GeoLite2-City.mmdb") {
continue
}
outFile, err := os.Create("GeoLite2-City.mmdb")
if err != nil {
return err
}
if _, err := io.Copy(outFile, tarReader); err != nil {
_ = outFile.Close()
return err
}
err = outFile.Close()
if err != nil {
log.Warn("%v", err)
}
}
}
return nil
}
func download(licenseKey string) (err error) {
var GeoLite2TarGz []byte
log.Info("Downloading GeoLite2-City.mmdb...")
if GeoLite2TarGz, err = get(fmt.Sprintf(Url, licenseKey)); err != nil {
return err
}
return extractTarGz(bytes.NewReader(GeoLite2TarGz))
}
+67
View File
@@ -0,0 +1,67 @@
package geoip
import (
"fmt"
"net"
"os"
"sync"
"time"
"github.com/oschwald/geoip2-golang"
log "unknwon.dev/clog/v2"
)
type Database struct {
geo *geoip2.Reader
}
var geo *geoip2.Reader
var once sync.Once
// Area returns IpArea according to ip
func (db *Database) Area(ip string) string {
defer func() {
_ = recover()
}()
record, err := db.geo.City(net.ParseIP(ip))
if err != nil {
return ""
}
country := record.Country.Names["en"]
city := record.City.Names["en"]
if city == "" {
city = record.Location.TimeZone
}
return fmt.Sprintf("%s %s", country, city)
}
func checkUpdate(licenseKey string) {
info, err := os.Stat("GeoLite2-City.mmdb")
if err != nil {
if os.IsNotExist(err) {
err := download(licenseKey)
if err != nil {
log.Warn("Download GeoLite2-City.mmdb failed, caused by:%v, recommend to download it by yourself otherwise the `IpArea` will be null", err)
}
}
} else if -time.Until(info.ModTime()) > 7*24*time.Hour {
log.Info("Updating GeoLite2-City.mmdb...")
err := download(licenseKey)
if err != nil {
log.Warn("Update GeoLite2-City.mmdb failed, please download GeoLite2-City.mmdb by yourself")
}
}
}
func New(licenseKey string) *Database {
once.Do(func() {
var err error
checkUpdate(licenseKey)
geo, err = geoip2.Open("GeoLite2-City.mmdb")
if err != nil {
log.Error("Load GeoLite2-City.mmdb failed, `IpArea` will be null")
}
})
return &Database{geo: geo}
}
+27
View File
@@ -0,0 +1,27 @@
package ipinfo
import (
"github.com/li4n0/revsuit/internal/ipinfo/geoip"
"github.com/li4n0/revsuit/internal/ipinfo/qqwry"
log "unknwon.dev/clog/v2"
)
var db Database
func Area(ip string) string {
if db != nil {
return db.Area(ip)
}
return ""
}
func Init(config Config) {
switch config.Database {
case "qqwry":
db = qqwry.New()
case "geoip":
db = geoip.New(config.GeoLicenseKey)
default:
log.Fatal("wrong ip location database type: %q", config.Database)
}
}
@@ -6,8 +6,9 @@ import (
"crypto/tls"
"encoding/binary"
"errors"
"io/ioutil"
"io"
"net/http"
"os"
"sync"
"time"
@@ -16,10 +17,11 @@ import (
const (
CopyWriteUrl = "https://qqwry.mirror.noc.one/copywrite.rar"
QqwryUrl = "https://qqwry.mirror.noc.one/qqwry.rar"
Url = "https://qqwry.mirror.noc.one/qqwry.rar"
)
func get(url string) (b []byte, err error) {
var resp *http.Response
client := http.Client{
Timeout: 90 * time.Second,
Transport: &http.Transport{
@@ -28,14 +30,19 @@ func get(url string) (b []byte, err error) {
request, _ := http.NewRequest("GET", url, nil)
request.Header.Add("User-Agent", "Nali/2.1.2 (Nali CLI, https://nali.skk.moe)")
resp, err := client.Do(request)
resp, err = client.Do(request)
if err != nil {
return
}
defer resp.Body.Close()
b, err = ioutil.ReadAll(resp.Body)
return b, err
defer func(Body io.ReadCloser) {
err := Body.Close()
if err != nil {
log.Warn("%v", err)
}
}(resp.Body)
return io.ReadAll(resp.Body)
}
func getKey(b []byte) (key uint32, err error) {
@@ -47,26 +54,36 @@ func getKey(b []byte) (key uint32, err error) {
}
func decrypt(b []byte, key uint32) (_ []byte, err error) {
var rc io.ReadCloser
for i := 0; i < 0x200; i++ {
key *= uint32(0x805)
key++
key &= uint32(0xff)
b[i] = b[i] ^ byte(key)
}
rc, err := zlib.NewReader(bytes.NewBuffer(b))
rc, err = zlib.NewReader(bytes.NewBuffer(b))
if err != nil {
return
}
defer rc.Close()
return ioutil.ReadAll(rc)
defer func(rc io.ReadCloser) {
err := rc.Close()
if err != nil {
log.Warn("%v", err)
}
}(rc)
return io.ReadAll(rc)
}
func download() (err error) {
var (
copyWriteData, qqwryData []byte
wg sync.WaitGroup
key uint32
)
log.Info("Downloading qqwry.dat...")
wg.Add(2)
go func() {
defer wg.Done()
@@ -77,23 +94,21 @@ func download() (err error) {
go func() {
defer wg.Done()
if qqwryData, err = get(QqwryUrl); err != nil {
if qqwryData, err = get(Url); err != nil {
return
}
}()
wg.Wait()
if err != nil {
return err
}
var key uint32
if key, err = getKey(copyWriteData); err != nil {
return
}
b, err := decrypt(qqwryData, key)
if err != nil {
return err
}
_ = ioutil.WriteFile("qqwry.dat", b, 0644)
return nil
if err != nil {
return err
}
if key, err = getKey(copyWriteData); err != nil {
return err
}
if b, err := decrypt(qqwryData, key); err != nil {
return err
} else {
return os.WriteFile("qqwry.dat", b, 0644)
}
}
@@ -9,14 +9,29 @@ import (
log "unknwon.dev/clog/v2"
)
type Database struct {
wry *qqwry.QQwry
}
// Area returns IpArea according to ip
func (db *Database) Area(ip string) string {
defer func() {
_ = recover()
}()
if db.wry == nil {
return ""
}
ipData := db.wry.SearchByIPv4(ip)
if ipData.Area == " CZ88.NET" {
return ipData.Country
}
return ipData.Country + " " + ipData.Area
}
var wry *qqwry.QQwry
var once sync.Once
func init() {
_ = log.NewConsole(100,
log.ConsoleConfig{
Level: log.LevelInfo,
})
func checkUpdate() {
info, err := os.Stat("qqwry.dat")
if err != nil {
if os.IsNotExist(err) {
@@ -25,7 +40,7 @@ func init() {
log.Warn("Download qqwry.dat failed, caused by:%v, recommend to download it by yourself otherwise the `IpArea` will be null", err)
}
}
} else if -time.Until(info.ModTime()) > 5*24*time.Hour {
} else if -time.Until(info.ModTime()) > 7*24*time.Hour {
log.Info("Updating qqwry.dat...")
err := download()
if err != nil {
@@ -34,8 +49,9 @@ func init() {
}
}
func GetQQWry() *qqwry.QQwry {
func New() *Database {
once.Do(func() {
checkUpdate()
qqwry.DatData.FilePath = "qqwry.dat"
init := qqwry.DatData.InitDatFile()
if v, ok := init.(error); ok {
@@ -46,6 +62,5 @@ func GetQQWry() *qqwry.QQwry {
}
wry = qqwry.NewQQwry()
})
return wry
return &Database{wry: wry}
}
-16
View File
@@ -1,16 +0,0 @@
package qqwry
// Area returns IpArea according to ip
func Area(ip string) string {
defer func() {
_ = recover()
}()
if GetQQWry() == nil {
return ""
}
ipData := GetQQWry().SearchByIPv4(ip)
if ipData.Area == " CZ88.NET" {
return ipData.Country
}
return ipData.Country + " " + ipData.Area
}
+1 -1
View File
@@ -13,7 +13,7 @@ type Record interface {
}
type BaseRecord struct {
Record `gorm:"-" json:"-"`
Record `gorm:"-" json:"-" notice:"-"`
ID uint `gorm:"primarykey" form:"id" json:"id" notice:"-"`
RuleName string `gorm:"index" form:"rule_name" json:"rule_name" notice:"rule"`
Flag string `gorm:"index" form:"flag" json:"flag" `
+1
View File
@@ -60,6 +60,7 @@ func (br BaseRule) Match(s string) (flag, flagGroup string, vars map[string]stri
vars[name] = strings.TrimSpace(matched[j])
}
}
vars["flag"] = flag
return flag, flagGroup, vars
}
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"time"
"github.com/li4n0/revsuit/internal/database"
"github.com/li4n0/revsuit/internal/ipinfo"
"github.com/li4n0/revsuit/internal/newdns"
"github.com/li4n0/revsuit/internal/qqwry"
"github.com/li4n0/revsuit/internal/recycler"
"github.com/li4n0/revsuit/internal/rule"
"github.com/patrickmn/go-cache"
@@ -135,7 +135,7 @@ func (s *Server) newZone(name string) *newdns.Zone {
continue
}
r, err := newRecord(_rule, flag, domain, ip, qqwry.Area(ip))
r, err := newRecord(_rule, flag, domain, ip, ipinfo.Area(ip))
if err != nil {
log.Warn("DNS record(rule_id:%s) created failed :%s", _rule.Name, err)
return nil, nil
+29 -1
View File
@@ -1,6 +1,7 @@
package dns
import (
"net/http"
"strconv"
"time"
@@ -8,6 +9,8 @@ import (
"github.com/li4n0/revsuit/internal/database"
"github.com/li4n0/revsuit/internal/notice"
"github.com/li4n0/revsuit/internal/record"
"gorm.io/gorm"
log "unknwon.dev/clog/v2"
)
var _ record.Record = (*Record)(nil)
@@ -41,7 +44,7 @@ func newRecord(rule *Rule, flag, domain, remoteIp, ipArea string) (r *Record, er
return r, database.DB.Create(r).Error
}
func ListRecords(c *gin.Context) {
func Records(c *gin.Context) {
var (
dnsRecord Record
res []Record
@@ -80,6 +83,31 @@ func ListRecords(c *gin.Context) {
db.Where("rule_name = ?", dnsRecord.RuleName)
}
//Delete records
if c.Request.Method == http.MethodDelete {
if err := db.Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(&res).Error; err != nil {
c.JSON(400, gin.H{
"status": "failed",
"error": err.Error(),
"data": nil,
})
return
}
if database.Driver == database.Sqlite {
db.Exec("VACUUM")
}
c.JSON(200, gin.H{
"status": "succeed",
"error": nil,
})
log.Info("%d dns records deleted by %s", db.RowsAffected, c.Request.RemoteAddr)
return
}
//List records
page, err := strconv.Atoi(c.Query("page"))
if err != nil {
c.JSON(400, gin.H{
+30 -3
View File
@@ -1,15 +1,17 @@
package ftp
import (
"net/http"
"strconv"
"time"
"github.com/gin-gonic/gin"
"github.com/li4n0/revsuit/internal/database"
"github.com/li4n0/revsuit/internal/file"
"github.com/li4n0/revsuit/internal/ipinfo"
"github.com/li4n0/revsuit/internal/notice"
"github.com/li4n0/revsuit/internal/qqwry"
"github.com/li4n0/revsuit/internal/record"
"gorm.io/gorm"
log "unknwon.dev/clog/v2"
)
@@ -53,7 +55,7 @@ func NewRecord(rule *Rule, flag, user, password, method, path, ip, area string,
return r, database.DB.Create(r).Error
}
func ListRecords(c *gin.Context) {
func Records(c *gin.Context) {
var (
ftpRecord Record
res []Record
@@ -105,6 +107,31 @@ func ListRecords(c *gin.Context) {
db.Where("rule_name = ?", ftpRecord.RuleName)
}
//Delete records
if c.Request.Method == http.MethodDelete {
if err := db.Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(&res).Error; err != nil {
c.JSON(400, gin.H{
"status": "failed",
"error": err.Error(),
"data": nil,
})
return
}
if database.Driver == database.Sqlite {
db.Exec("VACUUM")
}
c.JSON(200, gin.H{
"status": "succeed",
"error": nil,
})
log.Info("%d ftp records deleted by %s", db.RowsAffected, c.Request.RemoteAddr)
return
}
//List records
page, err := strconv.Atoi(c.Query("page"))
if err != nil {
c.JSON(400, gin.H{
@@ -137,7 +164,7 @@ func ListRecords(c *gin.Context) {
func createRecord(_rule *Rule, flag, flagGroup, user, password, method, path, filename, ip string, uploadData []byte, status Status) {
// create new record
area := qqwry.Area(ip)
area := ipinfo.Area(ip)
var ftpFile *file.FTPFile
var r *Record
var err error
+4 -3
View File
@@ -10,7 +10,7 @@ import (
"github.com/li4n0/revsuit/internal/database"
"github.com/li4n0/revsuit/internal/file"
"github.com/li4n0/revsuit/internal/qqwry"
"github.com/li4n0/revsuit/internal/ipinfo"
"github.com/li4n0/revsuit/pkg/mysql/vmysql"
"github.com/pkg/errors"
log "unknwon.dev/clog/v2"
@@ -130,7 +130,7 @@ func (s *Server) ConnectionClosed(c *vmysql.Conn) {
}
}
r, err := newRecord(_rule, flag, user, schema, clientName, clientOS, ip, qqwry.Area(ip), supportLoadLocalData, files)
r, err := newRecord(_rule, flag, user, schema, clientName, clientOS, ip, ipinfo.Area(ip), supportLoadLocalData, files)
if err != nil {
log.Warn("MySQL record[rule_id: %s] created failed: %s", _rule.Name, err)
return
@@ -302,10 +302,11 @@ func (s *Server) Run() {
s.listener, err = vmysql.NewListener("tcp", s.Addr, authServer, s, s.VersionString, 0, 0)
if err != nil {
log.Error("New MySQL Server failed: %s", err)
return
}
go func() {
s.livingLock.Lock()
if !s.Enable {
s.listener.Close()
}
+28 -1
View File
@@ -1,6 +1,7 @@
package mysql
import (
"net/http"
"strconv"
"time"
@@ -9,6 +10,8 @@ import (
"github.com/li4n0/revsuit/internal/file"
"github.com/li4n0/revsuit/internal/notice"
"github.com/li4n0/revsuit/internal/record"
"gorm.io/gorm"
log "unknwon.dev/clog/v2"
)
var _ record.Record = (*Record)(nil)
@@ -51,7 +54,7 @@ func newRecord(rule *Rule, flag, username, schema, clientName, clientOS, remoteI
return r, database.DB.Create(r).Error
}
func ListRecords(c *gin.Context) {
func Records(c *gin.Context) {
var (
mysqlRecord Record
res []Record
@@ -103,6 +106,30 @@ func ListRecords(c *gin.Context) {
}
}
//Delete records
if c.Request.Method == http.MethodDelete {
if err := db.Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(&res).Error; err != nil {
c.JSON(400, gin.H{
"status": "failed",
"error": err.Error(),
"data": nil,
})
return
}
if database.Driver == database.Sqlite {
db.Exec("VACUUM")
}
c.JSON(200, gin.H{
"status": "succeed",
"error": nil,
})
log.Info("%d mysql records deleted by %s", db.RowsAffected, c.Request.RemoteAddr)
return
}
//List records
page, err := strconv.Atoi(c.Query("page"))
if err != nil {
c.JSON(400, gin.H{
+2 -2
View File
@@ -13,7 +13,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/li4n0/revsuit/internal/database"
"github.com/li4n0/revsuit/internal/qqwry"
"github.com/li4n0/revsuit/internal/ipinfo"
log "unknwon.dev/clog/v2"
)
@@ -174,7 +174,7 @@ func (s *Server) Receive(c *gin.Context) {
}
// create new record
r, err := NewRecord(_rule, flag, c.Request.Method, u, ip, qqwry.Area(ip), string(raw))
r, err := NewRecord(_rule, flag, c.Request.Method, u, ip, ipinfo.Area(ip), string(raw))
if err != nil {
log.Warn("HTTP record[rule_id:%d] created failed :%s", _rule.ID, err)
code, err := strconv.Atoi(compileTpl(c, _rule.ResponseStatusCode, vars))
+29 -2
View File
@@ -1,6 +1,7 @@
package rhttp
import (
"net/http"
"strconv"
"time"
@@ -8,6 +9,8 @@ import (
"github.com/li4n0/revsuit/internal/database"
"github.com/li4n0/revsuit/internal/notice"
"github.com/li4n0/revsuit/internal/record"
"gorm.io/gorm"
log "unknwon.dev/clog/v2"
)
var _ record.Record = (*Record)(nil)
@@ -44,7 +47,7 @@ func NewRecord(rule *Rule, flag, method, url, ip, area, raw string) (r *Record,
return r, database.DB.Create(r).Error
}
func ListRecords(c *gin.Context) {
func Records(c *gin.Context) {
var (
httpRecord Record
res []Record
@@ -78,7 +81,7 @@ func ListRecords(c *gin.Context) {
db.Where("method = ?", httpRecord.Method)
}
if httpRecord.URI != "" {
db.Where("path like ?", "%"+httpRecord.URI+"%")
db.Where("uri like ?", "%"+httpRecord.URI+"%")
}
if httpRecord.RemoteIP != "" {
db.Where("remote_ip = ?", httpRecord.RemoteIP)
@@ -87,6 +90,30 @@ func ListRecords(c *gin.Context) {
db.Where("rule_name = ?", httpRecord.RuleName)
}
//Delete records
if c.Request.Method == http.MethodDelete {
if err := db.Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(&res).Error; err != nil {
c.JSON(400, gin.H{
"status": "failed",
"error": err.Error(),
"data": nil,
})
return
}
if database.Driver == database.Sqlite {
db.Exec("VACUUM")
}
c.JSON(200, gin.H{
"status": "succeed",
"error": nil,
})
log.Info("%d http records deleted by %s", db.RowsAffected, c.Request.RemoteAddr)
return
}
//List records
page, err := strconv.Atoi(c.Query("page"))
if err != nil {
c.JSON(400, gin.H{
+29 -1
View File
@@ -1,6 +1,7 @@
package rmi
import (
"net/http"
"strconv"
"time"
@@ -8,6 +9,8 @@ import (
"github.com/li4n0/revsuit/internal/database"
"github.com/li4n0/revsuit/internal/notice"
"github.com/li4n0/revsuit/internal/record"
"gorm.io/gorm"
log "unknwon.dev/clog/v2"
)
var _ record.Record = (*Record)(nil)
@@ -40,7 +43,7 @@ func NewRecord(rule *Rule, flag, path, ip, area string) (r *Record, err error) {
return r, database.DB.Create(r).Error
}
func ListRecords(c *gin.Context) {
func Records(c *gin.Context) {
var (
rmiRecord Record
res []Record
@@ -80,6 +83,31 @@ func ListRecords(c *gin.Context) {
db.Where("rule_name = ?", rmiRecord.RuleName)
}
//Delete records
if c.Request.Method == http.MethodDelete {
if err := db.Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(&res).Error; err != nil {
c.JSON(400, gin.H{
"status": "failed",
"error": err.Error(),
"data": nil,
})
return
}
if database.Driver == database.Sqlite {
db.Exec("VACUUM")
}
c.JSON(200, gin.H{
"status": "succeed",
"error": nil,
})
log.Info("%d rmi records deleted by %s", db.RowsAffected, c.Request.RemoteAddr)
return
}
//List records
page, err := strconv.Atoi(c.Query("page"))
if err != nil {
c.JSON(400, gin.H{
+2 -2
View File
@@ -10,7 +10,7 @@ import (
"time"
"github.com/li4n0/revsuit/internal/database"
"github.com/li4n0/revsuit/internal/qqwry"
"github.com/li4n0/revsuit/internal/ipinfo"
"github.com/li4n0/revsuit/internal/recycler"
"github.com/pkg/errors"
log "unknwon.dev/clog/v2"
@@ -111,7 +111,7 @@ func (s *Server) handleConnection(conn net.Conn) {
continue
}
area := qqwry.Area(ip)
area := ipinfo.Area(ip)
// create new record
r, err := NewRecord(_rule, flag, path, ip, area)
+16 -13
View File
@@ -1,6 +1,7 @@
package server
import (
"github.com/li4n0/revsuit/internal/ipinfo"
"github.com/li4n0/revsuit/pkg/dns"
"github.com/li4n0/revsuit/pkg/ftp"
"github.com/li4n0/revsuit/pkg/mysql"
@@ -16,17 +17,19 @@ type noticeConfig struct {
}
type Config struct {
Version float64
Addr string
Token string
Domain string
ExternalIP string `yaml:"external_ip"`
Database string
LogLevel string `yaml:"log_level"`
Notice noticeConfig
rhttp.Config
DNS dns.Config
MySQL mysql.Config
RMI rmi.Config
FTP ftp.Config
Version float64
Addr string
Token string
Domain string
ExternalIP string `yaml:"external_ip"`
AdminPathPrefix string `yaml:"admin_path_prefix"`
Database string
LogLevel string `yaml:"log_level"`
IpLocationDatabase ipinfo.Config `yaml:"ip_location_database"`
Notice noticeConfig
HTTP rhttp.Config
DNS dns.Config
MySQL mysql.Config
RMI rmi.Config
FTP ftp.Config
}
+2 -2
View File
@@ -15,9 +15,9 @@ import (
log "unknwon.dev/clog/v2"
)
func auth(c *gin.Context) {
func (revsuit *Revsuit) auth(c *gin.Context) {
c.SetSameSite(http.SameSiteLaxMode)
c.SetCookie("token", c.Request.Header["Token"][0], 0, "/revsuit/api/", "", false, true)
c.SetCookie("token", c.Request.Header["Token"][0], 0, revsuit.config.AdminPathPrefix, "", false, true)
c.String(200, "pong")
}
+14 -8
View File
@@ -3,6 +3,7 @@ package server
import (
"io/fs"
"net/http"
"path"
"github.com/gin-gonic/gin"
"github.com/li4n0/revsuit/frontend"
@@ -28,7 +29,7 @@ func (revsuit *Revsuit) registerRouter() {
func (revsuit *Revsuit) registerPlatformRouter() {
// /api need Authorization
api := revsuit.http.Router.Group("/revsuit/api")
api := revsuit.http.Router.Group(revsuit.config.AdminPathPrefix + "/api")
api.Use(func(c *gin.Context) {
cookieToken, err := c.Request.Cookie("token")
if !(c.Request.Header.Get("Token") == revsuit.http.Token || err == nil && cookieToken.Value == revsuit.http.Token) {
@@ -39,7 +40,7 @@ func (revsuit *Revsuit) registerPlatformRouter() {
revsuit.http.ApiGroup = api
//platform routers
api.GET("/auth", auth)
api.GET("/auth", revsuit.auth)
api.GET("/events", revsuit.events)
api.GET("/ping", ping)
api.GET("/version", version)
@@ -53,7 +54,7 @@ func (revsuit *Revsuit) registerHttpRouter() {
if err != nil {
log.Fatal("Failed to sub path `dist`: %v", err)
}
revsuit.http.Router.StaticFS("/revsuit/admin", http.FS(fe))
revsuit.http.Router.StaticFS(path.Clean(revsuit.config.AdminPathPrefix+"/admin"), http.FS(fe))
// init settings router group
settingsGroup := revsuit.http.ApiGroup.Group("setting")
@@ -76,19 +77,24 @@ func (revsuit *Revsuit) registerHttpRouter() {
recordGroup := revsuit.http.ApiGroup.Group("/record")
httpGroup := recordGroup.Group("/http")
httpGroup.GET("", rhttp.ListRecords)
httpGroup.GET("", rhttp.Records)
httpGroup.DELETE("", rhttp.Records)
dnsGroup := recordGroup.Group("/dns")
dnsGroup.GET("", dns.ListRecords)
dnsGroup.GET("", dns.Records)
dnsGroup.DELETE("", dns.Records)
mysqlGroup := recordGroup.Group("/mysql")
mysqlGroup.GET("", mysql.ListRecords)
mysqlGroup.GET("", mysql.Records)
mysqlGroup.DELETE("", mysql.Records)
rmiGroup := recordGroup.Group("/rmi")
rmiGroup.GET("", rmi.ListRecords)
rmiGroup.GET("", rmi.Records)
rmiGroup.DELETE("", rmi.Records)
ftpGroup := recordGroup.Group("/ftp")
ftpGroup.GET("", ftp.ListRecords)
ftpGroup.GET("", ftp.Records)
ftpGroup.DELETE("", ftp.Records)
// init rule router group
ruleGroup := revsuit.http.ApiGroup.Group("/rule")
+6 -4
View File
@@ -6,6 +6,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/li4n0/revsuit/internal/database"
"github.com/li4n0/revsuit/internal/file"
"github.com/li4n0/revsuit/internal/ipinfo"
"github.com/li4n0/revsuit/internal/notice"
"github.com/li4n0/revsuit/internal/record"
"github.com/li4n0/revsuit/pkg/dns"
@@ -17,7 +18,7 @@ import (
log "unknwon.dev/clog/v2"
)
const VERSION = "0.1.4-beta"
const VERSION = "0.2.1"
type Revsuit struct {
config *Config
@@ -59,7 +60,7 @@ func initDatabase(dsn string) {
Level: log.LevelInfo,
})
err := database.InitDB("sqlite", dsn)
err := database.InitDB(database.Sqlite, dsn)
if err != nil {
log.Fatal(err.Error())
}
@@ -178,6 +179,7 @@ func New(c *Config) *Revsuit {
initDatabase(c.Database)
logLevel := initLog(c.LogLevel)
ipinfo.Init(c.IpLocationDatabase)
initNotice(c.Notice)
s := &Revsuit{
@@ -204,8 +206,8 @@ func New(c *Config) *Revsuit {
if c.Token != "" {
s.http.SetToken(c.Token)
}
if c.IpHeader != "" {
s.http.SetIpHeader(c.IpHeader)
if c.HTTP.IpHeader != "" {
s.http.SetIpHeader(c.HTTP.IpHeader)
}
if c.Domain != "" {
s.dns.SetServerDomain(c.Domain)
+4 -3
View File
@@ -153,10 +153,11 @@ func (revsuit *Revsuit) getPlatformConfig(c *gin.Context) {
res["Addr"] = revsuit.config.Addr
res["Token"] = revsuit.config.Token
res["Domain"] = revsuit.config.Domain
res["AdminPathPrefix"] = revsuit.config.AdminPathPrefix
res["ExternalIP"] = revsuit.config.ExternalIP
res["Database"] = revsuit.config.Database
res["LogLevel"] = revsuit.config.LogLevel
res["IpHeader"] = revsuit.config.IpHeader
res["IpHeader"] = revsuit.config.HTTP.IpHeader
c.JSON(200, res)
}
@@ -194,8 +195,8 @@ func (revsuit *Revsuit) updatePlatformConfig(c *gin.Context) {
log.Info("Update platform config [database] to %s", form["Database"])
}
if form["IpHeader"] != revsuit.config.IpHeader {
revsuit.config.IpHeader = form["IpHeader"]
if form["IpHeader"] != revsuit.config.HTTP.IpHeader {
revsuit.config.HTTP.IpHeader = form["IpHeader"]
revsuit.http.SetIpHeader(form["IpHeader"])
log.Info("Update http config [ip_header] to %s", form["IpHeader"])
}