gobg

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 4 Imported by: 0

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)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Blink = "\033[5m"
View Source
var Bold = "\033[1m"
View Source
var ColorBlue = "\033[34m"
View Source
var ColorCyan = "\033[36m"
View Source
var ColorGreen = "\033[32m"
View Source
var ColorGrey = "\033[1;30m"
View Source
var ColorPurple = "\033[35m"
View Source
var ColorRed = "\033[31m"
View Source
var ColorReset = "\033[0m"
View Source
var ColorWhite = "\033[37m"
View Source
var ColorYellow = "\033[33m"
View Source
var Crossed = "\033[9m"
View Source
var Dim = "\033[2m"
View Source
var Italic = "\033[3m"
View Source
var Negative = "\033[7m"
View Source
var Underline = "\033[4m"

Functions

This section is empty.

Types

type BannerGrabber

type BannerGrabber struct {
	URL string
}

func (*BannerGrabber) Grab

func (bg *BannerGrabber) Grab()

func (*BannerGrabber) Grabs

func (bg *BannerGrabber) Grabs() (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL