Upload files to "emailLua"
This commit is contained in:
1
emailLua/email.conf
Normal file
1
emailLua/email.conf
Normal file
@@ -0,0 +1 @@
|
||||
server_id=15
|
||||
16
emailLua/emailServ.lua
Normal file
16
emailLua/emailServ.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local file = fs.open("/disk/email.conf","r")
|
||||
local conf = load("return {"..file.readAll().."}")()
|
||||
local modem = peripheral.wrap("top")
|
||||
modem.open(tonumber(conf.server_id))
|
||||
print("Email server is running...")
|
||||
|
||||
while true do
|
||||
local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
|
||||
if message == "35" then
|
||||
modem.transmit(replyChannel, 15, 135)
|
||||
else
|
||||
-- Here you would handle authentication, e.g. check user:pass
|
||||
print("Received credentials: " .. tostring(message))
|
||||
-- You can add logic to check credentials and respond accordingly
|
||||
end
|
||||
end
|
||||
16
emailLua/emailclient.lua
Normal file
16
emailLua/emailclient.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local file = fs.open("/disk/email.conf","r")
|
||||
local conf = load("return {"..file.readAll().."}")()
|
||||
local modem = peripheral.wrap("top")
|
||||
print("What is your username?")
|
||||
local user = io.read()
|
||||
print("Password?")
|
||||
local password = io.read()
|
||||
modem.open(tonumber(conf.server_id))
|
||||
modem.transmit(15, 20, "35")
|
||||
local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
|
||||
if message ~= 135 then
|
||||
local p = shell.getRunningProgram()
|
||||
shell.run(p)
|
||||
end
|
||||
local userpass = user..":"..pass
|
||||
modem.transmit(15, 20, userpass)
|
||||
Reference in New Issue
Block a user