1
0
mirror of https://github.com/kepler155c/opus synced 2025-11-12 13:33:54 +00:00

format and installer branches

This commit is contained in:
kepler155c@gmail.com
2018-01-24 17:39:38 -05:00
parent 1eea0d7cd8
commit 5a32fe208e
80 changed files with 10742 additions and 10156 deletions

View File

@@ -6,30 +6,30 @@ local Util = require('util')
Event.addRoutine(function()
print('trust: listening on port 19')
while true do
local socket = Socket.server(19)
print('trust: listening on port 19')
while true do
local socket = Socket.server(19)
print('trust: connection from ' .. socket.dhost)
print('trust: connection from ' .. socket.dhost)
local data = socket:read(2)
if data then
local password = Security.getPassword()
if not password then
socket:write({ msg = 'No password has been set' })
else
data = Crypto.decrypt(data, password)
if data and data.pk and data.dh == socket.dhost then
local trustList = Util.readTable('usr/.known_hosts') or { }
trustList[data.dh] = data.pk
Util.writeTable('usr/.known_hosts', trustList)
local data = socket:read(2)
if data then
local password = Security.getPassword()
if not password then
socket:write({ msg = 'No password has been set' })
else
data = Crypto.decrypt(data, password)
if data and data.pk and data.dh == socket.dhost then
local trustList = Util.readTable('usr/.known_hosts') or { }
trustList[data.dh] = data.pk
Util.writeTable('usr/.known_hosts', trustList)
socket:write({ success = true, msg = 'Trust accepted' })
else
socket:write({ msg = 'Invalid password' })
end
end
end
socket:close()
end
socket:write({ success = true, msg = 'Trust accepted' })
else
socket:write({ msg = 'Invalid password' })
end
end
end
socket:close()
end
end)