pwnwriter / haylxon

⚡ Blazing-fast tool to grab screenshots of your domain list right from terminal.
https://crates.io/crates/hxn
MIT License
386 stars 16 forks source link

[bug] File path error using special url path #36

Closed enomothem closed 9 months ago

enomothem commented 10 months ago

Description

File path error using special url path

Software Version

0.1.9

Steps to Reproduce

Windows 11

.\hxn.exe -b E:\\T0_APP\\Google\\Chrome\\Application\\chrome.exe -u http://xxx.com?new=1.1 --verbose image error: 文件名、目录名或卷标语法不正确。 (os error 123) error: The file name, directory name, or tagline method is incorrect (os error 123)

Expected Behavior

url is recognized

Actual Behavior

error

Additional Information

No response

enomothem commented 10 months ago

我知道是什么原因了,还是因为windows的文件系统不能存在特殊字符,我建议使用正则替换全部的特殊字符。我将提供到PR。 如果赞同我的方案,可以使用我的方案,也可以参考我的建议修改,处理这种情况。

image

let re = Regex::new(r"[<>?.~!@#$%^&*\\/|;:']").unwrap();
let regurl = re.replace_all(&url, "").to_string();

println!("{}", regurl);

let filename = format!(
    "{}.png",
    regurl.replace("://", "-").replace('/', "_").replace(':', "-")
);
pwnwriter commented 9 months ago

Fyi, while committing you can actually close the issue like this

git commit -am "commit msg ; [ closes issue no: ]"

Anyways i'm closing this issue as well

enomothem commented 9 months ago

@pwnwriter Get it