在kali上安装golang,结果发现了个坑。
我是直接用apt install go-lang
来安装的,然后把按网上说的教程,把/usr/lib/go-1.7
中的文件全部mv到了/root目录,然后才发现各种问题,
我在~/.bashrc
中设置的是
export GOROOT=$HOME/go/go-1.7
export GOPATH=$HOME/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH:bin
然后我
root@kali:~/repos/HERCULES# go run Setup.go
/root/gopath/src/github.com/fatih/color/vendor/github.com/mattn/go-colorable/noncolorable.go:4:2: cannot find package "bytes" in any of:
/root/gopath/src/github.com/fatih/color/vendor/bytes (vendor tree)
/root/go/go-1.7/src/bytes (from $GOROOT)
/root/gopath/src/bytes (from $GOPATH)
/root/gopath/src/github.com/fatih/color/color.go:4:2: cannot find package "fmt" in any of:
/root/gopath/src/github.com/fatih/color/vendor/fmt (vendor tree)
/root/go/go-1.7/src/fmt (from $GOROOT)
/root/gopath/src/fmt (from $GOPATH)
/root/gopath/src/github.com/fatih/color/vendor/github.com/mattn/go-colorable/colorable_others.go:6:2: cannot find package "io" in any of:
/root/gopath/src/github.com/fatih/color/vendor/io (vendor tree)
/root/go/go-1.7/src/io (from $GOROOT)
/root/gopath/src/io (from $GOPATH)
/root/gopath/src/github.com/fatih/color/vendor/github.com/mattn/go-colorable/colorable_others.go:7:2: cannot find package "os" in any of:
/root/gopath/src/github.com/fatih/color/vendor/os (vendor tree)
/root/go/go-1.7/src/os (from $GOROOT)
/root/gopath/src/os (from $GOPATH)
Setup.go:3:8: cannot find package "os/exec" in any of:
/root/go/go-1.7/src/os/exec (from $GOROOT)
/root/gopath/src/os/exec (from $GOPATH)
package main
imports runtime: cannot find package "runtime" in any of:
/root/gopath/src/github.com/fatih/color/vendor/runtime (vendor tree)
/root/go/go-1.7/src/runtime (from $GOROOT)
/root/gopath/src/runtime (from $GOPATH)
/root/gopath/src/github.com/fatih/color/color.go:7:2: cannot find package "strconv" in any of:
/root/gopath/src/github.com/fatih/color/vendor/strconv (vendor tree)
/root/go/go-1.7/src/strconv (from $GOROOT)
/root/gopath/src/strconv (from $GOPATH)
/root/gopath/src/github.com/fatih/color/color.go:8:2: cannot find package "strings" in any of:
/root/gopath/src/github.com/fatih/color/vendor/strings (vendor tree)
/root/go/go-1.7/src/strings (from $GOROOT)
/root/gopath/src/strings (from $GOPATH)
/root/gopath/src/github.com/fatih/color/color.go:9:2: cannot find package "sync" in any of:
/root/gopath/src/github.com/fatih/color/vendor/sync (vendor tree)
/root/go/go-1.7/src/sync (from $GOROOT)
/root/gopath/src/sync (from $GOPATH)
/root/gopath/src/github.com/fatih/color/vendor/github.com/mattn/go-isatty/isatty_linux.go:7:2: cannot find package "syscall" in any of:
/root/gopath/src/github.com/fatih/color/vendor/syscall (vendor tree)
/root/go/go-1.7/src/syscall (from $GOROOT)
/root/gopath/src/syscall (from $GOPATH)
/root/gopath/src/github.com/fatih/color/vendor/github.com/mattn/go-isatty/isatty_linux.go:8:2: cannot find package "unsafe" in any of:
/root/gopath/src/github.com/fatih/color/vendor/unsafe (vendor tree)
/root/go/go-1.7/src/unsafe (from $GOROOT)
/root/gopath/src/unsafe (from $GOPATH)
直到我去mv之后的go目录ls了一下才发现
root@kali:~/go/go-1.7# ls
bin doc favicon.ico.gz pkg src test VERSION
root@kali:~/go/go-1.7# cd src
-bash: cd: src: 没有那个文件或目录
root@kali:~/go/go-1.7# file src
src: broken symbolic link to ../../share/go-1.7/src
原来之前的go文件弄了一个symbolic link到某个相对路径了,
才发现我不应该这样弄,
算了,还是直接卸载重新装吧
apt remove golang --purge
重新apt安装还是不行,索性用源码安装吧
https://golang.org/dl/
得到go1.8.3.src.tar.gz
时间不对,先设置一下时间
root@kali:~/go# date
2016年 11月 05日 星期六 05:39:32 CST
root@kali:~/go# man date
root@kali:~/go# date -s "2017-06-11 18:27:30"
2017年 06月 11日 星期日 18:27:30 CST
root@kali:~/go# date
2017年 06月 11日 星期日 18:27:32 CST
//TODO
这TM谁写的脚本,我保证不打他。我明明下载的是go1.8的源码,给我来这个。。。
root@kali:~/go/src# grep "go1.4" * 2>/dev/null
make.bash:GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
make.rc: GOROOT_BOOTSTRAP = $home/go1.4
naclmake.bash:GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
草,最后终于搞定了。
先通过which go
找到,go的可执行文件/usr/bin/go
,然后ll /usr/bin/go
发现它指向另外一个目录,/usr/lib/go-1.7
,于是在~/.bashrc
中加入
export GOROOT=/usr/lib/go-1.7
export GOPATH=$HOME/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH:bin
然后source ~/.bashrc
root@kali:~/repos/HERCULES# go get github.com/fatih/color
root@kali:~/repos/HERCULES# go run Setup.go
██░ ██ ▓█████ ██▀███ ▄████▄ █ ██ ██▓ ▓█████ ██████
▓██░ ██▒▓█ ▀ ▓██ ▒ ██▒▒██▀ ▀█ ██ ▓██▒▓██▒ ▓█ ▀ ▒██ ▒
▒██▀▀██░▒███ ▓██ ░▄█ ▒▒▓█ ▄ ▓██ ▒██░▒██░ ▒███ ░ ▓██▄
░▓█ ░██ ▒▓█ ▄ ▒██▀▀█▄ ▒▓▓▄ ▄██▒▓▓█ ░██░▒██░ ▒▓█ ▄ ▒ ██▒
░▓█▒░██▓░▒████▒░██▓ ▒██▒▒ ▓███▀ ░▒▒█████▓ ░██████▒░▒████▒▒██████▒▒
▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░░ ░▒ ▒ ░░▒▓▒ ▒ ▒ ░ ▒░▓ ░░░ ▒░ ░▒ ▒▓▒ ▒ ░
▒ ░▒░ ░ ░ ░ ░ ░▒ ░ ▒░ ░ ▒ ░░▒░ ░ ░ ░ ░ ▒ ░ ░ ░ ░░ ░▒ ░ ░
░ ░░ ░ ░ ░░ ░ ░ ░░░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░
+ -- --=[ HERCULES FRAMEWORK ]
+ -- --=[ Ege Balcı ]
[*] STARTING HERCULES SETUP
[*] Detecting OS...
[*] OS Detected : Linux kali 4.9.0-kali4-686-pae #1 SMP Debian 4.9.30-1kali1 (2017-06-06) i686 GNU/Linux
[*] Setting HERCULES path...
[*] HERCULES_PATH=/root/repos/HERCULES
[*] Installing golang...
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
golang 已经是最新版 (2:1.7~5)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
[*] Installing upx...
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
注意,选中 'upx-ucl' 而非 'upx'
upx-ucl 已经是最新版 (3.91-4)。
upx-ucl 已设置为手动安装。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
[*] Installing git...
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
git 已经是最新版 (1:2.11.0-3)。
git 已设置为手动安装。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
[*] Cloning EGESPLOIT Library...
[*] Cloning color Library...
[*] Createing shoutcut...
[+] Setup completed successfully