remove useless ';'
This commit is contained in:
parent
5fa5ca9041
commit
ade2b28e74
1 changed files with 15 additions and 15 deletions
|
@ -33,7 +33,7 @@ function extract_message(cookie_name, cookie_value, url)
|
||||||
|
|
||||||
-- add the SMF cookie to the header
|
-- add the SMF cookie to the header
|
||||||
local headers = {
|
local headers = {
|
||||||
["Cookie"] = cookie_name .. "=" .. cookie_value;
|
["Cookie"] = cookie_name .. "=" .. cookie_value
|
||||||
}
|
}
|
||||||
|
|
||||||
-- request
|
-- request
|
||||||
|
@ -46,39 +46,39 @@ function extract_message(cookie_name, cookie_value, url)
|
||||||
string_r = table.concat(t)
|
string_r = table.concat(t)
|
||||||
|
|
||||||
-- extract message and key
|
-- extract message and key
|
||||||
message = string.match(string_r, '\'([a-z]+)\'');
|
message = string.match(string_r, '\'([a-z]+)\'')
|
||||||
key = string.match(string_r, '\'([0-9]+)\'');
|
key = string.match(string_r, '\'([0-9]+)\'')
|
||||||
|
|
||||||
return message, key;
|
return message, key
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- decrypt
|
-- decrypt
|
||||||
function decrypt(message, key)
|
function decrypt(message, key)
|
||||||
|
|
||||||
i = 0;
|
i = 0
|
||||||
char_code = 0;
|
char_code = 0
|
||||||
|
|
||||||
-- create the local table containing the solution
|
-- create the local table containing the solution
|
||||||
local r = {};
|
local r = {}
|
||||||
|
|
||||||
-- for each byte of the message
|
-- for each byte of the message
|
||||||
for i = 1, string.len(message), i + 1 do
|
for i = 1, string.len(message), i + 1 do
|
||||||
-- extract the char code
|
-- extract the char code
|
||||||
char_code = string.byte(message, i);
|
char_code = string.byte(message, i)
|
||||||
-- if it goes behind the "a" move to "z"
|
-- if it goes behind the "a" move to "z"
|
||||||
if (char_code - key < string.byte("a"))
|
if (char_code - key < string.byte("a"))
|
||||||
then
|
then
|
||||||
-- here goes the barbary...
|
-- here goes the barbary...
|
||||||
r[i] = string.char((string.byte("z")) - (key - (char_code -
|
r[i] = string.char((string.byte("z")) - (key - (char_code -
|
||||||
string.byte("a") - 1)));
|
string.byte("a") - 1)))
|
||||||
-- if it's not, just do it
|
-- if it's not, just do it
|
||||||
else
|
else
|
||||||
r[i] = string.char(char_code - key);
|
r[i] = string.char(char_code - key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return table.concat(r);
|
return table.concat(r)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ function decrypt(message, key)
|
||||||
|
|
||||||
-- add the SMF cookie to the header
|
-- add the SMF cookie to the header
|
||||||
local headers = {
|
local headers = {
|
||||||
["Cookie"] = cookie_name .. "=" .. cookie_value;
|
["Cookie"] = cookie_name .. "=" .. cookie_value
|
||||||
}
|
}
|
||||||
|
|
||||||
-- send the reply
|
-- send the reply
|
||||||
|
@ -102,7 +102,7 @@ function decrypt(message, key)
|
||||||
sink = ltn12.sink.table(t)
|
sink = ltn12.sink.table(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
return table.concat(t); -- return the token
|
return table.concat(t) -- return the token
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -120,9 +120,9 @@ function decrypt(message, key)
|
||||||
|
|
||||||
cookie_value, cookie_name = extract_cookie(conn)
|
cookie_value, cookie_name = extract_cookie(conn)
|
||||||
|
|
||||||
message, key = extract_message(cookie_name, cookie_value, arg[2]);
|
message, key = extract_message(cookie_name, cookie_value, arg[2])
|
||||||
|
|
||||||
r = decrypt(message, key);
|
r = decrypt(message, key)
|
||||||
|
|
||||||
token = send_response(r, arg[3])
|
token = send_response(r, arg[3])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue