Skip to content

Commit

Permalink
log目录默认改到/.config/ChYing目录下
Browse files Browse the repository at this point in the history
  • Loading branch information
yhy0 committed May 24, 2023
1 parent 30af8e5 commit edd919b
Show file tree
Hide file tree
Showing 16 changed files with 137 additions and 194 deletions.
6 changes: 0 additions & 6 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/yhy0/ChYing/conf"
"github.com/yhy0/ChYing/pkg/file"
"github.com/yhy0/ChYing/pkg/httpx"
"github.com/yhy0/ChYing/pkg/log"
"github.com/yhy0/ChYing/pkg/utils"
"github.com/yhy0/ChYing/tools"
"github.com/yhy0/ChYing/tools/burpSuite"
Expand Down Expand Up @@ -183,11 +182,6 @@ func (a *App) startup(ctx context.Context) {
}
}()

log.GuiLog = &log.GuiLogger{
Ctx: ctx,
}
logging.Logger.AddHook(log.GuiLog)

httpx.NewSession()
}

Expand Down
32 changes: 21 additions & 11 deletions frontend/src/components/burpsuite/proxy/httpHisroty/HTTPHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,18 @@ const StatusColumn = reactive({
if(status >= 200 && status < 300) {
return true;
}
} else if(filter.value.status.includes('3xx')) {
}
if(filter.value.status.includes('3xx')) {
if(status >= 300 && status < 400) {
return true;
}
} else if(filter.value.status.includes('4xx')) {
}
if(filter.value.status.includes('4xx')) {
if(status >= 400 && status < 500) {
return true;
}
} else if(filter.value.status.includes('5xx')) {
}
if(filter.value.status.includes('5xx')) {
if(status >= 500) {
return true;
}
Expand All @@ -210,36 +213,43 @@ const MIMEColumn = reactive({
},
sorter: "default",
filter(value, row) {
const mime = parseInt(row.MIMEType)
const mime = row.MIMEType
if(filter.value.mime.includes('HTML')) {
if(mime === "html") {
return true;
}
} else if(filter.value.mime.includes('Script')) {
}
if(filter.value.mime.includes('Script')) {
if(mime === "script" || mime === "json") {
return true;
}
} else if(filter.value.mime.includes('XML')) {
}
if(filter.value.mime.includes('XML')) {
if(mime === "xml") {
return true;
}
} else if(filter.value.mime.includes('css')) {
}
if(filter.value.mime.includes('CSS')) {
if(mime === "CSS") {
return true;
}
} else if(filter.value.mime.includes('Other text')) {
}
if(filter.value.mime.includes('Other text')) {
if(mime === "text" || mime === "") {
return true;
}
} else if(filter.value.mime.includes('Images')) {
}
if(filter.value.mime.includes('Images')) {
if(mime === "image") {
return true;
}
} else if(filter.value.mime.includes('Flash')) {
}
if(filter.value.mime.includes('Flash')) {
if(mime === "Flash") {
return true;
}
} else if(filter.value.mime.includes('Other binary')) {
}
if(filter.value.mime.includes('Other binary')) {
if(mime === "Other binary") {
return true;
}
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ require (
github.com/projectdiscovery/utils v0.0.19
github.com/samber/lo v1.38.1
github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.9.0
github.com/sirupsen/logrus v1.9.2
github.com/spf13/viper v1.15.0
github.com/thoas/go-funk v0.9.3
github.com/tidwall/match v1.1.1
github.com/wailsapp/wails/v2 v2.5.1
github.com/yhy0/Jie v0.0.0-20230506123149-b6afd6f34dc0
github.com/yhy0/logging v0.0.0-20230316052906-9f857773c4b6
github.com/yhy0/logging v0.0.0-20230524073457-06ef86fd9ef3
go.uber.org/ratelimit v0.2.0
)

Expand All @@ -47,7 +47,7 @@ require (
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/microcosm-cc/bluemonday v1.0.23 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand All @@ -67,11 +67,11 @@ require (
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/term v0.7.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/microcosm-cc/bluemonday v1.0.21/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXmZOBBD4SaJyDwwTkM=
Expand Down Expand Up @@ -237,8 +237,8 @@ github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
Expand Down Expand Up @@ -283,8 +283,8 @@ github.com/wailsapp/wails/v2 v2.5.1 h1:mfG+2kWqQXYOwdgI43HEILjOZDXbk5woPYI3jP2b+
github.com/wailsapp/wails/v2 v2.5.1/go.mod h1:jbOZbcr/zm79PxXxAjP8UoVlDd9wLW3uDs+isIthDfs=
github.com/yhy0/Jie v0.0.0-20230506123149-b6afd6f34dc0 h1:txNbzj8qwpLLhoh7AFAuEMyADmU8wH9xHuIfS4ATzS0=
github.com/yhy0/Jie v0.0.0-20230506123149-b6afd6f34dc0/go.mod h1:IP58cjHE95xx/FPpiWw+AAJ6WiUQnzWObnYB0nzuKWU=
github.com/yhy0/logging v0.0.0-20230316052906-9f857773c4b6 h1:FRLmkWS/KuRFP4a9wO+NDgPm8ivKFOjNjYGahCHlt+Q=
github.com/yhy0/logging v0.0.0-20230316052906-9f857773c4b6/go.mod h1:DjdElPsDqf4IhYGiBtUKGT8i75RBZSwl+KgsaMJlZpU=
github.com/yhy0/logging v0.0.0-20230524073457-06ef86fd9ef3 h1:xBLYPBO2JQ/hPOX1YhDP3BCLPCmuIgJ0CXnDM3S2rHM=
github.com/yhy0/logging v0.0.0-20230524073457-06ef86fd9ef3/go.mod h1:DjdElPsDqf4IhYGiBtUKGT8i75RBZSwl+KgsaMJlZpU=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand All @@ -306,8 +306,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -376,8 +376,8 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -443,12 +443,12 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var assets embed.FS

func main() {
logging.New(true, "CY")
logging.New(true, file.ChyingDir, "CY")
file.New()
// Create an instance of the app structure
app := NewApp()
Expand Down
44 changes: 19 additions & 25 deletions pkg/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ type Rule struct {
Root bool // 是否为一级目录
}

func init() {
// 获取用户配置文件夹的路径
homedir := folderutil.HomeDirOrDefault("")

userCfgDir := filepath.Join(homedir, ".config")

ChyingDir = filepath.Join(userCfgDir, "ChYing")
// 判断 ChYing 文件夹是否存在
if _, err := os.Stat(ChyingDir); err != nil {
// 不存在,创建
if err = os.MkdirAll(ChyingDir, 0755); err != nil {
panic(err)
}
WriteToConfig()
}
}

func New() {
diccData, err := fileDicc.ReadFile("dicc.txt")
if err != nil {
Expand Down Expand Up @@ -129,31 +146,8 @@ func New() {
panic(err)
}

// 将文件释放
UserFile()
}

func UserFile() {
// 获取用户配置文件夹的路径
homedir := folderutil.HomeDirOrDefault("")

userCfgDir := filepath.Join(homedir, ".config")

filePath := filepath.Join(userCfgDir, "ChYing")

// 判断 ChYing 文件夹是否存在
if _, err := os.Stat(filePath); err != nil {
// 不存在,创建
ChyingDir = filepath.Join(userCfgDir, "ChYing")
if err := os.MkdirAll(ChyingDir, 0755); err != nil {
panic(err)
}
WriteToConfig()
} else {
ChyingDir = filepath.Join(userCfgDir, "ChYing")
// 读取文件
ReadFiles()
}
// 读取文件
ReadFiles()
}

// WriteToConfig 将内置文件全部释放到配置文件夹下
Expand Down
59 changes: 0 additions & 59 deletions pkg/log/guilog.go

This file was deleted.

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

0 comments on commit edd919b

Please sign in to comment.