mirror of
https://github.com/ffuf/ffuf
synced 2024-11-10 06:04:17 +00:00
Move version output to a function (#407)
* Version info as function (#3) * Opportunistic coloring
This commit is contained in:
parent
2ca8b83ed0
commit
fb1be906f0
6 changed files with 16 additions and 7 deletions
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
|
||||
for _, section := range sections {
|
||||
|
|
2
main.go
2
main.go
|
@ -136,7 +136,7 @@ func main() {
|
|||
opts = ParseFlags(opts)
|
||||
|
||||
if opts.General.ShowVersion {
|
||||
fmt.Printf("ffuf version: %s\n", ffuf.VERSION)
|
||||
fmt.Printf("ffuf version: %s\n", ffuf.Version())
|
||||
os.Exit(0)
|
||||
}
|
||||
if len(opts.Output.DebugLog) != 0 {
|
||||
|
|
|
@ -2,5 +2,6 @@ package ffuf
|
|||
|
||||
const (
|
||||
//VERSION holds the current version number
|
||||
VERSION = "1.3.0-git"
|
||||
VERSION = "1.3.0-git"
|
||||
VERSION_APPENDIX = ""
|
||||
)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ffuf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
)
|
||||
|
@ -41,3 +42,8 @@ func FileExists(path string) bool {
|
|||
|
||||
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"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ffuf/ffuf/pkg/ffuf"
|
||||
|
@ -52,7 +53,8 @@ func NewStdoutput(conf *ffuf.Config) *Stdoutput {
|
|||
}
|
||||
|
||||
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("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
|
||||
// the suffix to each output file.
|
||||
|
||||
if(config.OutputCreateEmptyFile && (len(res) == 0)){
|
||||
if config.OutputCreateEmptyFile && (len(res) == 0) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
s.config.OutputFile = BaseFilename + ".json"
|
||||
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
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue