Categorygithub.com/NovusEdge/go-bg
repositorypackage
1.0.2
Repository: https://github.com/novusedge/go-bg.git
Documentation: pkg.go.dev

# README

go-ps

go-bg is a simple implementation of a banner-grabber in golang.

Usage

To obtain the module, simply execute in shell:

$ go get github.com/NovusEdge/go-bg

Example use-case:

  • Importing the module:
import gobg "github.com/NovusEdge/go-bg"


  • Declaring an a variable of type BannerGrabber:
// Decalring a BannerGrabber object.

/*
struct definition:
type BannerGrabber struct {
    URL string
}
*/

bg := gobg.BannerGrabber{
	URL: "http://scanme.nmap.org/",
}



  • Grab() uses the curl command-line-tool and reports the banner thus obtained by printing to stdout.

Sample usage:

bg.Grab()

Output:

[*] Grabbing banner for: scanme.nmap.org...
[*] Banner Grab Successful!
Banner:
HTTP/1.1 200 OK
Date: Wed, 20 Oct 2021 05:09:49 GMT
Server: Apache/2.4.7 (Ubuntu)
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Type: text/html


  • Grabs() uses the curl command-line-tool and returns the banner thus obtained.
banner, _ := bg.Grabs()

fmt.Println(banner)

Output:

HTTP/1.1 200 OK
Date: Wed, 20 Oct 2021 05:09:49 GMT
Server: Apache/2.4.7 (Ubuntu)
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Type: text/html

Sample program:

package main

import (
    "fmt"
    "time"

    gobg "github.com/NovusEdge/go-bg"
)

func main() {
    bg := gobg.BannerGrabber{
	    URL: "http://scanme.nmap.org/",
    }

    // Scan and report banner in stdout:
    bg.Grab()

    // Scan and return the banner as a string:
    banner, _ := bg.Grabs()

    // Use in whatever way you like :)
    // For this sample, we'll just print it to stdout:

    fmt.Println(banner)
}