librecursebuster

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2018 License: Unlicense Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureHTTPClient

func ConfigureHTTPClient(cfg *Config, wg *sync.WaitGroup, printChan chan OutLine, sendToBurpOnly bool) *http.Client

ConfigureHTTPClient configures and returns a HTTP Client (mostly useful to be able to send to burp)

func HTTPReq

func HTTPReq(method, path string, client *http.Client, cfg *Config) (*http.Response, []byte, error)

HTTPReq sends the HTTP request based on the given settings, returns the response and the body todo: This can probably be optimized to exit once the head has been retreived and discard the body

func InitLogger

func InitLogger(
	good2Handle io.Writer,
	good3Handle io.Writer,
	good4Handle io.Writer,
	good5Handle io.Writer,
	goodxHandle io.Writer,
	infoHandle io.Writer,
	debugHandle io.Writer,
	warningHandle io.Writer,
	statusHandle io.Writer,
	errorHandle io.Writer)

InitLogger initialises the output writer stuff

func LoadWords

func LoadWords(filePath string, destChan chan string, printChan chan OutLine)

LoadWords asynchronously loads in words to a channel. Expects the channel to either be big enough to load the whole file, or that it will be streamed from as the file is opened and read from.

func ManageNewURLs

func ManageNewURLs(cfg *Config, state *State, wg *sync.WaitGroup, pages, newpages chan SpiderPage, printChan chan OutLine)

ManageNewURLs will take in any URL, and decide if it should be added to the queue for bustin', or if we discovered something new

func ManageRequests

func ManageRequests(cfg *Config, state *State, wg *sync.WaitGroup, pages, newPages, confirmed chan SpiderPage, workers chan struct{}, printChan chan OutLine, maxDirs chan struct{}, testChan chan string)

ManageRequests handles the request workers

func OutputWriter

func OutputWriter(wg *sync.WaitGroup, cfg *Config, confirmed chan SpiderPage, localPath string, printChan chan OutLine)

OutputWriter will write to a file and the screen

func PrintBanner

func PrintBanner(cfg *Config)

PrintBanner prints the banner and in debug mode will also print all set options

func PrintOutput

func PrintOutput(message string, writer *ConsoleWriter, verboseLevel int, wg *sync.WaitGroup, printChan chan OutLine)

PrintOutput used to send output to the screen

func RandString

func RandString(printChan chan OutLine) string

RandString will return a UUID

func RedirectHandler

func RedirectHandler(req *http.Request, via []*http.Request) error

RedirectHandler dictates the way to handle redirects.

func ScrollView added in v1.5.0

func ScrollView(v *ui.View, g *ui.Gui, dy int)

func SetState added in v1.5.0

func SetState(s *State)

func StatsTracker

func StatsTracker(state *State)

StatsTracker updates the stats every so often

func StatusPrinter

func StatusPrinter(cfg *Config, state *State, wg *sync.WaitGroup, printChan chan OutLine, testChan chan string)

StatusPrinter is the function that performs all the status printing logic

func UIPrinter added in v1.5.0

func UIPrinter(cfg *Config, state *State, wg *sync.WaitGroup, printChan chan OutLine, testChan chan string)

Types

type ArrayStringFlag

type ArrayStringFlag []string

ArrayStringFlag is used to be able to supply more than one flag at the command line (for the -header option)

func (*ArrayStringFlag) Get

func (i *ArrayStringFlag) Get() []string

Get the Values stored (required for the interface)

func (*ArrayStringFlag) Set

func (i *ArrayStringFlag) Set(value string) error

Set the value. Appends to the current state. (required for the interface)

func (*ArrayStringFlag) String

func (i *ArrayStringFlag) String() string

type Config

type Config struct {
	Agent             string
	AppendDir         bool
	Auth              string
	BadResponses      string
	BadHeader         ArrayStringFlag
	BodyContent       string
	BlacklistLocation string
	BurpMode          bool
	Canary            string
	CleanOutput       bool
	Cookies           string
	Debug             bool
	Extensions        string
	FollowRedirects   bool
	Headers           ArrayStringFlag
	HTTPS             bool
	InputList         string
	Localpath         string
	MaxDirs           int
	Methods           string
	NoBase            bool
	NoGet             bool
	NoHead            bool
	NoRecursion       bool
	NoSpider          bool
	NoStatus          bool
	NoStartStop       bool
	NoUI              bool
	NoWildcardChecks  bool
	ProxyAddr         string
	Ratio404          float64
	ShowAll           bool
	ShowLen           bool
	ShowVersion       bool
	SSLIgnore         bool
	Threads           int
	Timeout           int
	URL               string
	VerboseLevel      int
	Version           string
	WhitelistLocation string
	Wordlist          string
}

