forked from redhuntlabs/Hunt4Spring
-
Notifications
You must be signed in to change notification settings - Fork 1
/
scanner.go
50 lines (43 loc) · 893 Bytes
/
scanner.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
func heuristicCheck(url string) bool {
log.Println("Checking:", url)
targeturl := url + "?class.module.abcd.URLs%5B0%5D=0"
resp, err := http.Get(targeturl)
if err != nil {
return false
}
defer resp.Body.Close()
if resp.StatusCode == 400 {
return false
} else if heuristicScan(url) {
return true
}
return false
}
func heuristicScan(url string) bool {
targeturl := url + "?class.module.classLoader.URLs%5B0%5D=0"
resp, err := http.Get(targeturl)
if err != nil {
return false
}
defer resp.Body.Close()
if resp.StatusCode == 400 {
log.Println(url, "[Seems to be vulnerable!]")
return true
}
return false
}
func serializeJSON(fname string) bool {
data, err := json.MarshalIndent(finalData, "", " ")
if err != nil {
return false
}
ioutil.WriteFile(fname, data, 0644)
return true
}