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 1
1
package core
2
2
3
3
import (
4
- log "github.com/sirupsen/logrus "
4
+ "fmt "
5
5
)
6
6
7
7
const banner = `
@@ -18,7 +18,7 @@ const banner = `
18
18
const version = "0.0.9"
19
19
20
20
func 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 " )
23
23
24
24
}
Original file line number Diff line number Diff line change @@ -78,8 +78,8 @@ func ParseOptions() *Options {
78
78
flag .Parse ()
79
79
80
80
// TODO 修改版本号
81
- ShowBanner (version )
82
81
logs .SaveLogs (options .LogFile )
82
+ ShowBanner (version )
83
83
showVerbose (options )
84
84
85
85
if options .Version {
Original file line number Diff line number Diff line change @@ -19,16 +19,16 @@ func NewRunner(options *Options) (*Runner, error) {
19
19
20
20
mops := structs .Map (& r .options )
21
21
data , _ := json .Marshal (mops )
22
- log .Info ("Runner created" )
22
+ log .Debug ("Runner created" )
23
23
log .Debug (mops )
24
24
log .Debug ("Runner options: " , string (data ))
25
25
return & r , nil
26
26
27
27
}
28
28
29
29
func (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" )
32
32
//ip := r.options.IP
33
33
var urls []string
34
34
// TODO: check if options are valid
@@ -42,6 +42,9 @@ func (r *Runner) Run() {
42
42
urls = utils .GetIPToUrlsLinks (r .options .IP , urls )
43
43
} else if r .options .Update {
44
44
selfUpdate ()
45
+ } else if r .options .Version {
46
+ getLatestVersion ()
47
+ return
45
48
} else {
46
49
log .Error ("No file or url or ips specified" )
47
50
return
Original file line number Diff line number Diff line change @@ -64,3 +64,28 @@ func selfUpdate() {
64
64
log .Infof ("Successfully Updated to %s Version %s" , Repo , latest .Version )
65
65
66
66
}
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 (
8
8
func main () {
9
9
options := core .ParseOptions ()
10
10
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
+ //}
12
21
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" )
22
22
r , _ := core .NewRunner (options )
23
23
//log.Errorf("Error: %s", err)
24
24
You can’t perform that action at this time.
0 commit comments