maxiaoshan 3 éve
szülő
commit
8dc52a9664
1 módosított fájl, 11 hozzáadás és 0 törlés
  1. 11 0
      src/spider/script.go

+ 11 - 0
src/spider/script.go

@@ -746,6 +746,17 @@ func (s *Script) LoadScript(code, script_file string, newstate bool) string {
 		S.Push(lua.LString(base64Text))
 		return 1
 	}))
+	//base64解密
+	s.L.SetGlobal("decodeBase64", s.L.NewFunction(func(S *lua.LState) int {
+		text := S.ToString(-1)
+		result := ""
+		byteText, err := base64.StdEncoding.DecodeString(text)
+		if err == nil {
+			result = string(byteText)
+		}
+		S.Push(lua.LString(result))
+		return 1
+	}))
 	//长度
 	s.L.SetGlobal("stringLen", s.L.NewFunction(func(S *lua.LState) int {
 		text := S.ToString(-1)