Browse Source

新增des加解密方法

maxiaoshan 2 years ago
parent
commit
4c8363b199
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/spider/script.go

+ 9 - 0
src/spider/script.go

@@ -909,6 +909,15 @@ func (s *Script) LoadScript(site, channel, user *string, code, script_file strin
 		S.Push(lua.LString(result))
 		return 1
 	}))
+	//des ecb模式解密
+	s.L.SetGlobal("desDecryptECB", s.L.NewFunction(func(S *lua.LState) int {
+		origData := S.ToString(-2)
+		key := S.ToString(-1)
+		b, _ := base64.StdEncoding.DecodeString(origData)
+		result := util.DesECBDecrypter(b, []byte(key))
+		S.Push(lua.LString(result))
+		return 1
+	}))
 	//根据正文获取发布时间
 	s.L.SetGlobal("getPublishtime", s.L.NewFunction(func(S *lua.LState) int {
 		detail := S.ToString(-2)