Исходник Cryptor

Jertshat

Участник
Автор темы
28
41
держите для ознакомления готовый луа криптор.

Lua:
local random, randomseed = math.random, math.randomseed
local char, byte, gsub, match, sub, find =
    string.char, string.byte, string.gsub, string.match, string.sub, string.find
local insert, concat = table.insert, table.concat
math.randomseed(os.time())

local function getFileNameFromPath(path)
    return string.match(path, '.+\\(.-)$')
end
local function getFileNameFromPathWithoutEx(path)
    return string.match(path, '.+\\(.+)%..+$')
end

-----------------------------------------------------------------------------------

local val_to_str, key_to_str, tabletostring

function val_to_str ( v )
    if "string" == type( v ) then
        v = gsub( v, "\\", "\\\\" )
        v = gsub( v, "\n", "\\n" )
        v = gsub( v, "\t", "\\t" )
        if match( gsub(v,"[^'\"]",""), '^"+$' ) then
            return "'" .. v .. "'"
        end
        return '"' .. gsub(v,'"', '\\"' ) .. '"'
    else
        return "table" == type( v ) and tabletostring( v ) or
            tostring( v )
    end
end

function key_to_str ( k )
    if "string" == type( k ) and match( k, "^[_%a][_%a%d]*$" ) then
        return k
    else
        return "[" .. val_to_str( k ) .. "]"
    end
end
 
function tabletostring( tbl )
    local result, done = {}, {}
    for k, v in ipairs( tbl ) do
        insert( result, val_to_str( v ) )
        done[ k ] = true
    end
    for k, v in pairs( tbl ) do
        if not done[ k ] then
            insert( result,
            key_to_str( k ) .. "=" .. val_to_str( v ) )
        end
    end
    return "{" .. concat( result, "," ) .. "}"
end

