【Golang】 网站的根目录如何映射到文件系统?

不到十行代码:

package main
import (
    "log"
    "net/http"
)
func main() {
    http.Handle("/", http.FileServer(http.Dir("youpath")))
    log.Fatal(http.ListenAndServe(":8080", nil))
}

可能需要注意是否可以回溯。

如果可以访问到父目录就会有安全问题。

参考

挖洞技巧:如何绕过URL限制

分享几个绕过URL跳转限制的思路

URL跳转绕过姿势

发布了318 篇原创文章 · 获赞 13 · 访问量 9万+

猜你喜欢

转载自blog.csdn.net/LU_ZHAO/article/details/105213624