Skip to content

Commit

Permalink
[fix]修复 sqlapi 配置文件指定不生效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yhy0 committed Jan 12, 2024
1 parent b73328e commit 64cde46
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 197 deletions.
155 changes: 0 additions & 155 deletions Jie_config.yaml

This file was deleted.

11 changes: 6 additions & 5 deletions SCopilot/templates/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h3>配置</h3>
<th scope="row">Plugin</th>
<td colspan="3" class="form-check-wrapper">
{{ range $plugin, $on := .plugins }}
{{ if ne $plugin "sqlmap" }}
{{ if ne $plugin "sqlmapApi" }}
<div class="form-check form-check-inline form-switch">
{{ if $on }}
<input class="form-check-input" type="checkbox" name="plugin" id="{{ $plugin }}" value="{{ $plugin }}" checked/>
Expand Down Expand Up @@ -100,9 +100,10 @@ <h3>配置</h3>
</tr>
<tr>
<th scope="row">Sqlmap Api</th>
{{ .sqlmapApi }}
<td colspan="3">
<div class="form-check form-switch">
{{ if .sqlmap.Enabled }}
{{ if .sqlmapApi.Enabled }}
<input class="form-check-input" type="checkbox" role="switch" name="sqlmap-switch" id="sqlmap-switch" checked>
{{ else }}
<input class="form-check-input" type="checkbox" role="switch" name="sqlmap-switch" id="sqlmap-switch">
Expand All @@ -112,19 +113,19 @@ <h3>配置</h3>
<div class="mb-3 row">
<label for="sqlmap_api" class="col-sm-6 col-form-label">SqlmapAPi</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="sqlmap_api" id="sqlmap_api" placeholder="SqlmapAPi" value="{{ .sqlmap.Url }}">
<input type="text" class="form-control" name="sqlmap_api" id="sqlmap_api" placeholder="SqlmapAPi" value="{{ .sqlmapApi.Url }}">
</div>
</div>
<div class="mb-3 row">
<label for="username" class="col-sm-8 col-form-label">Username</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="username" id="username" placeholder="用户名" value="{{ .sqlmap.Username }}">
<input type="text" class="form-control" name="username" id="username" placeholder="用户名" value="{{ .sqlmapApi.Username }}">
</div>
</div>
<div class="mb-3 row">
<label for="password" class="col-sm-8 col-form-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="password" id="password" placeholder="密码" value="{{ .sqlmap.Password }}">
<input type="password" class="form-control" name="password" id="password" placeholder="密码" value="{{ .sqlmapApi.Password }}">
</div>
</div>
</td>
Expand Down
8 changes: 4 additions & 4 deletions SCopilot/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func Init() {
"include": conf.GlobalConfig.Mitmproxy.Include,
"exclude": conf.GlobalConfig.Mitmproxy.Exclude,
"filterSuffix": conf.GlobalConfig.Mitmproxy.FilterSuffix,
"sqlmap": conf.GlobalConfig.SqlmapApi,
"sqlmapApi": conf.GlobalConfig.SqlmapApi,
"year": time.Now().Year(),
})
})
Expand Down Expand Up @@ -173,15 +173,15 @@ func Init() {
password := c.PostForm("password")

if sqlmap == "on" {
conf.Plugin["sqlmap"] = true
conf.Plugin["sqlmapApi"] = true
conf.GlobalConfig.SqlmapApi = conf.Sqlmap{
Enabled: true,
Url: sqlmapApi,
Username: username,
Password: password,
}
} else {
conf.Plugin["sqlmap"] = false
conf.Plugin["sqlmapApi"] = false
conf.GlobalConfig.SqlmapApi = conf.Sqlmap{
Enabled: false,
Url: sqlmapApi,
Expand All @@ -201,7 +201,7 @@ func Init() {
"include": conf.GlobalConfig.Mitmproxy.Include,
"exclude": conf.GlobalConfig.Mitmproxy.Exclude,
"filterSuffix": conf.GlobalConfig.Mitmproxy.FilterSuffix,
"sqlmap": conf.GlobalConfig.SqlmapApi,
"sqlmapApi": conf.GlobalConfig.SqlmapApi,
"year": time.Now().Year(),
})
})
Expand Down
2 changes: 1 addition & 1 deletion conf/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var (
Plugin = map[string]bool{
"xss": false,
"sql": false,
"sqlmap": false,
"sqlmapApi": false,
"cmd": false,
"xxe": false,
"ssrf": false,
Expand Down
15 changes: 14 additions & 1 deletion conf/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,20 @@ func ReadPlugin() {
}

if GlobalConfig.Plugins.SqlmapApi.Enabled {
Plugin["sqlmap"] = true
Plugin["sqlmapApi"] = true
GlobalConfig.SqlmapApi = Sqlmap{
Enabled: true,
Url: GlobalConfig.Plugins.SqlmapApi.Url,
Username: GlobalConfig.Plugins.SqlmapApi.Username,
Password: GlobalConfig.Plugins.SqlmapApi.Password,
}
} else {
GlobalConfig.SqlmapApi = Sqlmap{
Enabled: false,
Url: GlobalConfig.Plugins.SqlmapApi.Url,
Username: GlobalConfig.Plugins.SqlmapApi.Username,
Password: GlobalConfig.Plugins.SqlmapApi.Password,
}
}

if GlobalConfig.Plugins.CmdInjection.Enabled {
Expand Down
Loading

0 comments on commit 64cde46

Please sign in to comment.