Move version output to a function (#407)
* Version info as function (#3) * Opportunistic coloring
This commit is contained in:
parent
2ca8b83ed0
commit
fb1be906f0
2
help.go
2
help.go
@ -123,7 +123,7 @@ func Usage() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
fmt.Printf("Fuzz Faster U Fool - v%s\n\n", ffuf.VERSION)
|
fmt.Printf("Fuzz Faster U Fool - v%s\n\n", ffuf.Version())
|
||||||
|
|
||||||
// Print out the sections
|
// Print out the sections
|
||||||
for _, section := range sections {
|
for _, section := range sections {
|
||||||
|
|||||||
2
main.go
2
main.go
@ -136,7 +136,7 @@ func main() {
|
|||||||
opts = ParseFlags(opts)
|
opts = ParseFlags(opts)
|
||||||
|
|
||||||
if opts.General.ShowVersion {
|
if opts.General.ShowVersion {
|
||||||
fmt.Printf("ffuf version: %s\n", ffuf.VERSION)
|
fmt.Printf("ffuf version: %s\n", ffuf.Version())
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
if len(opts.Output.DebugLog) != 0 {
|
if len(opts.Output.DebugLog) != 0 {
|
||||||
|
|||||||
@ -2,5 +2,6 @@ package ffuf
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
//VERSION holds the current version number
|
//VERSION holds the current version number
|
||||||
VERSION = "1.3.0-git"
|
VERSION = "1.3.0-git"
|
||||||
|
VERSION_APPENDIX = ""
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package ffuf
|
package ffuf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
@ -41,3 +42,8 @@ func FileExists(path string) bool {
|
|||||||
|
|
||||||
return !md.IsDir()
|
return !md.IsDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Version returns the ffuf version string
|
||||||
|
func Version() string {
|
||||||
|
return fmt.Sprintf("%s%s", VERSION, VERSION_APPENDIX)
|
||||||
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ffuf/ffuf/pkg/ffuf"
|
"github.com/ffuf/ffuf/pkg/ffuf"
|
||||||
@ -52,7 +53,8 @@ func NewStdoutput(conf *ffuf.Config) *Stdoutput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stdoutput) Banner() {
|
func (s *Stdoutput) Banner() {
|
||||||
fmt.Fprintf(os.Stderr, "%s\n v%s\n%s\n\n", BANNER_HEADER, ffuf.VERSION, BANNER_SEP)
|
version := strings.ReplaceAll(ffuf.Version(), "<3", fmt.Sprintf("%s<3%s", ANSI_RED, ANSI_CLEAR))
|
||||||
|
fmt.Fprintf(os.Stderr, "%s\n v%s\n%s\n\n", BANNER_HEADER, version, BANNER_SEP)
|
||||||
printOption([]byte("Method"), []byte(s.config.Method))
|
printOption([]byte("Method"), []byte(s.config.Method))
|
||||||
printOption([]byte("URL"), []byte(s.config.Url))
|
printOption([]byte("URL"), []byte(s.config.Url))
|
||||||
|
|
||||||
@ -211,9 +213,9 @@ func (s *Stdoutput) writeToAll(config *ffuf.Config, res []Result) error {
|
|||||||
// Go through each type of write, adding
|
// Go through each type of write, adding
|
||||||
// the suffix to each output file.
|
// the suffix to each output file.
|
||||||
|
|
||||||
if(config.OutputCreateEmptyFile && (len(res) == 0)){
|
if config.OutputCreateEmptyFile && (len(res) == 0) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
s.config.OutputFile = BaseFilename + ".json"
|
s.config.OutputFile = BaseFilename + ".json"
|
||||||
err = writeJSON(s.config, s.Results)
|
err = writeJSON(s.config, s.Results)
|
||||||
|
|||||||
@ -104,7 +104,7 @@ func (r *SimpleRunner) Execute(req *ffuf.Request) (ffuf.Response, error) {
|
|||||||
|
|
||||||
// set default User-Agent header if not present
|
// set default User-Agent header if not present
|
||||||
if _, ok := req.Headers["User-Agent"]; !ok {
|
if _, ok := req.Headers["User-Agent"]; !ok {
|
||||||
req.Headers["User-Agent"] = fmt.Sprintf("%s v%s", "Fuzz Faster U Fool", ffuf.VERSION)
|
req.Headers["User-Agent"] = fmt.Sprintf("%s v%s", "Fuzz Faster U Fool", ffuf.Version())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Go http.Request special cases
|
// Handle Go http.Request special cases
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user