local function crypt_func(text) -- crypt
    if not text or text == '' then return end
    local n1, n2 = random(20), random(20)
    while n1 == n2 do n1, n2 = random(20), random(20) end
    local n3 = random(#text)
    local key = { n3, byte(text, n3) }
    local crypt_text = { #text }
    for i = 1, #text do
    local char = byte(text, i)
        crypt_text[#crypt_text + 1] = char - n1 + n2
    end
    return { crypt_text, key }
end

local function get_params(text)
    local t = {}
    local b = ''
    for i = 1, #text do
        if find(sub(text, i, i), '%w') or find(sub(text, i, i), '[^%s%c%p\128-\191][\128-\191]*') then
            b = b .. sub(text, i, i)
        else
            if b ~= '' then
                t[#t + 1] = b
                b = ''
            end
            t[#t + 1] = byte(text, i)
        end
    end
    return t
end

-----------------------------------------------------------------------------------

os.execute('cls')

if #arg < 1 then
    io.write('Not found files.')
    return os.execute('pause')
end

local file = io.open(arg[1], 'rb')
local text = file:read('*a')
local res = tabletostring(crypt_func(text))

local antidecomp = [[local function _() ::SOSAT:: goto SOSAT end
local function __() return]]

for i = 1, math.random(220, 228) do
    antidecomp = antidecomp.." "..math.random(-2147483648, 2147483647)..","
end

antidecomp = antidecomp.." "..math.random(-2147483648, 2147483647).." end\n"

local code = [[
local g = _G
local char = 'c'
local str = ''

local function _____()
return str[char .. 'r']
end
   
char = char .. 'h' .. 'a'

local char = _____()

local chars = {
    {
        166,
        154,
        173,
        161
    },

    {
        171,
        154,
        167,
        157,
        168,
        166
    }
}

local math = ''
local random = ''

for i = 1, #chars[1] do
    math = math..char(chars[1][i] - 57)
end
for i = 1, #chars[2] do
    random = random..char(chars[2][i] - 57)
end

local random = g[math][random]

local function decrypt(tab) -- decrypt
    local a, b = tab[2][1], tab[2][2]
    local n1, n2 = random(20), random(20)
    while tab[1][a + 1] - n2 + n1 ~= b do n1, n2 = random(20), random(20) end
    local decrypt_text = ''
    for i = 2, tab[1][1] + 1 do
        decrypt_text = decrypt_text .. char(tab[1][i] - n2 + n1)
    end
    return decrypt_text
end

local res = decrypt]] .. res .. [[

local pcall = g[decrypt{{5, 125, 112, 110, 121, 121}, {4, 108}}]
local lua_thread = g[decrypt{{10, 120, 129, 109, 107, 128, 116, 126, 113, 109, 112}, {4, 95}}]
local create = decrypt{{6, 114, 129, 116, 112, 131, 116}, {3, 101}}
local loadstring = g[decrypt{{10,106,109,95,98,113,114,112,103,108,101},{2,111}}]
local string = decrypt{{6, 118, 119, 117, 108, 113, 106}, {1, 115}}
local dump = decrypt{{4, 108, 125, 117, 120}, {2, 117}}

local dump = g[string][dump]

local resc = pcall(dump, loadstring)

if not resc then
    lua_thread[create](function() loadstring(res)() end)
end
]]
local file = io.open(arg[1], 'w')
file:write(antidecomp..code)
file:close()
os.execute(string.format('luajit.exe -b "%s" "%s.luac"', arg[1], getFileNameFromPathWithoutEx(arg[1])))
 

AeSiK256

Участник
58
23
держите для ознакомления готовый луа криптор.

Lua:
local random, randomseed = math.random, math.randomseed
local char, byte, gsub, match, sub, find =
    string.char, string.byte, string.gsub, string.match, string.sub, string.find
local insert, concat = table.insert, table.concat
math.randomseed(os.time())

local function getFileNameFromPath(path)
    return string.match(path, '.+\\(.-)$')
end
local function getFileNameFromPathWithoutEx(path)
    return string.match(path, '.+\\(.+)%..+$')
end

-----------------------------------------------------------------------------------

local val_to_str, key_to_str, tabletostring

function val_to_str ( v )
    if "string" == type( v ) then
        v = gsub( v, "\\", "\\\\" )
        v = gsub( v, "\n", "\\n" )
        v = gsub( v, "\t", "\\t" )
        if match( gsub(v,"[^'\"]",""), '^"+$' ) then
            return "'" .. v .. "'"
        end
        return '"' .. gsub(v,'"', '\\"' ) .. '"'
    else
        return "table" == type( v ) and tabletostring( v ) or
            tostring( v )
    end
end

function key_to_str ( k )
    if "string" == type( k ) and match( k, "^[_%a][_%a%d]*$" ) then
        return k
    else
        return "[" .. val_to_str( k ) .. "]"
    end
end
 
function tabletostring( tbl )
    local result, done = {}, {}
    for k, v in ipairs( tbl ) do
        insert( result, val_to_str( v ) )
        done[ k ] = true
    end
    for k, v in pairs( tbl ) do
        if not done[ k ] then
            insert( result,
            key_to_str( k ) .. "=" .. val_to_str( v ) )
        end
    end
    return "{" .. concat( result, "," ) .. "}"
end

local function crypt_func(text) -- crypt
    if not text or text == '' then return end
    local n1, n2 = random(20), random(20)
    while n1 == n2 do n1, n2 = random(20), random(20) end
    local n3 = random(#text)
    local key = { n3, byte(text, n3) }
    local crypt_text = { #text }
    for i = 1, #text do
    local char = byte(text, i)
        crypt_text[#crypt_text + 1] = char - n1 + n2
    end
    return { crypt_text, key }
end

local function get_params(text)
    local t = {}
    local b = ''
    for i = 1, #text do
        if find(sub(text, i, i), '%w') or find(sub(text, i, i), '[^%s%c%p\128-\191][\128-\191]*') then
            b = b .. sub(text, i, i)
        else
            if b ~= '' then
                t[#t + 1] = b
                b = ''
            end
            t[#t + 1] = byte(text, i)
        end
    end
    return t
end

-----------------------------------------------------------------------------------

os.execute('cls')

if #arg < 1 then
    io.write('Not found files.')
    return os.execute('pause')
end

local file = io.open(arg[1], 'rb')
local text = file:read('*a')
local res = tabletostring(crypt_func(text))

local antidecomp = [[local function _() ::SOSAT:: goto SOSAT end
local function __() return]]

for i = 1, math.random(220, 228) do
    antidecomp = antidecomp.." "..math.random(-2147483648, 2147483647)..","
end

antidecomp = antidecomp.." "..math.random(-2147483648, 2147483647).." end\n"

local code = [[
local g = _G
local char = 'c'
local str = ''

local function _____()
return str[char .. 'r']
end
  
char = char .. 'h' .. 'a'

local char = _____()

local chars = {
    {
        166,
        154,
        173,
        161
    },

    {
        171,
        154,
        167,
        157,
        168,
        166
    }
}

local math = ''
local random = ''

for i = 1, #chars[1] do
    math = math..char(chars[1][i] - 57)
end
for i = 1, #chars[2] do
    random = random..char(chars[2][i] - 57)
end

local random = g[math][random]

local function decrypt(tab) -- decrypt
    local a, b = tab[2][1], tab[2][2]
    local n1, n2 = random(20), random(20)
    while tab[1][a + 1] - n2 + n1 ~= b do n1, n2 = random(20), random(20) end
    local decrypt_text = ''
    for i = 2, tab[1][1] + 1 do
        decrypt_text = decrypt_text .. char(tab[1][i] - n2 + n1)
    end
    return decrypt_text
end

local res = decrypt]] .. res .. [[

local pcall = g[decrypt{{5, 125, 112, 110, 121, 121}, {4, 108}}]
local lua_thread = g[decrypt{{10, 120, 129, 109, 107, 128, 116, 126, 113, 109, 112}, {4, 95}}]
local create = decrypt{{6, 114, 129, 116, 112, 131, 116}, {3, 101}}
local loadstring = g[decrypt{{10,106,109,95,98,113,114,112,103,108,101},{2,111}}]
local string = decrypt{{6, 118, 119, 117, 108, 113, 106}, {1, 115}}
local dump = decrypt{{4, 108, 125, 117, 120}, {2, 117}}

local dump = g[string][dump]

local resc = pcall(dump, loadstring)

if not resc then
    lua_thread[create](function() loadstring(res)() end)
end
]]
local file = io.open(arg[1], 'w')
file:write(antidecomp..code)
file:close()
os.execute(string.format('luajit.exe -b "%s" "%s.luac"', arg[1], getFileNameFromPathWithoutEx(arg[1])))
неужели хороший криптор, наконец дождались
 

cort

Активный
275
79
держите для ознакомления готовый луа криптор.

Lua:
local random, randomseed = math.random, math.randomseed
local char, byte, gsub, match, sub, find =
    string.char, string.byte, string.gsub, string.match, string.sub, string.find
local insert, concat = table.insert, table.concat
math.randomseed(os.time())

local function getFileNameFromPath(path)
    return string.match(path, '.+\\(.-)$')
end
local function getFileNameFromPathWithoutEx(path)
    return string.match(path, '.+\\(.+)%..+$')
end

-----------------------------------------------------------------------------------

local val_to_str, key_to_str, tabletostring

function val_to_str ( v )
    if "string" == type( v ) then
        v = gsub( v, "\\", "\\\\" )
        v = gsub( v, "\n", "\\n" )
        v = gsub( v, "\t", "\\t" )
        if match( gsub(v,"[^'\"]",""), '^"+$' ) then
            return "'" .. v .. "'"
        end
        return '"' .. gsub(v,'"', '\\"' ) .. '"'
    else
        return "table" == type( v ) and tabletostring( v ) or
            tostring( v )
    end
end

function key_to_str ( k )
    if "string" == type( k ) and match( k, "^[_%a][_%a%d]*$" ) then
        return k
    else
        return "[" .. val_to_str( k ) .. "]"
    end
end
 
function tabletostring( tbl )
    local result, done = {}, {}
    for k, v in ipairs( tbl ) do
        insert( result, val_to_str( v ) )
        done[ k ] = true
    end
    for k, v in pairs( tbl ) do
        if not done[ k ] then
            insert( result,
            key_to_str( k ) .. "=" .. val_to_str( v ) )
        end
    end
    return "{" .. concat( result, "," ) .. "}"
end

local function crypt_func(text) -- crypt
    if not text or text == '' then return end
    local n1, n2 = random(20), random(20)
    while n1 == n2 do n1, n2 = random(20), random(20) end
    local n3 = random(#text)
    local key = { n3, byte(text, n3) }
    local crypt_text = { #text }
    for i = 1, #text do
    local char = byte(text, i)
        crypt_text[#crypt_text + 1] = char - n1 + n2
    end
    return { crypt_text, key }
end

local function get_params(text)
    local t = {}
    local b = ''
    for i = 1, #text do
        if find(sub(text, i, i), '%w') or find(sub(text, i, i), '[^%s%c%p\128-\191][\128-\191]*') then
            b = b .. sub(text, i, i)
        else
            if b ~= '' then
                t[#t + 1] = b
                b = ''
            end
            t[#t + 1] = byte(text, i)
        end
    end
    return t
end

-----------------------------------------------------------------------------------

os.execute('cls')

if #arg < 1 then
    io.write('Not found files.')
    return os.execute('pause')
end

local file = io.open(arg[1], 'rb')
local text = file:read('*a')
local res = tabletostring(crypt_func(text))

local antidecomp = [[local function _() ::SOSAT:: goto SOSAT end
local function __() return]]

for i = 1, math.random(220, 228) do
    antidecomp = antidecomp.." "..math.random(-2147483648, 2147483647)..","
end

antidecomp = antidecomp.." "..math.random(-2147483648, 2147483647).." end\n"

local code = [[
local g = _G
local char = 'c'
local str = ''

local function _____()
return str[char .. 'r']
end
  
char = char .. 'h' .. 'a'

local char = _____()

local chars = {
    {
        166,
        154,
        173,
        161
    },

    {
        171,
        154,
        167,
        157,
        168,
        166
    }
}

local math = ''
local random = ''

for i = 1, #chars[1] do
    math = math..char(chars[1][i] - 57)
end
for i = 1, #chars[2] do
    random = random..char(chars[2][i] - 57)
end

local random = g[math][random]

local function decrypt(tab) -- decrypt
    local a, b = tab[2][1], tab[2][2]
    local n1, n2 = random(20), random(20)
    while tab[1][a + 1] - n2 + n1 ~= b do n1, n2 = random(20), random(20) end
    local decrypt_text = ''
    for i = 2, tab[1][1] + 1 do
        decrypt_text = decrypt_text .. char(tab[1][i] - n2 + n1)
    end
    return decrypt_text
end

local res = decrypt]] .. res .. [[

local pcall = g[decrypt{{5, 125, 112, 110, 121, 121}, {4, 108}}]
local lua_thread = g[decrypt{{10, 120, 129, 109, 107, 128, 116, 126, 113, 109, 112}, {4, 95}}]
local create = decrypt{{6, 114, 129, 116, 112, 131, 116}, {3, 101}}
local loadstring = g[decrypt{{10,106,109,95,98,113,114,112,103,108,101},{2,111}}]
local string = decrypt{{6, 118, 119, 117, 108, 113, 106}, {1, 115}}
local dump = decrypt{{4, 108, 125, 117, 120}, {2, 117}}

local dump = g[string][dump]

local resc = pcall(dump, loadstring)

if not resc then
    lua_thread[create](function() loadstring(res)() end)
end
]]
local file = io.open(arg[1], 'w')
file:write(antidecomp..code)
file:close()
os.execute(string.format('luajit.exe -b "%s" "%s.luac"', arg[1], getFileNameFromPathWithoutEx(arg[1])))
как использовать?
 

Leatington

Известный
258
71
  • Нравится
Реакции: congic

cort

Активный
275
79
Установить Lua и через командную строку запустить, передавая аргументом файл, который нужно "закриптовать".
1682447562298.png


1682447569712.png
 

Randy

Известный
73
41
Отложил на полочку, когда увидел этот пост в начале апреля. Сейчас дошли руки. Воспользовался. Работает. Интересненько. Можно и посмотреть, как оно работает. Вдвойне годно. Благодарю.
 

Nerykery

Известный
521
125
Отложил на полочку, когда увидел этот пост в начале апреля. Сейчас дошли руки. Воспользовался. Работает. Интересненько. Можно и посмотреть, как оно работает. Вдвойне годно. Благодарю.
Как луа установить?
 

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,770
11,213
Как луа установить?

1682780430234.png
 
  • Ха-ха
  • Вау
Реакции: Randy и sat0ry

CaJlaT

Овощ
Модератор
2,806
2,606
чтобы запускать из любой папки написав luajit нужно в настройках среды как-то там добавить в path папку с луажитом
Долгий метод:
1. Пкм по пуску - Система
2. Дополнительные параметры системы
3. Вкладка "Дополнительно", кнопка "Переменные среды"
4. Выбрать "Path", нажать "Изменить"
5. Кнопка "Обзор" - Выбрать папку с luajit.exe
1682781268208.png

1682781315762.png

1682781330323.png

1682781615806.png
Быстрый метод:
1. В поиске ввести "Переменных", открыть "Изменение системных переменных среды"
2. Вкладка "Дополнительно", кнопка "Переменные среды"
3. Выбрать "Path", нажать "Изменить"
4. Кнопка "Обзор" - Выбрать папку с luajit.exe
1682781733972.png
1682781330323.png

1682781615806.png
 
  • Нравится
Реакции: Madjestik