-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,5 @@ test/make | |
3rd/zlib/zconf.h | ||
3rd/zlib/zlib.pc | ||
|
||
3rd/zlib/zlib.a | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
#lua代码加密 | ||
|
||
skynet_fly_path=$1 | ||
key=$2 | ||
targetpath=$3 | ||
|
||
if [ "$#" -lt 2 ]; then | ||
echo "请输入2个参数 skynet_fly_path and key" | ||
exit 1 | ||
fi | ||
|
||
shell_path="${skynet_fly_path}/script/shell" | ||
|
||
bash ${shell_path}/make_encrycode.sh ${skynet_fly_path} ${key} ${targetpath} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
local assert = assert | ||
local ARGV = { ... } | ||
local skynet_fly_path = ARGV[1] | ||
local key = ARGV[2] | ||
local targetpath = ARGV[3] | ||
assert(skynet_fly_path, '缺少 skynet_fly_path') | ||
assert(key, "缺少 key") | ||
assert(key:len() == 8, "key 长度不对 ".. key) | ||
|
||
local skynet_path = skynet_fly_path .. '/skynet' | ||
|
||
package.cpath = skynet_fly_path .. "/luaclib/?.so;" .. skynet_path .. '/luaclib/?.so;' | ||
package.path = './?.lua;' .. skynet_fly_path .. "/lualib/?.lua;" | ||
|
||
if not targetpath then | ||
targetpath = './encrycode/' | ||
end | ||
|
||
if not os.execute("mkdir -p " .. targetpath) then | ||
error("create targetpath err") | ||
end | ||
|
||
local file_util = require "skynet-fly.utils.file_util" | ||
local table_util = require "skynet-fly.utils.table_util" | ||
local crypt = require "client.crypt" | ||
|
||
targetpath = file_util.path_join(targetpath, '/') | ||
|
||
local sfind = string.find | ||
local sgsub = string.gsub | ||
local loadfile = loadfile | ||
local sdump = string.dump | ||
local io = io | ||
|
||
local cmd = string.format("cp -r %s %s", './', targetpath) | ||
if not os.execute(cmd) then | ||
error("cp err ", cmd) | ||
end | ||
|
||
for file_name, file_path, file_info in file_util.diripairs('./') do | ||
if sfind(file_name, '.lua', nil, true) and not sfind(file_path, './encrycode/', nil, true) and not sfind(file_path, './make/', nil, true) then | ||
local code_func = loadfile(file_path) | ||
if not code_func then | ||
print("can`t loadfile >>> ", file_path) | ||
else | ||
local code_str = string.dump(code_func) | ||
local encode_str = crypt.desencode(key, code_str) | ||
local new_path = sgsub(file_path, './', targetpath, 1) | ||
local dir_path = sgsub(new_path, file_name, '', 1) | ||
if not os.execute("mkdir -p " .. dir_path) then | ||
print("create dir_path err ", dir_path) | ||
else | ||
local newfile = io.open(new_path, "w+") | ||
if not newfile then | ||
print("can`t openfile >>> ", new_path) | ||
else | ||
newfile:write(encode_str) | ||
newfile:close() | ||
print("encry file succ:", new_path) | ||
loadfile(new_path) --测试加载 | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
skynet_fly_path=$1 | ||
key=$2 | ||
targetpath=$3 | ||
|
||
lua=""${skynet_fly_path}"/skynet/3rd/lua/lua" | ||
script_path="${skynet_fly_path}/script/lua" | ||
|
||
${lua} ${script_path}/encrycode.lua ${skynet_fly_path} ${key} ${targetpath} |
Submodule skynet
updated
3 files
+526 −0 | 3rd/lua/lauxlib.c | |
+3 −1 | 3rd/lua/lauxlib.h | |
+2 −1 | 3rd/lua/lbaselib.c |