Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数据库密码中包含特殊字符会出错 #47

Open
r90tpass opened this issue Oct 11, 2023 · 3 comments
Open

数据库密码中包含特殊字符会出错 #47

r90tpass opened this issue Oct 11, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@r90tpass
Copy link

比如密码中有&%等会出错
是否能加一个编码转换的
类似于:password先用url进行编码,然后代码在连接时再进行解码。
decodedDB, err := url.QueryUnescape(password)

期待你的回复

@zema1 zema1 added the enhancement New feature or request label Nov 6, 2023
@zema1 zema1 changed the title 老哥,选择别的数据库时,密码中包含特殊字符会出错 数据库密码中包含特殊字符会出错 Nov 8, 2023
@zema1
Copy link
Owner

zema1 commented Nov 8, 2023

这个是 url.Parse 解析时出错的,暂时没想到好的办法,只能先改下数据密码别有特殊字符了 ==

@ramoncjs3
Copy link

watchvuln/ctrl/config.go:51

// +add
conn, err := url.QueryUnescape(u.User.String())
if err != nil {
	return "", "", fmt.Errorf("failed to unescape db_conn: %w", err)
}
return dialect.MySQL, fmt.Sprintf("%s@tcp(%s)/%s?%s", conn, u.Host, path, query), nil

@zema1
Copy link
Owner

zema1 commented Mar 28, 2024

@ramoncjs3 实际上,在这之前就已经报错了,报错在这一行 https://github.com/zema1/watchvuln/blob/main/ctrl/config.go#L28

这种情况可以试试手动把 password 用 url编码工具编码一下,再传到这个连接配置里

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants