zgrab2/lib/smb
Jeff Cody b69c22c532
SMB: Probe for SMB1 in addition to SMB2
If the probe for SMB2 fails, close the connection and then try probing
for SMB1 as a backup.

Since there are more SMB2 servers in the wild, that is the first
attempt.
2019-06-10 17:17:20 -04:00
..
gss Pull in updated SMB library, modify it to take logs, use it in scanner 2018-03-16 12:08:59 -04:00
ntlmssp Pull in updated SMB library, modify it to take logs, use it in scanner 2018-03-16 12:08:59 -04:00
smb SMB: Probe for SMB1 in addition to SMB2 2019-06-10 17:17:20 -04:00
.gitignore Pull in updated SMB library, modify it to take logs, use it in scanner 2018-03-16 12:08:59 -04:00
about.txt Pull in updated SMB library, modify it to take logs, use it in scanner 2018-03-16 12:08:59 -04:00
LICENSE Pull in updated SMB library, modify it to take logs, use it in scanner 2018-03-16 12:08:59 -04:00
README.md Pull in updated SMB library, modify it to take logs, use it in scanner 2018-03-16 12:08:59 -04:00

SMB

A Go package for communicating over SMB. Currently only minimal funcationality exists for client-side functions.

Here is a sample client that establishes a session with a server:

package main

import (
	"log"

	"github.com/stacktitan/smb/smb"
)

func main() {

	host := "172.16.248.192"
	options := smb.Options{
		Host:        host,
		Port:        445,
		User:        "alice",
		Domain:      "corp",
		Workstation: "",
		Password:    "Password123!",
	}
	debug := false
	session, err := smb.NewSession(options, debug)
	if err != nil {
		log.Fatalln("[!]", err)
	}
	defer session.Close()

	if session.IsSigningRequired {
		log.Println("[-] Signing is required")
	} else {
		log.Println("[+] Signing is NOT required")
	}

	if session.IsAuthenticated {
		log.Println("[+] Login successful")
	} else {
		log.Println("[-] Login failed")
	}

	if err != nil {
		log.Fatalln("[!]", err)
	}
}