Upload files to "emailLua"

This commit is contained in:
2025-11-09 17:45:43 -05:00
parent c154932f37
commit 4a035eb89a
3 changed files with 33 additions and 0 deletions

1
emailLua/email.conf Normal file
View File

@@ -0,0 +1 @@
server_id=15

16
emailLua/emailServ.lua Normal file
View 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
View 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)