Vulfocus API
是 Vulfocus
为开发提供的 RESUFul API
接口,允许开发者在自己的项目中集成 Vulfocus
。
基于 Vulfocus API
编写的 GO
版 SDK
,方便Golang
开发者快速将 Vulfocus
集成到自己的项目中。
go get github.com/fofapro/vulfocus-go
字段名称 | 描述 |
---|---|
addr |
Vulfocus 地址 |
username |
用户登陆 Vulfocus 使用的用户名 |
licence |
前往 个人中心 查看 API Key |
使用 接口地址
、用户账号
、licence
创建一个客户端,即可调用相关函数。
package main
import (
"fmt"
"github.com/fofapro/vulfocus-go"
)
const (
addr = "http://vulfocus.fofa.so"
username = ""
licence = ""
)
func main() {
client := vulfocus.NewClient(addr, username, licence)
err, images := client.GetImages()
if err != nil {
return
}
fmt.Printf("get %d images", len(images))
if len(images) == 0 {
return
}
}
package main
import (
"fmt"
"github.com/fofapro/vulfocus-go"
)
const (
addr = "http://vulfocus.fofa.so"
username = ""
licence = ""
)
func main() {
client := vulfocus.NewClient(addr, username, licence)
err, images := client.GetImages()
if err != nil {
return
}
fmt.Printf("get %d images", len(images))
if len(images) == 0 {
return
}
err, exposed := client.Start(images[0].Name)
if err != nil {
return
}
println(exposed.Host, exposed.Port)
}
package main
import (
"fmt"
"github.com/fofapro/vulfocus-go"
)
const (
addr = "http://vulfocus.fofa.so"
username = ""
licence = ""
)
func main() {
client := vulfocus.NewClient(addr, username, licence)
err, images := client.GetImages()
if err != nil {
return
}
fmt.Printf("get %d images", len(images))
if len(images) == 0 {
return
}
err = client.Stop(images[0].Name)
if err != nil {
return
}
}
package main
import (
"fmt"
"github.com/fofapro/vulfocus-go"
)
const (
addr = "http://vulfocus.fofa.so"
username = ""
licence = ""
)
func main() {
client := vulfocus.NewClient(addr, username, licence)
err, images := client.GetImages()
if err != nil {
return
}
fmt.Printf("get %d images", len(images))
if len(images) == 0 {
return
}
err = client.Delete(images[0].Name)
if err != nil {
return
}
}
2021-11-25
- 版本发布