shuffled some files around

This commit is contained in:
kepler155c@gmail.com 2019-07-01 17:22:19 -04:00
parent 61a26d7c55
commit 9e85a0dae1
8 changed files with 33 additions and 17 deletions

View File

@ -13,7 +13,9 @@ local function trustConnection(socket)
if not password then
socket:write({ msg = 'No password has been set' })
else
data = Crypto.decrypt(data, password)
pcall(function()
data = Crypto.decrypt(data, password)
end)
if data and data.pk and data.dh == socket.dhost then
local trustList = Util.readTable('usr/.known_hosts') or { }
trustList[data.dh] = data.pk

View File

@ -1,4 +0,0 @@
fs.mount('sys/apps/pain.lua', 'urlfs', 'https://github.com/LDDestroier/CC/raw/master/pain.lua')
fs.mount('sys/apps/update.lua', 'urlfs', 'http://pastebin.com/raw/UzGHLbNC')
fs.mount('sys/apps/Enchat.lua', 'urlfs', 'https://raw.githubusercontent.com/LDDestroier/enchat/master/enchat3.lua')
fs.mount('sys/apps/cloud.lua', 'urlfs', 'https://cloud-catcher.squiddev.cc/cloud.lua')

View File

@ -10,3 +10,4 @@ if fs.exists('sys/autorun/gps.lua') then fs.delete('sys/autorun/gps.lua') end
if fs.exists('sys/autorun/gpsHost.lua') then fs.delete('sys/autorun/gpsHost.lua') end
if fs.exists('sys/apps/network/redserver.lua') then fs.delete('sys/apps/network/redserver.lua') end
if fs.exists('sys/apis') then fs.delete('sys/apis') end
if fs.exists('sys/autorun/apps.lua') then fs.delete('sys/autorun/apps.lua') end

4
sys/etc/fstab Normal file
View File

@ -0,0 +1,4 @@
sys/apps/pain.lua urlfs https://github.com/LDDestroier/CC/raw/master/pain.lua
sys/apps/update.lua urlfs http://pastebin.com/raw/UzGHLbNC
sys/apps/Enchat.lua urlfs https://raw.githubusercontent.com/LDDestroier/enchat/master/enchat3.lua
sys/apps/cloud.lua urlfs https://cloud-catcher.squiddev.cc/cloud.lua

4
sys/init/3.sys.lua Normal file
View File

@ -0,0 +1,4 @@
local fs = _G.fs
fs.mount('rom/modules/main/opus', 'linkfs', 'sys/modules/opus')
fs.loadTab('sys/etc/fstab')

View File

@ -29,9 +29,12 @@ for name in pairs(Packages:installed()) do
if fs.exists(helpPath) then
table.insert(helpPaths, helpPath)
end
local fstabPath = fs.combine(packageDir, 'etc/fstab')
if fs.exists(fstabPath) then
fs.loadTab(fstabPath)
end
end
help.setPath(table.concat(helpPaths, ':'))
shell.setPath(table.concat(appPaths, ':'))
fs.mount('rom/modules/main/opus', 'linkfs', 'sys/modules/opus')

View File

@ -164,7 +164,7 @@ local function decrypt(data, key)
data = Util.hexToByteArray(data[2])
key = sha2.digest(key)
local ptx = crypt(data, key, nonce, 1, ROUNDS)
return cbor.decode(tostring(ptx))
return cbor.decode(tostring(ptx))
end
local obj = {}

View File

@ -181,18 +181,24 @@ local function trusted(socket, msg, options)
local identifier = options and options.identifier or getIdentifier()
if identifier and type(msg.t) == 'table' then
local data = Crypto.decrypt(msg.t, Util.hexToByteArray(identifier))
local s, m = pcall(function()
if identifier and type(msg.t) == 'table' then
local data = Crypto.decrypt(msg.t, Util.hexToByteArray(identifier))
if data and data.ts and tonumber(data.ts) then
if math.abs(os.epoch('utc') - data.ts) < 4096 then
socket.remotePubKey = Util.hexToByteArray(data.pk)
socket.privKey, socket.pubKey = network.getKeyPair()
setupCrypto(socket)
return true
if data and data.ts and tonumber(data.ts) then
if math.abs(os.epoch('utc') - data.ts) < 4096 then
socket.remotePubKey = Util.hexToByteArray(data.pk)
socket.privKey, socket.pubKey = network.getKeyPair()
setupCrypto(socket)
return true
end
_G._syslog('time diff ' .. math.abs(os.epoch('utc') - data.ts))
end
_G._syslog('time diff ' .. math.abs(os.epoch('utc') - data.ts))
end
end)
if not s and m then
_G._syslog('trust failure')
_G._syslog(m)
end
end