Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- --[[
- Give credit to derekseitz for the base-code!
- Types of viruses:
- R.A.K - Random access keys. These hook a math.random to startup and keep rebooting the computer until it gets a certain number.
- They will often display it's payload or allow the user to continue after it gets the number.
- Virus - Just your average malware. Often infect other files and display it's payload later.
- Attackware - These are usually made for revenge. They often flood rednet with long, spam messages or try to DDOS a certain url.
- R.A.T - Remote admin tools. They allow for the attacker to remotely access the system that is infected.
- Worm - ANY of the types of malware that spread. They often use an exploit, mass email, or infect floppy disks.
- Keyloggers - These log the keys that you type into the computer, and often upload them to pastebin as items such as key.log, etc
- Spyware - They can spy on ANYTHING you do. Keys, programs ran, programs edited, etc.
- P.U.P - Not guaranteed to be a virus, but can sneak out malicious functions.
- Trojan - Programs that download other malware or P.U.Ps.
- Adware - None found yet. Advertise other malware to you, this will likely become a problem in Firewolf 3.0 with http support.
- Crapware - Don't really damage your computer, but can be really annoying.
- Scareware - Same as crapware, except they are made to scare you in some way, such as saying "Deleting ROM", Deleting "bios.lua", or displaying a scary image.
- -- ]]
- UpdateURL = "https://snipt.net/raw/bf1103f7d45ff3f74a05a2075e5b5671/"
- VirusDefinitionsURL = "https://snipt.net/raw/59d2a60b6183005904b7192e1fc3914e/"
- function split(pString, pPattern)
- local Table = {n = 0} -- NOTE: use {n = 0} in Lua-5.0
- local fpat = "(.-)" .. pPattern
- local last_end = 1
- local s, e, cap = pString:find(fpat, 1)
- while s do
- if s ~= 1 or cap ~= "" then
- table.insert(Table,cap)
- end
- last_end = e+1
- s, e, cap = pString:find(fpat, last_end)
- end
- if last_end <= #pString then
- cap = pString:sub(last_end)
- table.insert(Table, cap)
- end
- return Table
- end
- function isColor ()
- if term.isColor then return term.isColor() else return false end
- end
- function isEven ( nNum ) xn=0 while xn < nNum do xn = xn + 2 if xn == nNum then return true elseif xn > nNum then return false end end return false end
- function cPrint ( nString )
- if isEven(nString:len()) then nString = nString.." " end
- ox, oy = term.getCursorPos()
- scrWid, scrHei = term.getSize()
- term.setCursorPos(scrWid/2-nString:len()/2,oy)
- write(nString)
- term.setCursorPos(1,oy+1)
- end
- function fPrint ( nString )
- if isEven(nString:len()) then nString = nString.." " end
- ox, oy = term.getCursorPos()
- scrWid, scrHei = term.getSize()
- write(string.rep(" ",scrWid/2-nString:len()/2)..nString..string.rep(" ",scrWid/2-nString:len()/2))
- term.setCursorPos(1,oy+1)
- end
- function cLine ( nCol , rCol )
- ox, oy = term.getCursorPos()
- scrWid, scrHei = term.getSize()
- term.setBackgroundColor(nCol)
- write(string.rep(" ",scrWid))
- term.setBackgroundColor(rCol)
- term.setCursorPos(1,oy+1)
- end
- function tLine ( nT )
- ox, oy = term.getCursorPos()
- scrWid, scrHei = term.getSize()
- write(string.rep(nT:sub(1,1),scrWid))
- term.setCursorPos(1,oy+1)
- end
- function doError ( nErr )
- if isColor() then
- term.setBackgroundColor(colors.red)
- term.clear()
- term.setCursorPos(1,1)
- cPrint("ERROR")
- cLine(colors.white,colors.red)
- term.setCursorPos(3,4)
- write("Err: "..nErr)
- sleep(2)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(3,6)
- write("Press any key to reboot.")
- os.pullEvent("key")
- os.reboot()
- else
- term.clear()
- term.setCursorPos(1,1)
- cPrint("ERROR")
- tLine("-")
- term.setCursorPos(3,4)
- write("Err: "..nErr)
- sleep(2)
- term.setCursorPos(3,6)
- write("Press any key to reboot.")
- os.pullEvent("key")
- os.reboot()
- end
- end
- function rVirus ( nID )
- -- Name , Type , CatchString , Age , Common-ness , Danger , Estimated Total Infections , Curing Function , Sonar Pattern (NORTAN METHOD)
- return { name = nDefs[nID][1] , nType = nDefs[nID][2] , def = nDefs[nID][3] , age = nDefs[nID][4] , recurrency = nDefs[nID][5] , threatLevel = nDefs[nID][6] , infectionsToDate = nDefs[nID][7] , cure = nDefs[nID][8] , sonarPattern = nDefs[nID][9] }
- end
- curIt = ""
- curInf = 0
- curInfs = {}
- curInfsT = {}
- function scanDisplay ()
- while true do
- if isColor() then
- term.setBackgroundColor(colors.purple)
- term.clear()
- term.setCursorPos(1,1)
- cPrint("MALSCAN")
- cLine(colors.white,colors.purple)
- term.setCursorPos(3,4)
- write("Currently Scanning: "..curIt)
- term.setCursorPos(3,5)
- write("Infections: ")
- if curInf > 0 then
- term.setTextColor(colors.red)
- write(curInf)
- term.setTextColor(colors.white)
- else
- write(curInf)
- end
- term.setCursorPos(3,7)
- write("Stay Calm! Scanning!")
- else
- term.clear()
- term.setCursorPos(1,1)
- cPrint("MALSCAN")
- tLine("-")
- term.setCursorPos(3,4)
- write("Currently Scanning: "..curIt)
- term.setCursorPos(3,5)
- write("Infections: "..curInf)
- term.setCursorPos(3,7)
- write("Stay calm! Scanning!")
- end
- sleep(0.5)
- end
- end
- readStack = {
- }
- -- Prepare the readStack
- -- >:( I know there is an easier way! But.... I can't think of that right now, too many ideas! XD
- function toStack6 (nS5)
- for n5,m5 in ipairs(fs.list(nS5)) do
- readStack[#readStack+1] = nS5..m5
- end
- end
- function toStack5 (nS4)
- for n4,m4 in ipairs(fs.list(nS4)) do
- readStack[#readStack+1] = nS4..m4
- if fs.isDir(m4) then
- nCarry5 = n4
- toStack6(m4.."/")
- end
- end
- end
- function toStack4 (nS3)
- for n3,m3 in ipairs(fs.list(nS3)) do
- readStack[#readStack+1] = nS3..m3
- if fs.isDir(m3) then
- nCarry4 = n3
- toStack5(m3.."/")
- end
- nCarry4 = 0
- end
- end
- function toStack3 (nS2)
- for n2,m2 in ipairs(fs.list(nS2)) do
- readStack[#readStack+1] = nS2..m2
- if fs.isDir(m2) then
- nCarry3 = n2
- toStack4(m2.."/")
- end
- nCarry3 = 0
- end
- end
- function toStack2 (nS1)
- for n1,m1 in ipairs(fs.list(nS1)) do
- readStack[#readStack+1] = nS1..m1
- if fs.isDir(m1) then
- nCarry2 = n1
- toStack3(m1.."/")
- end
- nCarry2 = 0
- end
- end
- -- Teehee! ( >_> ) ffs world, I was thinking: "How can I prevent overlapping table variables??" So I came up with this BRILLIANT bugged out carry in / out system, BUT, I wasted 40 minutes on trying to solve this riddle when it was as simple as, table[#table+1]=var. >_< *facepalm*
- nCarry1 = 0
- nCarry2 = 0
- nCarry3 = 0
- nCarry4 = 0
- nCarry5 = 0
- nCarry6 = 0
- function toStack1 (nS)
- for n,m in ipairs(fs.list(nS)) do
- readStack[#readStack+1] = nS..m
- if fs.isDir(m) then
- nCarry1 = n
- toStack2(m.."/")
- end
- nCarry1 = 0
- end
- end
- toStack1("/")
- fileTable = {}
- function detectFile_MALDEF ( nData )
- if nData == nil then nData = "" ad=io.open(".errors.ffs","a") ad:write("Nil catchy! >:(\n") ad:close() end -- Error catch~ for debugging.
- for i=1, #nDefs do
- if string.find ( nData, rVirus(i).def ) ~= nil then
- return i
- end
- end
- return false
- end
- function scanProc ()
- -- WARNING: Caution of Remote Code Injection! INFECTED_FILE -> PASTEBIN -> INFECTED_CLIENT -> LOADSTRING(VIRUS)()
- -- Note to self: Perform a google search on common CC viruses (exact code) and have google tell you where they are stored.
- for n,m in ipairs(readStack) do
- if fs.exists(m) then if fs.isDir(m) == false then if fs.getSize(m) > 0 then if fs.isReadOnly(m) == false and m ~= shell.getRunningProgram() and m ~= "/"..shell.getRunningProgram() then
- curIt = m
- ell=fs.open(m,"r")
- md=ell:readAll()
- ell:close()
- di = detectFile_MALDEF(md)
- if di ~= false then
- curInfs[#curInfs+1]=n
- curInf = curInf + 1
- end
- end end end end
- end
- end
- function scan ()
- parallel.waitForAny (
- scanDisplay,
- scanProc
- )
- if isColor() then
- if curInf > 0 then
- term.setBackgroundColor(colors.red)
- term.clear()
- term.setCursorPos(1,1)
- cPrint("VirusScope has found threats.")
- cLine(colors.white,colors.red)
- term.setCursorPos(3,4)
- write("Threats detected: "..curInf)
- term.setCursorPos(3,6)
- for n,m in ipairs(curInfs) do
- fs.delete(readStack[m])
- end
- write("All threats are deleted!")
- -- Subject to change in the future, we might just store all deleted files in a . folder and have them restorable. Not right now though.
- aFi = io.open(".avl","a")
- for n,m in ipairs(curInfsT) do
- aFi:write(m.."\n")
- end
- aFi:close()
- term.setCursorPos(3,7)
- write("Press any key to reboot!")
- os.pullEvent("key")
- os.reboot()
- else
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.black)
- cPrint("ALL CLEAR")
- cLine(colors.lime,colors.white)
- term.setCursorPos(3,4)
- write("Infections: 0")
- term.setCursorPos(3,6)
- sleep(2)
- write("Press any key to reboot!")
- os.pullEvent("key")
- os.reboot()
- end
- else
- if curInfs > 0 then
- term.clear()
- term.setCursorPos(1,1)
- cPrint("THREATS FOUND")
- tLine("-")
- term.setCursorPos(3,4)
- for n,m in ipairs(curInfs) do
- fs.delete(readStack[m])
- end
- fileHandle = io.open(".avl","a")
- for n,m in ipairs(curInfsT) do
- fileHandle:write(m.."\n")
- end
- fileHandle:close()
- write("Threats: "..curInf)
- term.setCursorPos(3,6)
- write("All viruses deleted!")
- term.setCursorPos(3,7)
- sleep(2)
- write("Press any key to reboot!")
- os.pullEvent("key")
- os.reboot()
- else
- term.clear()
- term.setCursorPos(1,1)
- cPrint("ALL CLEAR")
- tLine("-")
- term.setCursorPos(3,4)
- write("Infections: 0")
- term.setCursorPos(3,6)
- sleep(2)
- write("Press any key to reboot!")
- os.pullEvent("key")
- os.reboot()
- end
- end
- end
- function wipe ()
- for n,m in ipairs(fs.list("")) do
- if m ~= "rom" and m ~= shell.getRunningProgram() then
- fs.delete(m)
- end
- end
- end
- function update ()
- resp = http.get(UpdateURL)
- if resp then
- aFs=io.open(shell.getRunningProgram(),"w")
- aFs:write(resp.readAll())
- aFs:close()
- shell.run(shell.getRunningProgram())
- else
- doError("Could not reach update server!")
- end
- end
- function recov ()
- term.clear()
- cPrint("Flare and all infected files has been deleted.")
- fs.delete("worm")
- fs.delete("cubedos/main")
- fs.delete("cubedos/block")
- fs.delete("edit")
- fs.delete("delete")
- fs.delete("edit")
- fs.delete("pastebin")
- fs.delete("lua")
- fs.delete("cd")
- fs.delete("dir")
- fs.delete("cube-dos")
- end
- function bscan ()
- if fs.exists("/startup") then fs.move("/startup","/startup.bk") end -- Stupid FS api... >_>
- fs.copy(shell.getRunningProgram(),"/startup")
- os.reboot()
- end
- bEndIt = false
- function bEnd ()
- bEndIt = true
- end
- menuOptions = {
- { "Scan" , scan },
- { "Wipe Computer" , wipe },
- { "Update" , update },
- { "Recover from Flare" , recov },
- { "Boot Scan" , bscan },
- { "Exit AV" , bEnd }
- }
- function doMenuProcessing ()
- while bEndIt == false do
- eve = { os.pullEvent() }
- if eve[1] == "key" and eve[2] == keys.down then
- if menuIndex < 6 then menuIndex = menuIndex + 1 mDraw() end
- end
- if eve[1] == "key" and eve[2] == keys.up then
- if menuIndex > 1 then menuIndex = menuIndex - 1 mDraw() end
- end
- if eve[1] == "key" and eve[2] == keys.enter then
- menuOptions[menuIndex][2]()
- end
- if eve[1] == "mouse_click" then
- if eve[4] == 4 then menuOptions[1][2]() end
- if eve[4] == 6 then menuOptions[2][2]() end
- if eve[4] == 8 then menuOptions[3][2]() end
- if eve[4] == 10 then menuOptions[4][2]() end
- if eve[4] == 12 then menuOptions[5][2]() end
- if eve[4] == 14 then menuOptions[6][2]() end
- end
- if bEndIt then break end
- end
- end
- menuIndex = 1
- function mDraw ()
- if isColor() then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- cPrint("VirusScope")
- cLine(colors.green,colors.black)
- term.setCursorPos(1,4)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- if menuIndex == 1 then fPrint("["..menuOptions[1][1].."]") else fPrint(menuOptions[1][1]) end
- term.setCursorPos(1,6)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- if menuIndex == 2 then fPrint("["..menuOptions[2][1].."]") else fPrint(menuOptions[2][1]) end
- term.setCursorPos(1,8)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- if menuIndex == 3 then fPrint("["..menuOptions[3][1].."]") else fPrint(menuOptions[3][1]) end
- term.setCursorPos(1,10)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- if menuIndex == 4 then fPrint("["..menuOptions[4][1].."]") else fPrint(menuOptions[4][1]) end
- term.setCursorPos(1,12)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- if menuIndex == 5 then fPrint("["..menuOptions[5][1].."]") else fPrint(menuOptions[5][1]) end
- term.setCursorPos(1,14)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- if menuIndex == 6 then fPrint("["..menuOptions[6][1].."]") else fPrint(menuOptions[6][1]) end
- doMenuProcessing()
- else
- term.clear()
- term.setCursorPos(1,1)
- cPrint("Shinjiteru MalScan")
- tLine("-")
- term.setCursorPos(1,4)
- if menuIndex == 1 then fPrint("["..menuOptions[1][1].."]") else fPrint(menuOptions[1][1]) end
- term.setCursorPos(1,6)
- if menuIndex == 2 then fPrint("["..menuOptions[2][1].."]") else fPrint(menuOptions[2][1]) end
- term.setCursorPos(1,8)
- if menuIndex == 3 then fPrint("["..menuOptions[3][1].."]") else fPrint(menuOptions[3][1]) end
- term.setCursorPos(1,10)
- if menuIndex == 4 then fPrint("["..menuOptions[4][1].."]") else fPrint(menuOptions[4][1]) end
- term.setCursorPos(1,12)
- if menuIndex == 5 then fPrint("["..menuOptions[5][1].."]") else fPrint(menuOptions[5][1]) end
- term.setCursorPos(1,14)
- if menuIndex == 6 then fPrint("["..menuOptions[6][1].."]") else fPrint(menuOptions[6][1]) end
- doMenuProcessing()
- end
- end
- mDraw()
- doMenuProcessing()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement