Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8023a9b021 | ||
|
|
56153510e1 | ||
|
|
be7343191d | ||
|
|
b1773ee5e9 | ||
|
|
18707cec47 | ||
|
|
993d3867ee | ||
|
|
d4d7435265 | ||
|
|
70f17453fd | ||
|
|
ef38cbc790 | ||
|
|
6205772a59 | ||
|
|
807186be61 | ||
|
|
1c625dd881 | ||
|
|
30194479d1 | ||
|
|
ddeced3540 | ||
|
|
dc43b6973a | ||
|
|
d1013c2416 | ||
|
|
f7be2bc2e6 | ||
|
|
42d1e35913 | ||
|
|
74f512d214 | ||
|
|
b945069117 | ||
|
|
efcbff23d8 | ||
|
|
dcabfb1546 | ||
|
|
9e6d758c0f | ||
|
|
1da20feb06 | ||
|
|
3044c9b735 | ||
|
|
b44e4891a6 | ||
|
|
cbbf3ba0ba | ||
|
|
1144f67d37 | ||
|
|
bc6e3962f8 |
@@ -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.
|
||||
@@ -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.
|
||||
@@ -16,10 +16,10 @@ jobs:
|
||||
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:
|
||||
@@ -41,6 +41,7 @@ jobs:
|
||||
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
|
||||
- name: Upload the artifacts
|
||||
uses: li4n0/upload-release-action@v2
|
||||
with:
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
# local files
|
||||
qqwry.dat
|
||||
revsuit.db
|
||||
revsuit.db-shm
|
||||
revsuit.db-wal
|
||||
GeoLite2-City.mmdb
|
||||
*.db
|
||||
*.db-shm
|
||||
*.db-wal
|
||||
|
||||
# local config
|
||||
config.yaml
|
||||
config.yaml*
|
||||
|
||||
# binary
|
||||
revsuit
|
||||
@@ -19,4 +20,9 @@ revsuit
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
*.sw?
|
||||
|
||||
## node
|
||||
package.json
|
||||
package-lock.json
|
||||
node_modules/
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# 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.
|
||||
|
||||
### [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)
|
||||
|
||||
### Features
|
||||
|
||||
* **dns:** support custom dns service
|
||||
port ([7fb4c97](https://github.com/Li4n0/revsuit/commit/7fb4c97279e57d120a4e4aef5dda5c8f3c024835))
|
||||
* **frontend:** auto refresh data when switching back to the revsuit
|
||||
console ([9b31406](https://github.com/Li4n0/revsuit/commit/9b314062a39ddc7acf7a7eab3570b24b9bb9d122))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **http:** fix the problem that ip_header configuration does not take
|
||||
effect ([b76c39e](https://github.com/Li4n0/revsuit/commit/b76c39e2fc1ada189feb783fdec76daffa11d1c7))
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2021 Li4n0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,4 +1,249 @@
|
||||
# RevSuit - A Reverse Platform Developed in Golang
|
||||
# RevSuit - A Flexible and Powerful Reverse Connection Platform
|
||||
|
||||
English |[简体中文](./README.zh-CN.md)
|
||||
|
||||
## Overview
|
||||
RevSuit is an open-sourced Reverse Platform designed for receive connection from target host in bug bounty.
|
||||
|
||||
RevSuit is a flexible and powerful reverse connection platform designed for receiving connection from target host in
|
||||
penetration. It currently supports HTTP, DNS, RMI, MySQL and FTP protocols.
|
||||
|
||||
Flexible:
|
||||
|
||||
1. RevSuit can set flexible rules to capture different connections.
|
||||
2. Deploy and run via binaries without worrying about nasty dependency errors.
|
||||
|
||||
Powerful:
|
||||
|
||||
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.
|
||||
4. Support push notifications to popular office software.
|
||||
5. Other thoughtful and detailed features.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
### Preparation
|
||||
|
||||
Download the latest release firstly.
|
||||
|
||||
RevSuit will generate default configuration file on first run. Modify the configuration file according to your needs,
|
||||
then re-run.
|
||||
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
After running, you can visit the `/revsuit/admin/` path of HTTP Server and enter the token to access the control panel.
|
||||
|
||||
### Create Rules and Receive Connection
|
||||
|
||||
Take the creation of HTTP rules as an example:
|
||||
|
||||
A few notes are as follows:
|
||||
|
||||
1. The `name` and `flagFormat` of rule are unique.
|
||||
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 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.
|
||||
|
||||
As shown below, we create a rule that uses the built-in template variables and custom template variables of the http
|
||||
protocol, and names it `test_create_rule`:
|
||||
|
||||

|
||||
|
||||
Then make a request that satisfies the rule and view the response.
|
||||
|
||||

|
||||
|
||||
The request will be logged on the platform at the same time.
|
||||
|
||||

|
||||
|
||||
### Notice
|
||||
|
||||
If you want to be notified of new connections on your office software, you can configure the webhook address of the
|
||||
relevant software in the configuration file and turn on the `Notice` switch for the corresponding rule. Only support to
|
||||
four software types currently: dingtalk,wechat,lark,slack.(Discord and telegram support is in the plan.)
|
||||
|
||||
### Import/Export Rules
|
||||
|
||||
If you're migrating platforms or purging data, it can be a hassle to recreate rules. That's why the platform supports
|
||||
import and export of rules.
|
||||
|
||||
The entry point for this function is located at `Settings>RULES`.
|
||||
|
||||
The rules are stored in yaml format for import and export, like the following:
|
||||
|
||||
```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:
|
||||
... ...
|
||||
```
|
||||
|
||||
## Advance Usage
|
||||
|
||||
### Use with Scanner
|
||||
|
||||
RevSuit was split from my scanner project, so its native support works with scanners.
|
||||
|
||||
From RevSuit's perspective, we call a scanner a client.
|
||||
|
||||
#### Establish connection
|
||||
|
||||
RevSuit
|
||||
uses [HTTP Server-sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
|
||||
(SSE) to establish a one-way communication channel with the client.
|
||||
|
||||
The API for the channel is: `/revsuit/api/events?message` .The client first needs to add the `Token: your token` header
|
||||
to the Header, and then access the API to establish the channel. When the platform receives a new connection, the `flag`
|
||||
captured by the rule will be passed to the client through this channel.
|
||||

|
||||
|
||||
Here is a [simple demo](https://gist.github.com/Li4n0/21aa0bec2d626114a729ca2677efb05a) using Golang's sse library as an
|
||||
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.
|
||||
|
||||
#### Temporary storage queue
|
||||
|
||||
RevSuit will store `flag` temporarily in the queue when there is no client connection and send it when the client
|
||||
connects, so you don't have to worry about missing the vulnerability because the client disconnects. (This is especially
|
||||
helpful for discovering delay-triggered vulnerabilities.)
|
||||
|
||||
#### Use flagGroup
|
||||
|
||||
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:
|
||||
|
||||
```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!"
|
||||
```
|
||||
|
||||
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=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`. 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 in Java Web, showing how to use RevSuit's HTTP and FTP
|
||||
modules, combined with template variables, to quickly complete a port scan.
|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
Then create an FTP rule that receives the Host and port to be scanned from the user and password template variables, set
|
||||
to Pasv Address.
|
||||
|
||||

|
||||
|
||||
Then use BurpSuit to launch the scan, by setting the host and port parameters in the evil.dtd URL to set the target of
|
||||
the port scan.
|
||||
|
||||

|
||||
|
||||
The running effect is as follows:
|
||||
|
||||

|
||||
|
||||
It because the FTP connection will be crashed if `Passive Address` is not accessible, we can determine whether the port
|
||||
is open or not based on whether the connection exits normally.For this example, we successfully detected that port 8005
|
||||
and 8080 are open.
|
||||
|
||||
## More Usage
|
||||
|
||||
A more detailed wiki is being prepared, you can explore by yourself before it.
|
||||
|
||||
## Feedback, Suggestions and Communication
|
||||
|
||||
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)
|
||||
|
||||
### Specifically
|
||||
|
||||
Thanks to my friend [@E99p1ant](https://github.com/wuhan005/) for all the help and advice I received during the
|
||||
development of this project.
|
||||
|
||||
## License
|
||||
|
||||
@Apache License 2.0
|
||||
|
||||
@@ -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。
|
||||
|
||||
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协议的规则,其中使用了内置的模板变量和自定义的模板变量:
|
||||
|
||||

|
||||
|
||||
然后发送一个满足这条规则的请求来进行测试,可以看到响应的内容中各个模板变量都获取到了对应的值:
|
||||
|
||||

|
||||
|
||||
这条请求同时会被记录在平台:
|
||||
|
||||

|
||||
|
||||
### 通知
|
||||
|
||||
通过配置 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` 就会通过这条管道传递给客户端。
|
||||
|
||||

|
||||
|
||||
这里是一个使用 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 和端口。
|
||||
|
||||

|
||||
|
||||
然后创建一个 FTP 规则,其中 `Pasv Address` 的 Host 和 Port 通过模板变量从 FTP 连接的用户名和密码动态获取。
|
||||
|
||||

|
||||
|
||||
然后使用 BurpSuit 即可进行扫描,通过设置 evil.dtd 请求中的 host 和 post 参数,来指定要扫描的目标端口:
|
||||
|
||||

|
||||
|
||||
运行效果如下:
|
||||
|
||||

|
||||
|
||||
因为在 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 @@
|
||||
.custom-icons-list[data-v-05a908c2] .anticon{margin-right:6px}body[data-v-6db702b8],html[data-v-6db702b8]{height:100%;margin:0}.fade-transform-enter-active[data-v-6db702b8],.fade-transform-leave-active[data-v-6db702b8]{transition:all .3s;opacity:0}.fade-transform-enter[data-v-6db702b8],.fade-transform-leave[data-v-6db702b8]{opacity:0}.fade-transform-enter-to[data-v-6db702b8]{opacity:0}.ant-menu-item>span>a[data-v-6db702b8]{color:hsla(0,0%,100%,.65)}.ant-menu-item-selected>span>a[data-v-6db702b8]{color:#fff}#nav[data-v-6db702b8]{height:100%}#nav .trigger[data-v-6db702b8]{font-size:18px;line-height:64px;padding:0 24px;cursor:pointer;transition:color .3s}#nav .trigger[data-v-6db702b8]:hover{color:#1890ff}#nav .logo[data-v-6db702b8]{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-6db702b8]{color:#888;text-align:right;margin-right:1rem}
|
||||
.custom-icons-list[data-v-05a908c2] .anticon{margin-right:6px}body[data-v-1bc6d13e],html[data-v-1bc6d13e]{height:100%;margin:0}.fade-transform-enter-active[data-v-1bc6d13e],.fade-transform-leave-active[data-v-1bc6d13e]{transition:all .3s;opacity:0}.fade-transform-enter[data-v-1bc6d13e],.fade-transform-leave[data-v-1bc6d13e]{opacity:0}.fade-transform-enter-to[data-v-1bc6d13e]{opacity:0}.ant-menu-item>span>a[data-v-1bc6d13e]{color:hsla(0,0%,100%,.65)}.ant-menu-item-selected>span>a[data-v-1bc6d13e]{color:#fff}#app[data-v-1bc6d13e]{min-height:100%}#app .trigger[data-v-1bc6d13e]{font-size:18px;line-height:64px;padding:0 24px;cursor:pointer;transition:color .3s}#app .trigger[data-v-1bc6d13e]:hover{color:#1890ff}#app .logo[data-v-1bc6d13e]{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-1bc6d13e]{color:#888;text-align:right;margin-right:1rem}
|
||||
@@ -1 +0,0 @@
|
||||
#add-rule[data-v-e8e0136c]{margin-bottom:10px}
|
||||
@@ -1 +0,0 @@
|
||||
#add-rule[data-v-2586daf9]{margin-bottom:10px}
|
||||
@@ -0,0 +1 @@
|
||||
#add-rule[data-v-50ca3b7c]{margin-bottom:10px}
|
||||
@@ -0,0 +1 @@
|
||||
#add-rule[data-v-4fed8448]{margin-bottom:10px}
|
||||
@@ -1 +0,0 @@
|
||||
#add-rule[data-v-487bb706]{margin-bottom:10px}
|
||||
@@ -0,0 +1 @@
|
||||
#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}
|
||||
@@ -0,0 +1 @@
|
||||
#add-rule[data-v-1361da51]{margin-bottom:10px}
|
||||
@@ -0,0 +1 @@
|
||||
#add-rule[data-v-6f29426c]{margin-bottom:10px}
|
||||
@@ -1 +0,0 @@
|
||||
#add-rule[data-v-169b853c]{margin-bottom:10px}.full-screen-icon[data-v-169b853c]{position:absolute;z-index:5;color:#9e9e9e;right:1px;font-size:1rem;cursor:pointer;transition:font-size .1s}.full-screen-icon[data-v-169b853c]:hover{font-size:1.1rem;transition:font-size .1s}
|
||||
@@ -1 +0,0 @@
|
||||
#add-rule[data-v-98f944a6]{margin-bottom:10px}
|
||||
@@ -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-012c9c90.css" rel="prefetch"><link href="css/chunk-0155152b.css" rel="prefetch"><link href="css/chunk-1da7f23b.css" rel="prefetch"><link href="css/chunk-2e835d68.css" rel="prefetch"><link href="css/chunk-330a7e95.css" rel="prefetch"><link href="css/chunk-3d13e56e.css" rel="prefetch"><link href="css/chunk-d4730ae2.css" rel="prefetch"><link href="css/chunk-e00d17cc.css" rel="prefetch"><link href="css/chunk-e039e75a.css" rel="prefetch"><link href="css/chunk-fef965c2.css" rel="prefetch"><link href="js/chunk-012c9c90.js" rel="prefetch"><link href="js/chunk-0155152b.js" rel="prefetch"><link href="js/chunk-08f9fbe8.js" rel="prefetch"><link href="js/chunk-1da7f23b.js" rel="prefetch"><link href="js/chunk-2e835d68.js" rel="prefetch"><link href="js/chunk-330a7e95.js" rel="prefetch"><link href="js/chunk-3d13e56e.js" rel="prefetch"><link href="js/chunk-b241c712.js" rel="prefetch"><link href="js/chunk-d4730ae2.js" rel="prefetch"><link href="js/chunk-e00d17cc.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-36508a38.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-43748c28.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-46a53d26.css" rel="prefetch"><link href="/revsuit/admin/css/chunk-49fbda44.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/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-36508a38.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-43748c28.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-46a53d26.js" rel="prefetch"><link href="/revsuit/admin/js/chunk-49fbda44.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-b241c712.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>
|
||||
@@ -5,13 +5,15 @@
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "revsuit-frontend",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"ant-design-vue": "^1.2.4",
|
||||
"axios": "^0.21.1",
|
||||
"core-js": "^3.6.5",
|
||||
"vue": "^2.6.11",
|
||||
"vue-router": "^3.2.0"
|
||||
"vue-router": "^3.2.0",
|
||||
"vue-visibility-change": "^1.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
@@ -4808,7 +4810,8 @@
|
||||
"node_modules/de-indent": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npm.taobao.org/de-indent/download/de-indent-1.0.2.tgz",
|
||||
"integrity": "sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0="
|
||||
"integrity": "sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.1",
|
||||
@@ -6896,6 +6899,7 @@
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npm.taobao.org/he/download/he-1.2.0.tgz",
|
||||
"integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8=",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"he": "bin/he"
|
||||
}
|
||||
@@ -13517,6 +13521,7 @@
|
||||
"version": "2.6.12",
|
||||
"resolved": "https://registry.npm.taobao.org/vue-template-compiler/download/vue-template-compiler-2.6.12.tgz",
|
||||
"integrity": "sha1-lH7XGWdEyKUoXr4SM/6WBDf8xX4=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"de-indent": "^1.0.2",
|
||||
"he": "^1.1.0"
|
||||
@@ -13528,6 +13533,11 @@
|
||||
"integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/vue-visibility-change": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npm.taobao.org/vue-visibility-change/download/vue-visibility-change-1.2.1.tgz",
|
||||
"integrity": "sha1-0YAIv08d4slHr+VEHuBEuenGAUE="
|
||||
},
|
||||
"node_modules/warning": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npm.taobao.org/warning/download/warning-4.0.3.tgz",
|
||||
@@ -16426,8 +16436,7 @@
|
||||
"version": "4.5.11",
|
||||
"resolved": "https://registry.npm.taobao.org/@vue/cli-plugin-vuex/download/@vue/cli-plugin-vuex-4.5.11.tgz?cache=0&sync_timestamp=1615453605559&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40vue%2Fcli-plugin-vuex%2Fdownload%2F%40vue%2Fcli-plugin-vuex-4.5.11.tgz",
|
||||
"integrity": "sha1-9vYZvPtmyGzEU0DXMVKERjXlSL0=",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"@vue/cli-service": {
|
||||
"version": "4.5.11",
|
||||
@@ -16581,8 +16590,7 @@
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npm.taobao.org/@vue/preload-webpack-plugin/download/@vue/preload-webpack-plugin-1.1.2.tgz",
|
||||
"integrity": "sha1-zrkktOyzucQ4ccekKaAvhCPmIas=",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"@vue/web-component-wrapper": {
|
||||
"version": "1.3.0",
|
||||
@@ -16797,8 +16805,7 @@
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npm.taobao.org/acorn-jsx/download/acorn-jsx-5.3.1.tgz",
|
||||
"integrity": "sha1-/IZh4Rt6wVOcR9v+oucrOvNNJns=",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"acorn-walk": {
|
||||
"version": "7.2.0",
|
||||
@@ -16846,15 +16853,13 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npm.taobao.org/ajv-errors/download/ajv-errors-1.0.1.tgz?cache=0&sync_timestamp=1615411237786&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fajv-errors%2Fdownload%2Fajv-errors-1.0.1.tgz",
|
||||
"integrity": "sha1-81mGrOuRr63sQQL72FAUlQzvpk0=",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"ajv-keywords": {
|
||||
"version": "3.5.2",
|
||||
"resolved": "https://registry.npm.taobao.org/ajv-keywords/download/ajv-keywords-3.5.2.tgz?cache=0&sync_timestamp=1615647295573&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fajv-keywords%2Fdownload%2Fajv-keywords-3.5.2.tgz",
|
||||
"integrity": "sha1-MfKdpatuANHC0yms97WSlhTVAU0=",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"alphanum-sort": {
|
||||
"version": "1.0.2",
|
||||
@@ -18894,7 +18899,8 @@
|
||||
"de-indent": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npm.taobao.org/de-indent/download/de-indent-1.0.2.tgz",
|
||||
"integrity": "sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0="
|
||||
"integrity": "sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=",
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.1",
|
||||
@@ -20627,7 +20633,8 @@
|
||||
"he": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npm.taobao.org/he/download/he-1.2.0.tgz",
|
||||
"integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8="
|
||||
"integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8=",
|
||||
"dev": true
|
||||
},
|
||||
"hex-color-regex": {
|
||||
"version": "1.1.0",
|
||||
@@ -26181,6 +26188,7 @@
|
||||
"version": "2.6.12",
|
||||
"resolved": "https://registry.npm.taobao.org/vue-template-compiler/download/vue-template-compiler-2.6.12.tgz",
|
||||
"integrity": "sha1-lH7XGWdEyKUoXr4SM/6WBDf8xX4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"de-indent": "^1.0.2",
|
||||
"he": "^1.1.0"
|
||||
@@ -26192,6 +26200,11 @@
|
||||
"integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=",
|
||||
"dev": true
|
||||
},
|
||||
"vue-visibility-change": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npm.taobao.org/vue-visibility-change/download/vue-visibility-change-1.2.1.tgz",
|
||||
"integrity": "sha1-0YAIv08d4slHr+VEHuBEuenGAUE="
|
||||
},
|
||||
"warning": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npm.taobao.org/warning/download/warning-4.0.3.tgz",
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
"axios": "^0.21.1",
|
||||
"core-js": "^3.6.5",
|
||||
"vue": "^2.6.11",
|
||||
"vue-router": "^3.2.0"
|
||||
"vue-router": "^3.2.0",
|
||||
"vue-visibility-change": "^1.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<template>
|
||||
<a-layout id="nav">
|
||||
<a-layout id="app" v-visibility-change="()=>{this.$refs.content.fetch?this.$refs.content.fetch():null}">
|
||||
<a-layout-sider v-model="collapsed" :trigger="null" collapsible>
|
||||
<div class="logo"><b>R</b><span v-if="!collapsed"><b>ev</b>Suit</span></div>
|
||||
<a-menu theme="dark" mode="inline" :selectedKeys="[this.$route.path]" :open-keys.sync='openKeys'>
|
||||
<!-- <a-menu-item key="/">-->
|
||||
<a-menu theme="dark" mode="inline" :selectedKeys="[this.$route.path]" :openKeys.sync="openKeys">
|
||||
<!-- <a-menu-item key="
|
||||
/">-->
|
||||
<!-- <router-link to="/">-->
|
||||
<!-- <a-icon type="dashboard"/>-->
|
||||
<!-- <span>Dashboard</span>-->
|
||||
@@ -48,8 +49,7 @@
|
||||
<a-menu-item key="/settings">
|
||||
<router-link to="/settings">
|
||||
<a-icon type="setting"/>
|
||||
Settings
|
||||
</router-link>
|
||||
<span>Settings</span></router-link>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-layout-sider>
|
||||
@@ -60,7 +60,7 @@
|
||||
:type="collapsed ? 'menu-unfold' : 'menu-fold'"
|
||||
@click="() => (collapsed = !collapsed)"
|
||||
/>
|
||||
<div v-if="isLogMode" style="float: right; min-width:50% ;padding: 12px 0;line-height: 24px;">
|
||||
<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-form-model v-show="showSettings" ref="settings" layout="inline">
|
||||
@@ -123,7 +123,7 @@ export default {
|
||||
pageSize: store.pageSize,
|
||||
collapsed: false,
|
||||
showSettings: false,
|
||||
openKeys: ['logs'],
|
||||
openKeys: [],
|
||||
version: "",
|
||||
};
|
||||
},
|
||||
@@ -148,11 +148,19 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.autoRefresh && this.isLogMode) {
|
||||
this.timing()
|
||||
if (localStorage.getItem("autoRefresh") === null) {
|
||||
this.autoRefresh = true;
|
||||
}
|
||||
this.GetVersion()
|
||||
},
|
||||
created() {
|
||||
let unwatch = this.$watch('$route', function (to, from) {
|
||||
if (from.path === "/" && this.openKeys.length === 0) {
|
||||
this.openKeys.push(to.path.split("/")[1])
|
||||
unwatch()
|
||||
}
|
||||
})
|
||||
},
|
||||
destroyed() {
|
||||
clearInterval(this.timer)
|
||||
},
|
||||
@@ -166,12 +174,11 @@ export default {
|
||||
localStorage.setItem('autoRefresh', val)
|
||||
},
|
||||
isLogMode(val) {
|
||||
if (!val) {
|
||||
if (!val && this.timer) {
|
||||
clearInterval(this.timer)
|
||||
} else {
|
||||
} else if (this.autoRefresh) {
|
||||
this.timing()
|
||||
}
|
||||
localStorage.setItem('autoRefresh', val)
|
||||
},
|
||||
refreshInterval(val) {
|
||||
clearInterval(this.timer)
|
||||
@@ -185,8 +192,11 @@ export default {
|
||||
store.pageSize = val
|
||||
localStorage.setItem('pageSize', val)
|
||||
},
|
||||
'store.authed'() {
|
||||
this.$refs.content.fetch()
|
||||
'store.authed'(val) {
|
||||
if (val) {
|
||||
this.$refs.content.fetch()
|
||||
this.GetVersion()
|
||||
}
|
||||
},
|
||||
'store.pageSize'() {
|
||||
this.$refs.content.pagination.pageSize = store.pageSize
|
||||
@@ -236,11 +246,11 @@ html, body {
|
||||
color: white;
|
||||
}
|
||||
|
||||
#nav {
|
||||
height: 100%;
|
||||
#app {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
#nav .trigger {
|
||||
#app .trigger {
|
||||
font-size: 18px;
|
||||
line-height: 64px;
|
||||
padding: 0 24px;
|
||||
@@ -248,11 +258,11 @@ html, body {
|
||||
transition: color 0.3s;
|
||||
}
|
||||
|
||||
#nav .trigger:hover {
|
||||
#app .trigger:hover {
|
||||
color: #1890ff;
|
||||
}
|
||||
|
||||
#nav .logo {
|
||||
#app .logo {
|
||||
height: 32px;
|
||||
background: #0a1d2d;
|
||||
margin: 16px;
|
||||
|
||||
@@ -5,9 +5,6 @@ export function auth(token) {
|
||||
url: '/auth',
|
||||
method: 'get',
|
||||
headers: {"Token": token},
|
||||
validateStatus: function (status) {
|
||||
return status >= 200 && status < 300
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,8 +12,5 @@ export function getVersion() {
|
||||
return request({
|
||||
url: '/version',
|
||||
method: 'get',
|
||||
validateStatus: function (status) {
|
||||
return status >= 200 && status < 300
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
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) {
|
||||
store.authed = false
|
||||
}
|
||||
return status >= 200 && status < 300 // 默认的
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import request from './index'
|
||||
|
||||
export function getHttpConfig() {
|
||||
export function getPlatformConfig() {
|
||||
return request({
|
||||
url: '/setting/getHttpConfig',
|
||||
url: '/setting/getPlatformConfig',
|
||||
})
|
||||
}
|
||||
|
||||
export function updateHttpConfig(data) {
|
||||
export function updatePlatformConfig(data) {
|
||||
return request({
|
||||
url: '/setting/updateHttpConfig',
|
||||
url: '/setting/updatePlatformConfig',
|
||||
method: "post",
|
||||
data: data
|
||||
})
|
||||
|
||||
@@ -15,20 +15,20 @@
|
||||
<a-form-model-item :rules="rules.flagFormat" prop="flag_format">
|
||||
<span slot="label">
|
||||
Flag Format
|
||||
<a-tooltip title="Basic usage:
|
||||
1. Only when the request contains content that satisfies the flag format, the request will be captured.
|
||||
<a-tooltip :title="`Basic usage:
|
||||
1. Only when the request's ${flagField} contains content that satisfies the flag format, the request will be captured.
|
||||
2. Use regular expression syntax.
|
||||
3. The character '*' means to capture all requests.
|
||||
Advanced usage:
|
||||
1. When the regex uses grouping without group name, the platform will only notify the user or push to the client when the first group appears for the first time.
|
||||
2. When the regex uses grouping with group name, you can get these submatches through template variables and use them in other fields of the rule.">
|
||||
2. When the regex uses grouping with group name, you can get these submatches through template variables and use them in other fields of the rule.`">
|
||||
<a-icon type="question-circle-o"/>
|
||||
</a-tooltip>
|
||||
</span>
|
||||
<a-input
|
||||
v-model="form.flag_format"
|
||||
style="width: 100%"
|
||||
placeholder="please enter flag format"
|
||||
placeholder="Please enter flag format"
|
||||
:readOnly="readOnly"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
@@ -97,7 +97,7 @@ export default {
|
||||
},
|
||||
}
|
||||
},
|
||||
props: ['form', 'readOnly']
|
||||
props: ['form', 'readOnly', 'flagField']
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -4,10 +4,14 @@ import App from './App';
|
||||
import router from "@/router";
|
||||
import 'ant-design-vue/dist/antd.css';
|
||||
import '@/utils/index'
|
||||
import visibility from 'vue-visibility-change';
|
||||
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
Vue.use(Antd);
|
||||
Vue.use(visibility);
|
||||
|
||||
export const store = Vue.observable({
|
||||
authed: true,
|
||||
pageSize: localStorage.getItem("pageSize") ? parseInt(localStorage.getItem("pageSize")) : 10
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<a-table
|
||||
style="overflow-x: auto;"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
@@ -139,11 +140,8 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
console.error(e)
|
||||
if (e.response.status !== 403) {
|
||||
this.$message.error('Unknown error with status code: ' + e.response.status)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<a-table
|
||||
style="overflow-x: auto;"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
@@ -228,11 +229,8 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
console.error(e)
|
||||
if (e.response.status !== 403) {
|
||||
this.$message.error('Unknown error with status code: ' + e.response.status)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<a-table
|
||||
style="overflow-x: auto;"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
@@ -104,9 +105,9 @@ const columns = [
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'PATH',
|
||||
dataIndex: 'path',
|
||||
key: 'path',
|
||||
title: 'URI',
|
||||
dataIndex: 'uri',
|
||||
key: 'uri',
|
||||
ellipsis: true,
|
||||
scopedSlots: {
|
||||
filterDropdown: 'filterDropdown',
|
||||
@@ -173,11 +174,8 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
console.error(e)
|
||||
if (e.response.status !== 403) {
|
||||
this.$message.error('Unknown error with status code: ' + e.response.status)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<a-table
|
||||
style="overflow-x: auto;"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
@@ -120,6 +121,15 @@ const columns = [
|
||||
filterIcon: 'filterIcon',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'SCHEMA',
|
||||
dataIndex: 'schema',
|
||||
key: 'schema',
|
||||
scopedSlots: {
|
||||
filterDropdown: 'filterDropdown',
|
||||
filterIcon: 'filterIcon',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'LOAD DATA',
|
||||
dataIndex: 'load_local_data',
|
||||
@@ -216,11 +226,8 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
console.error(e)
|
||||
if (e.response.status !== 403) {
|
||||
this.$message.error('Unknown error with status code: ' + e.response.status)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<a-table
|
||||
style="overflow-x: auto;"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
@@ -109,7 +110,7 @@ export default {
|
||||
onShowSizeChange: (current, size) => {
|
||||
store.pageSize = size
|
||||
}
|
||||
}, filters: {},
|
||||
}, filters: {},
|
||||
order: "desc",
|
||||
loading: false,
|
||||
columns,
|
||||
@@ -140,11 +141,8 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
console.error(e)
|
||||
if (e.response.status !== 403) {
|
||||
this.$message.error('Unknown error with status code: ' + e.response.status)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@close="closeDrawer"
|
||||
>
|
||||
<a-form-model :model="form" ref="form" layout="vertical" @submit="handleSubmit">
|
||||
<BasicRule :form="form" :readOnly="formReadOnly"/>
|
||||
<BasicRule :form="form" :readOnly="formReadOnly" flagFormat="domain"/>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<a-form-model-item label="Type" :rules="rules.type">
|
||||
@@ -90,6 +90,7 @@
|
||||
</a-drawer>
|
||||
<!-- rule table -->
|
||||
<a-table
|
||||
style="overflow-x: auto;"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
@@ -296,7 +297,7 @@ export default {
|
||||
onShowSizeChange: (current, size) => {
|
||||
store.pageSize = size
|
||||
}
|
||||
}, filters: {},
|
||||
}, filters: {},
|
||||
loading: false,
|
||||
columns,
|
||||
colors,
|
||||
@@ -332,18 +333,8 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
marginLeft: `${335 - 600}px`,
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
if (e.response.status !== 403) {
|
||||
this.$message.error('Unknown error with status code: ' + e.response.status)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@close="closeDrawer"
|
||||
>
|
||||
<a-form-model :model="form" ref="form" layout="vertical" @submit="handleSubmit">
|
||||
<BasicRule :form="form" :readOnly="formReadOnly"/>
|
||||
<BasicRule :form="form" :readOnly="formReadOnly" flagFormat="user or password"/>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<a-form-model-item>
|
||||
@@ -28,7 +28,7 @@
|
||||
<a-input
|
||||
v-model="form.pasv_address"
|
||||
style="width: 100%"
|
||||
placeholder="use default value in the config"
|
||||
placeholder="Use `external_ip:pasv_port` by default"
|
||||
:readOnly="formReadOnly"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
@@ -78,6 +78,7 @@
|
||||
</a-drawer>
|
||||
<!-- rule table -->
|
||||
<a-table
|
||||
style="overflow-x: auto;"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
@@ -267,18 +268,8 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
marginLeft: `${335 - 600}px`,
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
if (e.response.status !== 403) {
|
||||
this.$message.error('Unknown error with status code: ' + e.response.status)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@close="closeDrawer"
|
||||
>
|
||||
<a-form-model :model="form" ref="form" layout="vertical" @submit="handleSubmit">
|
||||
<BasicRule :form="form" :readOnly="formReadOnly"/>
|
||||
<BasicRule :form="form" :readOnly="formReadOnly" flagFormat="raw message"/>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<a-form-model-item :rules="rules.response_status_code"
|
||||
@@ -130,6 +130,7 @@
|
||||
</a-drawer>
|
||||
<!-- rule table -->
|
||||
<a-table
|
||||
style="overflow-x: auto;"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
@@ -374,18 +375,8 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
marginLeft: `${335 - 600}px`,
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
if (e.response.status !== 403) {
|
||||
this.$message.error('Unknown error with status code: ' + e.response.status)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@close="closeDrawer"
|
||||
>
|
||||
<a-form-model :model="form" ref="form" layout="vertical" @submit="handleSubmit">
|
||||
<BasicRule :form="form" :readOnly="formReadOnly"/>
|
||||
<BasicRule :form="form" :readOnly="formReadOnly" :flagField="'user or schema'"/>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="Files" :rules="rules.files">
|
||||
@@ -31,7 +31,8 @@
|
||||
<a-form-model-item>
|
||||
<div class="ant-form-item-label">
|
||||
<label for="exploit-jdbc-client">Exploit Jdbc Client
|
||||
<a-tooltip placement="topLeft" title="Whether test to exploit jdbc client.">
|
||||
<a-tooltip placement="topLeft"
|
||||
title="Whether test to exploit jdbc client.">
|
||||
<a-icon type="question-circle"/>
|
||||
</a-tooltip>
|
||||
</label>
|
||||
@@ -41,8 +42,13 @@
|
||||
</a-row>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="Payload">
|
||||
<a-input-group compact v-for="payloadKey in payloadKeys" :key="payloadKey">
|
||||
<a-form-model-item>
|
||||
<label for="payload">Payload
|
||||
<a-tooltip placement="topLeft" title="Need to set ${payload} variable by flag format first. Payload which key is same as ${payload} will be used.">
|
||||
<a-icon type="question-circle"/>
|
||||
</a-tooltip>
|
||||
</label>
|
||||
<a-input-group id="payload" compact v-for="payloadKey in payloadKeys" :key="payloadKey">
|
||||
<a-input v-model="form['Key-'+payloadKey]"
|
||||
style="width: 47%;margin-bottom: 5px"
|
||||
v-decorator="['Key-'+payloadKey,]"
|
||||
@@ -94,6 +100,7 @@
|
||||
</a-drawer>
|
||||
<!-- rule table -->
|
||||
<a-table
|
||||
style="overflow-x: auto;"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
@@ -256,7 +263,7 @@ export default {
|
||||
onShowSizeChange: (current, size) => {
|
||||
store.pageSize = size
|
||||
}
|
||||
}, filters: {},
|
||||
}, filters: {},
|
||||
loading: false,
|
||||
columns,
|
||||
form: {},
|
||||
@@ -291,19 +298,14 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
this.$notification.error({
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
width: '400px',
|
||||
marginLeft: `${335 - 600}px`,
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
clickSwitch(record, prop) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@close="closeDrawer"
|
||||
>
|
||||
<a-form-model :model="form" ref="form" layout="vertical" @submit="handleSubmit">
|
||||
<BasicRule :form="form" :readOnly="formReadOnly"/>
|
||||
<BasicRule :form="form" :readOnly="formReadOnly" flagFormat="path"/>
|
||||
</a-form-model>
|
||||
<div
|
||||
:style="{
|
||||
@@ -38,6 +38,7 @@
|
||||
</a-drawer>
|
||||
<!-- rule table -->
|
||||
<a-table
|
||||
style="overflow-x: auto;"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
@@ -193,7 +194,8 @@ export default {
|
||||
onShowSizeChange: (current, size) => {
|
||||
store.pageSize = size
|
||||
}
|
||||
}, filters: {},
|
||||
},
|
||||
filters: {},
|
||||
loading: false,
|
||||
columns,
|
||||
form: {},
|
||||
@@ -225,18 +227,8 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
marginLeft: `${335 - 600}px`,
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
if (e.response.status !== 403) {
|
||||
this.$message.error('Unknown error with status code: ' + e.response.status)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getHttpConfig, updateHttpConfig} from "@/api/settings"
|
||||
import {getPlatformConfig, updatePlatformConfig} from "@/api/settings"
|
||||
import SettingForm from "@/components/SettingForm";
|
||||
|
||||
export default {
|
||||
@@ -37,7 +37,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getConfig() {
|
||||
getHttpConfig().then(res => {
|
||||
getPlatformConfig().then(res => {
|
||||
this.form = res.data
|
||||
}).catch(e => {
|
||||
this.$notification.error({
|
||||
@@ -55,10 +55,10 @@ export default {
|
||||
updateConfig() {
|
||||
this.spinning = true
|
||||
let targetConfig = JSON.stringify(this.form)
|
||||
updateHttpConfig(this.form).then(
|
||||
updatePlatformConfig(this.form).then(
|
||||
() => {
|
||||
setTimeout(() => {
|
||||
getHttpConfig().then((res) => {
|
||||
getPlatformConfig().then((res) => {
|
||||
this.spinning = false
|
||||
let nowConfig = JSON.stringify(res.data)
|
||||
if (nowConfig !== targetConfig) {
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
:active-tab-key="tabKey"
|
||||
@tabChange="key => this.tabKey = key"
|
||||
style="width: 100%;">
|
||||
<http v-if="tabKey==='HTTP'"></http>
|
||||
<dns v-else-if="tabKey==='DNS'"></dns>
|
||||
<rmi v-else-if="tabKey==='RMI'"></rmi>
|
||||
<mysql v-else-if="tabKey==='MYSQL'"></mysql>
|
||||
<ftp v-else-if="tabKey==='FTP'"></ftp>
|
||||
<notice v-else-if="tabKey==='NOTICE'"></notice>
|
||||
<rules v-else-if="tabKey==='RULES'"></rules>
|
||||
<http ref="settings" v-if="tabKey==='HTTP'"></http>
|
||||
<dns ref="settings" v-else-if="tabKey==='DNS'"></dns>
|
||||
<rmi ref="settings" v-else-if="tabKey==='RMI'"></rmi>
|
||||
<mysql ref="settings" v-else-if="tabKey==='MYSQL'"></mysql>
|
||||
<ftp ref="settings" v-else-if="tabKey==='FTP'"></ftp>
|
||||
<notice ref="settings" v-else-if="tabKey==='NOTICE'"></notice>
|
||||
<rules ref="settings" v-else-if="tabKey==='RULES'"></rules>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -42,7 +42,11 @@ export default {
|
||||
}
|
||||
}
|
||||
,
|
||||
methods: {},
|
||||
methods: {
|
||||
fetch() {
|
||||
this.$refs.settings.getConfig();
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Http,
|
||||
Dns,
|
||||
|
||||
@@ -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/',
|
||||
}
|
||||
|
||||
@@ -15,17 +15,17 @@ require (
|
||||
github.com/leodido/go-urn v1.2.1 // 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/stretchr/testify v1.7.0
|
||||
github.com/ugorji/go v1.2.4 // 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
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
|
||||
gorm.io/driver/sqlite v1.1.4
|
||||
gorm.io/gorm v1.21.4
|
||||
|
||||
@@ -427,6 +427,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 +522,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=
|
||||
@@ -668,6 +673,7 @@ 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=
|
||||
|
||||
|
After Width: | Height: | Size: 174 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 206 KiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 168 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 764 KiB |
|
After Width: | Height: | Size: 135 KiB |
@@ -7,4 +7,5 @@ const banner = `
|
||||
/ _, _/ __/ |/ /___/ / /_/ / / /_
|
||||
/_/ |_|\___/|___//____/\__,_/_/\__/
|
||||
v%s
|
||||
https://revsuit.pro`
|
||||
https://revsuit.pro
|
||||
`
|
||||
|
||||
@@ -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",
|
||||
@@ -47,10 +48,21 @@ func Start() {
|
||||
configFile = c.Path("config")
|
||||
}
|
||||
conf := &server.Config{}
|
||||
tpl := &server.Config{}
|
||||
_ = yaml.Unmarshal(configTemplate, tpl)
|
||||
if content, err := os.ReadFile(configFile); err == nil {
|
||||
if err := yaml.Unmarshal(content, conf); err != nil {
|
||||
return err
|
||||
}
|
||||
if conf.Version != tpl.Version {
|
||||
backup := fmt.Sprintf("%s_%.1f", configFile, conf.Version)
|
||||
log.Warn("Old version of configuration file detected, new configuration file being generated, old configuration backed up to %s", backup)
|
||||
if err := os.WriteFile(backup, content, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.WriteFile(configFile, configTemplate, 0644)
|
||||
}
|
||||
|
||||
} else if os.IsNotExist(err) && configFile == "config.yaml" {
|
||||
log.Warn("Generate default configurations to config.yaml, please configure and run again.")
|
||||
return os.WriteFile("config.yaml", configTemplate, 0644)
|
||||
@@ -69,13 +81,13 @@ func Start() {
|
||||
if c.String("log") != "" {
|
||||
conf.Database = c.String("log")
|
||||
}
|
||||
fmt.Printf(banner, server.VERSION)
|
||||
server.New(conf).Run()
|
||||
return nil
|
||||
},
|
||||
}
|
||||
sort.Sort(cli.FlagsByName(app.Flags))
|
||||
sort.Sort(cli.CommandsByName(app.Commands))
|
||||
fmt.Printf(banner, server.VERSION)
|
||||
|
||||
err := app.Run(os.Args)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
version: 4.0
|
||||
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:
|
||||
enable: true
|
||||
addr: :53
|
||||
rmi:
|
||||
enable: true
|
||||
addr: :1099
|
||||
@@ -18,7 +26,6 @@ mysql:
|
||||
ftp:
|
||||
enable: true
|
||||
addr: :21
|
||||
pasv_ip: 127.0.0.1 # your public network ip
|
||||
pasv_port: 2020
|
||||
notice:
|
||||
dingtalk: https://oapi.dingtalk.com/robot/send?access_token={token}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package ipinfo
|
||||
|
||||
type Config struct {
|
||||
Database string
|
||||
GeoLicenseKey string `yaml:"geo_license_key"`
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package ipinfo
|
||||
|
||||
type Database interface {
|
||||
Area(string) string
|
||||
}
|
||||
@@ -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))
|
||||
}
|
||||
@@ -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}
|
||||
}
|
||||
@@ -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}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- "1.12"
|
||||
- tip
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
before_install:
|
||||
- go get github.com/mattn/goveralls
|
||||
install:
|
||||
- go get -t ./...
|
||||
script:
|
||||
- $HOME/gopath/bin/goveralls -service=travis-ci
|
||||
@@ -1,10 +0,0 @@
|
||||
all: fmt vet lint
|
||||
|
||||
fmt:
|
||||
go fmt .
|
||||
|
||||
vet:
|
||||
go vet .
|
||||
|
||||
lint:
|
||||
golint .
|
||||
@@ -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
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var recordChan = make(chan BaseRecord, 100)
|
||||
var recordChan = make(chan BaseRecord, 1000)
|
||||
|
||||
type Record interface {
|
||||
GetFlag() string
|
||||
@@ -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" `
|
||||
|
||||
@@ -2,4 +2,5 @@ package dns
|
||||
|
||||
type Config struct {
|
||||
Enable bool
|
||||
Addr string
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
@@ -17,9 +17,11 @@ import (
|
||||
|
||||
type Server struct {
|
||||
Config
|
||||
rules []*Rule
|
||||
rulesLock sync.RWMutex
|
||||
livingLock sync.Mutex
|
||||
serverDomain string
|
||||
serverIP string
|
||||
rules []*Rule
|
||||
rulesLock sync.RWMutex
|
||||
livingLock sync.Mutex
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -35,13 +37,23 @@ func GetServer() *Server {
|
||||
return server
|
||||
}
|
||||
|
||||
func (s *Server) SetServerDomain(serverDomain string) *Server {
|
||||
s.serverDomain = serverDomain
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Server) SetServerIP(serverIP string) *Server {
|
||||
s.serverIP = serverIP
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Server) getRules() []*Rule {
|
||||
defer s.rulesLock.RUnlock()
|
||||
s.rulesLock.RLock()
|
||||
return s.rules
|
||||
}
|
||||
|
||||
func (s *Server) updateRules() error {
|
||||
func (s *Server) UpdateRules() error {
|
||||
db := database.DB.Model(new(Rule))
|
||||
defer s.rulesLock.Unlock()
|
||||
s.rulesLock.Lock()
|
||||
@@ -53,6 +65,7 @@ func newSet(_rule *Rule, name, value, ip string, _type newdns.Type) []newdns.Set
|
||||
{
|
||||
Name: name,
|
||||
Type: _type,
|
||||
TTL: _rule.TTL * time.Second,
|
||||
Records: func() []newdns.Record {
|
||||
switch _rule.Type {
|
||||
case newdns.TXT:
|
||||
@@ -82,12 +95,20 @@ func newSet(_rule *Rule, name, value, ip string, _type newdns.Type) []newdns.Set
|
||||
return []newdns.Record{{Address: value}}
|
||||
}
|
||||
}(),
|
||||
TTL: _rule.TTL * time.Second,
|
||||
},
|
||||
}
|
||||
return set
|
||||
}
|
||||
|
||||
func getZoneName(domain string) string {
|
||||
frags := strings.Split(domain, ".")
|
||||
zoneName := domain
|
||||
if len(frags) >= 2 {
|
||||
zoneName = strings.Join(frags[len(frags)-2:], ".") + "."
|
||||
}
|
||||
return zoneName
|
||||
}
|
||||
|
||||
// newZone creates new dns zone with root domain
|
||||
func (s *Server) newZone(name string) *newdns.Zone {
|
||||
defer func() {
|
||||
@@ -97,13 +118,8 @@ func (s *Server) newZone(name string) *newdns.Zone {
|
||||
}()
|
||||
|
||||
domain := strings.TrimSuffix(name, ".")
|
||||
frags := strings.Split(domain, ".")
|
||||
zoneName := name
|
||||
if len(frags) >= 2 {
|
||||
zoneName = strings.Join(frags[len(frags)-2:], ".") + "."
|
||||
}
|
||||
zone := &newdns.Zone{
|
||||
Name: zoneName,
|
||||
Name: getZoneName(domain),
|
||||
MasterNameServer: "ns1.hostmaster.com.",
|
||||
AllNameServers: []string{
|
||||
"ns1.hostmaster.com.",
|
||||
@@ -119,36 +135,39 @@ 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
|
||||
}
|
||||
log.Info("DNS record[id:%d rule:%s remote_ip:%s] has been created", r.ID, _rule.Name, ip)
|
||||
|
||||
//only send to client when this connection recorded first time.
|
||||
if _rule.PushToClient {
|
||||
if flagGroup != "" {
|
||||
var count int64
|
||||
database.DB.Where("rule_name=? and domain like ?", _rule.Name, "%"+flagGroup+"%").Model(&Record{}).Count(&count)
|
||||
if count <= 1 {
|
||||
r.PushToClient()
|
||||
log.Trace("DNS record[id:%d, flagGroup:%s] has been put to client message queue", r.ID, flagGroup)
|
||||
}
|
||||
} else {
|
||||
//only send to client or notify user when this connection recorded first time.
|
||||
var count int64
|
||||
if flagGroup != "" {
|
||||
database.DB.Where("rule_name=? and domain like ?", _rule.Name, "%"+flagGroup+"%").Model(&Record{}).Count(&count)
|
||||
}
|
||||
if count <= 1 {
|
||||
if _rule.PushToClient {
|
||||
r.PushToClient()
|
||||
log.Trace("DNS record[id:%d, flag:%s] has been put to client message queue", r.ID, flag)
|
||||
if flagGroup != "" {
|
||||
log.Trace("DNS record[id:%d, flagGroup:%s] has been put to client message queue", r.ID, flagGroup)
|
||||
} else {
|
||||
log.Trace("DNS record[id:%d] has been put to client message queue", r.ID)
|
||||
}
|
||||
}
|
||||
//send notice
|
||||
if _rule.Notice {
|
||||
go func() {
|
||||
r.Notice()
|
||||
if flagGroup != "" {
|
||||
log.Trace("DNS record[id:%d, flagGroup:%s] notice has been sent", r.ID, flagGroup)
|
||||
} else {
|
||||
log.Trace("DNS record[id:%d] notice has been sent", r.ID)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
//send notice
|
||||
if _rule.Notice {
|
||||
go func() {
|
||||
r.Notice()
|
||||
log.Trace("DNS record[id:%d] notice has been sent", r.ID)
|
||||
}()
|
||||
}
|
||||
|
||||
if _rule.Value != "" {
|
||||
value := rule.CompileTpl(_rule.Value, vars)
|
||||
_type := _rule.Type
|
||||
@@ -172,6 +191,12 @@ func (s *Server) Stop() {
|
||||
s.livingLock.Unlock()
|
||||
}
|
||||
|
||||
func (s *Server) Restart() {
|
||||
s.Stop()
|
||||
time.Sleep(time.Second * 2)
|
||||
go s.Run()
|
||||
}
|
||||
|
||||
func (s *Server) Run() {
|
||||
s.Enable = true
|
||||
s.livingLock.Lock()
|
||||
@@ -184,7 +209,7 @@ func (s *Server) Run() {
|
||||
s.livingLock.Unlock()
|
||||
}()
|
||||
|
||||
if err := s.updateRules(); err != nil {
|
||||
if err := s.UpdateRules(); err != nil {
|
||||
log.Error(err.Error())
|
||||
return
|
||||
}
|
||||
@@ -192,12 +217,34 @@ func (s *Server) Run() {
|
||||
// create server
|
||||
server := newdns.NewServer(newdns.Config{
|
||||
Handler: func(name string) (*newdns.Zone, error) {
|
||||
if name == s.serverDomain+"." {
|
||||
return &newdns.Zone{
|
||||
Name: getZoneName(s.serverDomain),
|
||||
MasterNameServer: "ns1.hostmaster.com.",
|
||||
AllNameServers: []string{
|
||||
"ns1.hostmaster.com.",
|
||||
"ns2.hostmaster.com.",
|
||||
"ns3.hostmaster.com.",
|
||||
},
|
||||
Handler: func(_, remoteAddr string) ([]newdns.Set, error) {
|
||||
return []newdns.Set{
|
||||
{
|
||||
Name: name,
|
||||
Type: newdns.A,
|
||||
TTL: 10,
|
||||
Records: []newdns.Record{
|
||||
{
|
||||
Address: s.serverIP,
|
||||
},
|
||||
}}}, nil
|
||||
}}, nil
|
||||
}
|
||||
return s.newZone(name), nil
|
||||
},
|
||||
})
|
||||
|
||||
// run server
|
||||
log.Info("Starting DNS Server at :53")
|
||||
log.Info("Starting DNS Server at :53, resolve %s to %s", s.serverDomain, s.serverIP)
|
||||
go func() {
|
||||
s.livingLock.Lock()
|
||||
if !s.Enable {
|
||||
@@ -205,7 +252,7 @@ func (s *Server) Run() {
|
||||
}
|
||||
}()
|
||||
|
||||
err := server.Run(":53")
|
||||
err := server.Run(s.Addr)
|
||||
defer server.Close()
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -47,16 +47,17 @@ func ListRecords(c *gin.Context) {
|
||||
res []Record
|
||||
count int64
|
||||
order = c.Query("order")
|
||||
pageSize int
|
||||
pageSize = 10
|
||||
)
|
||||
|
||||
if c.Query("pageSize") == "" {
|
||||
pageSize = 10
|
||||
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
|
||||
if n <= 0 || n > 100 {
|
||||
pageSize = 10
|
||||
if c.Query("pageSize") != "" {
|
||||
if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
|
||||
if n > 0 && n < 100 {
|
||||
pageSize = n
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := c.ShouldBind(&dnsRecord); err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"status": "failed",
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
type Rule struct {
|
||||
rule.BaseRule `yaml:""`
|
||||
rule.BaseRule `yaml:",inline"`
|
||||
Type newdns.Type `gorm:"default:1" form:"type" json:"type"`
|
||||
Value string `form:"value" json:"value"`
|
||||
TTL time.Duration `gorm:"ttl;default:10" form:"ttl" json:"ttl"`
|
||||
@@ -58,7 +58,7 @@ func (r *Rule) CreateOrUpdate() (err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = GetServer().updateRules()
|
||||
err = GetServer().UpdateRules()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ func (r *Rule) Delete() (err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = GetServer().updateRules()
|
||||
err = GetServer().UpdateRules()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -80,14 +80,14 @@ func ListRules(c *gin.Context) {
|
||||
res []Rule
|
||||
count int64
|
||||
order = c.Query("order")
|
||||
pageSize int
|
||||
pageSize = 10
|
||||
)
|
||||
|
||||
if c.Query("pageSize") == "" {
|
||||
pageSize = 10
|
||||
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
|
||||
if n <= 0 || n > 100 {
|
||||
pageSize = 10
|
||||
if c.Query("pageSize") != "" {
|
||||
if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
|
||||
if n > 0 && n < 100 {
|
||||
pageSize = n
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||