Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow1ng committed May 11, 2024
2 parents 1d9b652 + 0fd6658 commit a11b769
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions Plugins/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,26 @@ func writekey(conn net.Conn, filename string) (flag bool, text string, err error

func writecron(conn net.Conn, host string) (flag bool, text string, err error) {
flag = false
_, err = conn.Write([]byte("CONFIG SET dir /var/spool/cron/\r\n"))
if err != nil {
// 尝试写入Ubuntu的路径
_, err = conn.Write([]byte("CONFIG SET dir /var/spool/cron/crontabs/\r\n"))
if err != nil {
return flag, text, err
}
text, err = readreply(conn)
}
text, err = readreply(conn)
if err != nil {
return flag, text, err
}
if !strings.Contains(text, "OK") {
// 如果没有返回"OK",可能是CentOS,尝试CentOS的路径
_, err = conn.Write([]byte("CONFIG SET dir /var/spool/cron/\r\n"))
if err != nil {
return flag, text, err
}
text, err = readreply(conn)
if err != nil {
return flag, text, err
}
}
if strings.Contains(text, "OK") {
_, err = conn.Write([]byte("CONFIG SET dbfilename root\r\n"))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion Plugins/webtitle.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func getRespBody(oResp *http.Response) ([]byte, error) {
}

func gettitle(body []byte) (title string) {
re := regexp.MustCompile("(?ims)<title>(.*?)</title>")
re := regexp.MustCompile("(?ims)<title.*?>(.*?)</title>")
find := re.FindSubmatch(body)
if len(find) > 1 {
title = string(find[1])
Expand Down

0 comments on commit a11b769

Please sign in to comment.