Config represents the configuration supplied at runtime. Different to program State which can change, this is set once, and only queried during program operation.

type ConsoleWriter

type ConsoleWriter struct {
	// contains filtered or unexported fields
}

ConsoleWriter is pretty much a straight rip from the go project's log writer, but modified as needed https://golang.org/src/log/log.go

var (
	Good2 *ConsoleWriter //*log.Logger
	Good3 *ConsoleWriter //*log.Logger
	Good4 *ConsoleWriter //*log.Logger
	Good5 *ConsoleWriter //*log.Logger
	Goodx *ConsoleWriter //*log.Logger

	Info   *ConsoleWriter
	Debug  *ConsoleWriter
	Error  *ConsoleWriter
	Status *ConsoleWriter
)

All the ConsoleWriter stuff can probably be abstracted into an interface :thinkingemoji:

func (*ConsoleWriter) Fprintf added in v1.5.0

func (c *ConsoleWriter) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error)

func (ConsoleWriter) GetPrefix added in v1.5.0

func (c ConsoleWriter) GetPrefix() string

func (ConsoleWriter) New

func (ConsoleWriter) New(w io.Writer, prefix string) *ConsoleWriter

New creates a new Console writer. The prefix appears at the beginning of each generated log line.

func (*ConsoleWriter) Output

func (c *ConsoleWriter) Output(calldepth int, s string) error

Output writes the output for an event. The string s contains the text to print after the prefix specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline. Calldepth is used to recover the PC and is provided for generality, although at the moment on all pre-defined paths it will be 2.

func (*ConsoleWriter) Printf

func (c *ConsoleWriter) Printf(format string, v ...interface{})

Printf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.

func (*ConsoleWriter) Println

func (c *ConsoleWriter) Println(v ...interface{})

Println calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Println.

type HostState

type HostState struct {
	ParsedURL           *url.URL
	Soft404ResponseBody []byte
}

HostState is the actual state of each host (wow this is confusing and should be broken into different state files imo)

type HostStates

type HostStates struct {
	// contains filtered or unexported fields
}

HostStates represents the interface to the Host States..? (all this smells of bad hacks)

func (*HostStates) AddHost

func (hs *HostStates) AddHost(u *url.URL)

AddHost adds a host to the hosts lol

func (*HostStates) AddSoft404Content

func (hs *HostStates) AddSoft404Content(host string, content []byte)

AddSoft404Content sets the soft404 content retreived using the canary request to be compared against during the hacking phase

func (*HostStates) Get404Body

func (hs *HostStates) Get404Body(host string) []byte

Get404Body returns the stored known-not-good body from a response

func (HostStates) HostExists

func (hs HostStates) HostExists(hval string) bool

HostExists checks to see if the host string specified exists within the hosts states??

func (*HostStates) Init

func (hs *HostStates) Init()

Init initialises the map because apparently OO is hard to do

type OutLine

type OutLine struct {
	Content string
	Level   int //Define the log/verbosity level. 0 is normal, 1 is higher verbosity etc
	Type    *ConsoleWriter
}

OutLine represents some form of console output. Should consist of the content to output, the type of output and the verbosity level.

type SpiderPage

type SpiderPage struct {
	URL       string
	Result    *http.Response
	Reference *url.URL //where did we get this URL from? (for the logic portion)
}

SpiderPage represents a 'working' page object, represented by an URL and it's (optional)result.

type State

type State struct {

	//global State values
	Client         *http.Client
	BurpClient     *http.Client
	TotalTested    *uint64
	PerSecondShort *uint64 //how many tested over 2 seconds or so
	PerSecondLong  *uint64
	StartTime      time.Time
	Blacklist      map[string]bool
	Whitelist      map[string]bool
	BadResponses   map[int]bool //response codes to consider *dont care* (this might be worth putting in per host state, but idk how)
	Extensions     []string
	Methods        []string
	WordlistLen    *uint32
	DirbProgress   *uint32

	StopDir chan struct{} //should probably have all teh chans in here

	Checked map[string]bool
	CMut    *sync.RWMutex

	//per host States
	Hosts HostStates
	//ParsedURL           *url.URL
	//Soft404ResponseBody []byte
	Version string
	// contains filtered or unexported fields
}

State represents the current state of the program. Options are not configured here, those are found in Config.

func (*State) StartUI added in v1.5.0

func (s *State) StartUI(wg *sync.WaitGroup, quitChan chan struct{})

Jump to

Keyboard shortcuts

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