Vulfocus API
is the RESUFul API
interface provided by Vulfocus
for development, allowing Developers integrate Vulfocus
in their own projects.
The GO
version of SDK
written based on the Vulfocus API
makes it easy for Golang
developers to quickly integrate Vulfocus
into their projects.
go get github.com/fofapro/vulfocus-go
field | description |
---|---|
addr |
Vulfocus URL |
username |
User login Vulfocus userbox username |
licence |
Please go to the personal center to view API 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
- Version release