File tree Expand file tree Collapse file tree 5 files changed +45
-17
lines changed Expand file tree Collapse file tree 5 files changed +45
-17
lines changed Original file line number Diff line number Diff line change 11package core
22
33import (
4- log "github.com/sirupsen/logrus "
4+ "fmt "
55)
66
77const banner = `
@@ -18,7 +18,7 @@ const banner = `
1818const version = "0.0.9"
1919
2020func ShowBanner (Version string ) {
21- log .Println (banner )
22- log .Println ("\t \t \t Author: SummerSec Version:" , Version + " Github: https://Github.com/SummerSec\n " )
21+ fmt .Println (banner )
22+ fmt .Println ("\t \t \t Author: SummerSec Version:" , Version + " Github: https://Github.com/SummerSec\n " )
2323
2424}
Original file line number Diff line number Diff line change @@ -78,8 +78,8 @@ func ParseOptions() *Options {
7878 flag .Parse ()
7979
8080 // TODO 修改版本号
81- ShowBanner (version )
8281 logs .SaveLogs (options .LogFile )
82+ ShowBanner (version )
8383 showVerbose (options )
8484
8585 if options .Version {
Original file line number Diff line number Diff line change @@ -19,16 +19,16 @@ func NewRunner(options *Options) (*Runner, error) {
1919
2020 mops := structs .Map (& r .options )
2121 data , _ := json .Marshal (mops )
22- log .Info ("Runner created" )
22+ log .Debug ("Runner created" )
2323 log .Debug (mops )
2424 log .Debug ("Runner options: " , string (data ))
2525 return & r , nil
2626
2727}
2828
2929func (r * Runner ) Run () {
30- log .Debugln ( "github.com/SummerSec/SpringExploit/cmd/commons/core/runner.go: Run() " )
31- log .Info ("Runner Running" )
30+ log .Info ( "Starting SpringExploit " )
31+ log .Debug ("Runner Running" )
3232 //ip := r.options.IP
3333 var urls []string
3434 // TODO: check if options are valid
@@ -42,6 +42,9 @@ func (r *Runner) Run() {
4242 urls = utils .GetIPToUrlsLinks (r .options .IP , urls )
4343 } else if r .options .Update {
4444 selfUpdate ()
45+ } else if r .options .Version {
46+ getLatestVersion ()
47+ return
4548 } else {
4649 log .Error ("No file or url or ips specified" )
4750 return
Original file line number Diff line number Diff line change @@ -64,3 +64,28 @@ func selfUpdate() {
6464 log .Infof ("Successfully Updated to %s Version %s" , Repo , latest .Version )
6565
6666}
67+
68+ // 获取最新版本
69+ func getLatestVersion () {
70+ log .Info ("Crrunent Version: " , version )
71+ log .Infof ("Latest Version: %s" , getLatestVersionFromGithub ())
72+
73+ }
74+
75+ // 获取最新版本从github
76+ func getLatestVersionFromGithub () string {
77+ m := & update.Manager {
78+ Store : & githubUpdateStore.Store {
79+ Owner : Owner ,
80+ Repo : Repo ,
81+ Version : version ,
82+ },
83+ }
84+ releases , err := m .LatestReleases ()
85+ if err != nil {
86+ log .Error ("Failed to get releases" , err )
87+ return ""
88+ }
89+ latest := releases [0 ]
90+ return latest .Version
91+ }
Original file line number Diff line number Diff line change @@ -8,17 +8,17 @@ import (
88func main () {
99 options := core .ParseOptions ()
1010
11- if options .Url != "" {
11+ //if options.Url != "" {
12+ //
13+ //} else if options.File != "" {
14+ //} else if options.IP != "" {
15+ //} else if options.SP {
16+ // return
17+ //} else {
18+ // log.Info("No url, file or ip specified")
19+ // return
20+ //}
1221
13- } else if options .File != "" {
14- } else if options .IP != "" {
15- } else if options .SP {
16- return
17- } else {
18- log .Info ("No url, file or ip specified" )
19- return
20- }
21- log .Info ("Starting SpringExploit" )
2222 r , _ := core .NewRunner (options )
2323 //log.Errorf("Error: %s", err)
2424
You can’t perform that action at this time.
0 commit comments