说起为啥要安装Go环境,完全是因为想运行Heartbleed Bug(CVE-2014-0160)Go版本的PoC heartbleeder.go (估计大家都使用的python版本的PoC ssltest.py, perl版本的PoC hb_honeypot.pl 附上在线检测站点http://filippo.io/Heartbleed/,http://possible.lv/tools/hb/ )
作为工具党,熟悉各种工具的编译运行方式是最基础的了,而渗透工具一般都需要了解c,perl,python,ruby,go的运行方式。好了,进入正题。我们搭建好go运行环境,并演示在这个环境中运行heartbleeder.go
一、Go环境搭建
第一步:安装c语言工具
apt-get install bison ed gawk gcc libc6-dev make
第二步:安装Mercurial版本管理系统(后续使用其获取/更新Go源码)
apt-get install python-setuptools python-dev build-essential
easy_install mercurial
hg clone -r release https://go.googlecode.com/hg/ go或更新到最新版本
cd go/src
hg pull
hg update release
./all.bash
cd go/src
./all.bash
增加vim ~/.bashrc
#Go 二进制文件存放地址
export GOBIN=/root/go/pkg/tool/linux_386
export PATH=$GOBIN:$PATH
#Go 安装包源码路经export GOROOT=/root/go
export GOPATH=/root/goTool#操作系统和CPU类型,可以使用uname -a查看
export GOOS=linux
export GOARCH=386
source ~/.bashrc
vim hello.go
运行package main
import "fmt"
func main(){
fmt.Println("hello, Go ! ")
}
-bash-4.2# go run hello.go
hello, Go !
经过上一步操作:cd goTool/
go get github.com/titanous/heartbleeder #获取PoC源码
或者-bash-4.2# heartbleeder www.xxx.com
INSECURE - www.xxx.com:443 has the heartbeat extension enabled and is vulnerable
-bash-4.2# go run heartbleeder.go www.xxx.com
INSECURE - www.xxx.com:443 has the heartbeat extension enabled and is vulnerable