Skip to content

Commit

Permalink
优化一些东西
Browse files Browse the repository at this point in the history
  • Loading branch information
yhy0 committed May 20, 2023
1 parent 4fa0967 commit 336a1c5
Show file tree
Hide file tree
Showing 17 changed files with 75 additions and 84 deletions.
2 changes: 1 addition & 1 deletion README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<img alt="Release" src="https://img.shields.io/github/license/yhy0/ChYing"/>
</a>
<a href="https://github.com/yhy0/ChYing">
<img alt="Release" src="https://img.shields.io/badge/release-v0.8.2-brightgreen"/>
<img alt="Release" src="https://img.shields.io/badge/release-v0.9-brightgreen"/>
</a>
<a href="https://github.com/yhy0/ChYing">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/yhy0/ChYing?color=9cf"/>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<img alt="Release" src="https://img.shields.io/github/license/yhy0/ChYing"/>
</a>
<a href="https://github.com/yhy0/ChYing">
<img alt="Release" src="https://img.shields.io/badge/release-v0.8.2-brightgreen"/>
<img alt="Release" src="https://img.shields.io/badge/release-v0.9-brightgreen"/>
</a>
<a href="https://github.com/yhy0/ChYing">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/yhy0/ChYing?color=9cf"/>
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"version": "0.9.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/components/Swagger.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<n-card>
<n-space vertical align="center">
<n-space align="center">
<n-input v-model:value="targetUrl" autosize placeholder="https://example.com/swagger-ui.html" />
<n-space>
<n-input v-model:value="targetUrl" autosize style="min-width: 450px" placeholder="https://example.com/swagger-ui.html" />
<n-button type="primary" @click="swagger">
解析
</n-button>
Expand All @@ -13,7 +13,6 @@
<template #checked>proxy</template>
<template #unchecked>unproxy</template>
</n-switch>
<n-tag size="small"> 使用 Burp 代理可以更好的获取展示 </n-tag>
</n-space>
</n-space>
</n-card>
Expand All @@ -39,7 +38,7 @@
:data="data"
@update:filters="handleUpdateFilter"
:row-props="rowProps"
:max-height="250"
:max-height="400"
style="margin-top: 10px"
>
</n-data-table>
Expand Down Expand Up @@ -83,7 +82,7 @@ function handleCheckedChange(checked) {
if (checked) {
const inputValue = inputRef.value.$el.querySelector("input").value;
Proxy(inputValue).then(result => {
if (result.Error !== "") {
if (result.error !== "") {
message.error(result.msg + "; " + result.error)
return
}
Expand Down
61 changes: 30 additions & 31 deletions frontend/src/components/Twj.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,41 +57,41 @@ EventsOn("Percentage", Percentage => {
</script>

<template>
<n-grid x-gap="12" :cols="2">
<n-gi>
<n-space vertical>
<n-card :bordered="false" title="Encoded" size="small">
<n-input
v-model:value="twj.jwt"
type="textarea"
@input="parser"
:autosize="{
minRows: 10,
maxRows: 10,
}"
/>
<n-grid x-gap="12" :cols="2">
<n-gi>
<n-space vertical>
<n-card :bordered="false" title="Encoded" size="small">
<n-input
v-model:value="twj.jwt"
type="textarea"
@input="parser"
:autosize="{
minRows: 10,
maxRows: 10,
}"
/>
</n-card>

<n-card :bordered="false" title="Secret" size="small">
<n-input v-model:value="twj.secret" type="text" placeholder="secret" @input="verify" />
</n-card>
</n-space>
</n-gi>
<n-gi>
<n-card title="Header" size="small" style="margin-bottom: 16px; margin-top: 10px">
<n-code id="header" language="json" :code="twj.header" word-wrap style="white-space: pre-wrap; text-align: left;"/>
</n-card>

<n-card :bordered="false" title="Secret" size="small">
<n-input v-model:value="twj.secret" type="text" placeholder="secret" @input="verify" />
<n-card title="Payload" size="small" style="margin-bottom: 16px; margin-top: 10px">
<n-code id="payload" language="json" :code="twj.payload" word-wrap style="white-space: pre-wrap; text-align: left;"/>
</n-card>
</n-space>
</n-gi>
<n-gi>
<n-card title="Header" size="small" style="margin-bottom: 16px; margin-top: 10px">
<n-code id="header" language="json" :code="twj.header" word-wrap style="white-space: pre-wrap; text-align: left;"/>
</n-card>

<n-card title="Payload" size="small" style="margin-bottom: 16px; margin-top: 10px">
<n-code id="payload" language="json" :code="twj.payload" word-wrap style="white-space: pre-wrap; text-align: left;"/>
</n-card>

<n-card title="Verify" size="small" style="margin-bottom: 16px; margin-top: 10px">
<n-code id="signature" language="json" :code="twj.signature" word-wrap style="white-space: pre-wrap; text-align: left;"/>
</n-card>
<n-card title="Verify" size="small" style="margin-bottom: 16px; margin-top: 10px">
<n-code id="signature" language="json" :code="twj.signature" word-wrap style="white-space: pre-wrap; text-align: left;"/>
</n-card>

</n-gi>
</n-grid>
</n-gi>
</n-grid>

<n-button type="primary" @click="brute">
Brute
Expand All @@ -111,6 +111,5 @@ EventsOn("Percentage", Percentage => {
</n-tag>
</span>
</div>

</template>

15 changes: 10 additions & 5 deletions frontend/src/components/fuzz/Fuzz.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@
:data="data"
@update:filters="handleUpdateFilter"
:row-props="rowProps"
:max-height="250"
:max-height="300"
style="margin-top: 10px"
striped
>
</n-data-table>
</n-card>
Expand Down Expand Up @@ -130,6 +131,7 @@ function fuzz() {
if(result === "") {
alertType.value = "success";
alertContent.value = target + " 扫描完成";
percentage.value = "100"
message.success(target + " 扫描完成");
} else {
message.error(target + result);
Expand All @@ -150,11 +152,11 @@ function handleCheckedChange(checked) {
if (checked) {
const inputValue = inputRef.value.$el.querySelector("input").value;
Proxy(inputValue).then(result => {
if (result.Error !== "") {
message.error(result.Msg + "; " + result.Error)
if (result.error !== "") {
message.error(result.msg + "; " + result.error)
return
}
message.success(result.Msg)
message.success(result.msg)
})
} else {
Proxy("").then(result => {
Expand Down Expand Up @@ -245,7 +247,10 @@ EventsOn("Fuzz", e => {
const filterCode = () => {
statusColumn.filterOptionValue = fcode.value;
if(fcode.value !== "") {
statusColumn.filterOptionValue = fcode.value;
}
};
const filterLength = () => {
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/style.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
html {
height: 100%;
overflow: hidden;
}

body {
margin: 0;
font-family: "MesloLGS NF", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
Expand Down
Binary file modified images/ChYing.mp4
Binary file not shown.
2 changes: 1 addition & 1 deletion tools/burpSuite/BurpSuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func Run(port int) {

// 这种不错,通过添加插件的形式,这样只要实现了接口,p.AddAddon(xxxx), 然后就会自动执行相应的操作
// 添加一个日志记录插件
Proxy.AddAddon(&proxy.LogAddon{})
//Proxy.AddAddon(&proxy.LogAddon{})

Proxy.AddAddon(&Burp{})

Expand Down
2 changes: 1 addition & 1 deletion tools/burpSuite/mitmproxy/addon/dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package addon
import (
"bytes"
"fmt"
log "github.com/sirupsen/logrus"
"io"
"net/http"
"os"
"strings"
"unicode"

log "github.com/sirupsen/logrus"
"github.com/yhy0/ChYing/tools/burpSuite/mitmproxy/proxy"
)

Expand Down
14 changes: 7 additions & 7 deletions tools/burpSuite/mitmproxy/addon/maplocal.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"path"
"strings"

log "github.com/sirupsen/logrus"
"github.com/yhy0/ChYing/tools/burpSuite/mitmproxy/proxy"
)

Expand Down Expand Up @@ -37,7 +36,7 @@ func (item *mapLocalItem) response(req *proxy.Request) (string, *proxy.Response)
StatusCode: 404,
}
}
log.Errorf("map local %v os.Stat error", filepath)
//log.Errorf("map local %v os.Stat error", filepath)
return nil, &proxy.Response{
StatusCode: 500,
}
Expand All @@ -48,7 +47,7 @@ func (item *mapLocalItem) response(req *proxy.Request) (string, *proxy.Response)
respFile := func(filepath string) *proxy.Response {
file, err := os.Open(filepath)
if err != nil {
log.Errorf("map local %v os.Open error", filepath)
//log.Errorf("map local %v os.Open error", filepath)
return &proxy.Response{
StatusCode: 500,
}
Expand Down Expand Up @@ -83,7 +82,7 @@ func (item *mapLocalItem) response(req *proxy.Request) (string, *proxy.Response)
if !stat.IsDir() {
return filepath, respFile(filepath)
} else {
log.Errorf("map local %v should be file", filepath)
//log.Errorf("map local %v should be file", filepath)
return filepath, &proxy.Response{
StatusCode: 500,
}
Expand All @@ -102,9 +101,10 @@ func (ml *MapLocal) Requestheaders(f *proxy.Flow) {
}
for _, item := range ml.Items {
if item.match(f.Request) {
aurl := f.Request.URL.String()
localfile, resp := item.response(f.Request)
log.Infof("map local %v to %v", aurl, localfile)
//aurl := f.Request.URL.String()
//localfile, resp := item.response(f.Request)
//log.Infof("map local %v to %v", aurl, localfile)
_, resp := item.response(f.Request)
f.Response = resp
return
}
Expand Down
7 changes: 3 additions & 4 deletions tools/burpSuite/mitmproxy/addon/mapremote.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"strings"

"github.com/samber/lo"
log "github.com/sirupsen/logrus"
"github.com/tidwall/match"
"github.com/yhy0/ChYing/tools/burpSuite/mitmproxy/proxy"
)
Expand Down Expand Up @@ -90,11 +89,11 @@ func (mr *MapRemote) Requestheaders(f *proxy.Flow) {
}
for _, item := range mr.Items {
if item.match(f.Request) {
aurl := f.Request.URL.String()
//aurl := f.Request.URL.String()
f.Request = item.replace(f.Request)
f.UseSeparateClient = true
burl := f.Request.URL.String()
log.Infof("map remote %v to %v", aurl, burl)
//burl := f.Request.URL.String()
//log.Infof("map remote %v to %v", aurl, burl)
return
}
}
Expand Down
13 changes: 0 additions & 13 deletions tools/burpSuite/mitmproxy/notice.go

This file was deleted.

7 changes: 3 additions & 4 deletions tools/burpSuite/mitmproxy/proxy/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"time"

uuid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
)

// client connection
Expand Down Expand Up @@ -151,7 +150,7 @@ func (connCtx *ConnContext) initHttpServerConn() {
}

func (connCtx *ConnContext) initServerTcpConn(req *http.Request) error {
log.Debugln("in initServerTcpConn")
//log.Debugln("in initServerTcpConn")
ServerConn := newServerConn()
connCtx.ServerConn = ServerConn
ServerConn.Address = connCtx.pipeConn.host
Expand Down Expand Up @@ -246,7 +245,7 @@ func (c *wrapClientConn) Close() error {
if c.closed {
return c.closeErr
}
log.Debugln("in wrapClientConn close", c.connCtx.ClientConn.Conn.RemoteAddr())
//log.Debugln("in wrapClientConn close", c.connCtx.ClientConn.Conn.RemoteAddr())

c.closed = true
c.closeErr = c.Conn.Close()
Expand Down Expand Up @@ -293,7 +292,7 @@ func (c *wrapServerConn) Close() error {
if c.closed {
return c.closeErr
}
log.Debugln("in wrapServerConn close", c.connCtx.ClientConn.Conn.RemoteAddr())
//log.Debugln("in wrapServerConn close", c.connCtx.ClientConn.Conn.RemoteAddr())

c.closed = true
c.closeErr = c.Conn.Close()
Expand Down
3 changes: 1 addition & 2 deletions tools/burpSuite/mitmproxy/proxy/flowencoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"strings"

"github.com/andybalholm/brotli"
log "github.com/sirupsen/logrus"
)

var errEncodingNotSupport = errors.New("content-encoding not support")
Expand Down Expand Up @@ -62,7 +61,7 @@ func (r *Response) DecodedBody() ([]byte, error) {
DecodedBodyStr, decodedErr := decode(enc, r.Body)
if decodedErr != nil {
r.decodedErr = decodedErr
log.Error(r.decodedErr)
//log.Error(r.decodedErr)
return nil, decodedErr
}

Expand Down
Loading

0 comments on commit 336a1c5

Please sign in to comment.