This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Codexuk's profile picture

Password Finder & BootDrive (Bypass Password-Computers)

Started by Codexuk, 28 December 2017 - 07:41 PM
Codexuk #1
Posted 28 December 2017 - 08:41 PM
Well I'm pretty new to the Lua scripting language but I decided to make a somewhat useful bundle of programs
particularly aimed at getting around password-protected computers.

The first program is simple. os.pullEvent is there to prevent the computer from disabling the CTRL+T function to kill the current running program.

The second program scans the programs directory and the root directory. Then it compares its findings to a whitelist and finally returns the user-created programs to an array.
Finally, foreach item in this array, it will open the file and scan for quotations then returns that line with the quotes to another array.
The program then displays these lines from the array.


Requirements : Computer needs disk-drive attached

First Program :

 
term.clear()
term.setCursorPos(1,1)
os.pullEvent = os.pullEvent 
print("Bypass by Codex") 

Second Program :


--functions

function valid(data, array)
    local valid = {}
    for i = 1, #array do
        valid[array[i]] = true
    end

    if valid[data] then
        return false
    else
        return true
    end
end

function tablefind(tab, el)
    for index, value in pairs(tab) do
        if value == el then
            return index
        end
    end
end

function lines(s)
    if s:sub(-1)~="\n" then
        s=s.."\n"
    end
    return s:gmatch("(.-)\n")
end

--functions

print("Checking Programs . . .")
local FileList = fs.list("/rom/programs")
local MainList = fs.list("/")
local Whitelist = {"advanced", "command", "fun", "http", "pocket", "rednet", "turtle", "adventure.lua", "alias.lua", "apis.lua", "bg.lua", "copy.lua", "clear.lua", "chat.lua", "cd.lua", "delete.lua", "dj.lua", "drive.lua", "edit.lua", "gps.lua", "fg.lua", "exit.lua", "eject.lua", "hello.lua", "help.lua", "id.lua", "label.lua", "monitor.lua", "mkdir.lua", "lua.lua", "list.lua", "move.lua", "multishell.lua", "paint.lua", "pastebin.lua", "redirection.lua", "reboot.lua", "programs.lua", "peripherals.lua", "redstone.lua", "rename.lua", "repeat.lua", "set.lua", "type.lua", "time.lua", "shutdown.lua", "shell.lua", "wget.lua", "worm.lua"}
 FoundFiles = {}
-- RootFiles = {}
 miscFiles = {}

for _, file in ipairs(FileList) do
    table.insert(FoundFiles, file)
    print("Found Item : "..file)
    sleep(0.1)
end

print("Checking Root . . .")
for _, file in ipairs(MainList) do
    table.insert(FoundFiles, file)
    print("Found Item : "..file)
    sleep(0.1)
end

table.sort(Whitelist)
table.sort(FoundFiles)
table.sort(MainList)
table.sort(FileList)
--table.sort(RootFiles)


print("Comparing Files . . .")


for _, foundfile in ipairs(FoundFiles) do
    if not valid(foundfile, Whitelist) then

    else
        table.insert(miscFiles, foundfile)
        print("Possible script : "..foundfile)
    end  
end

print("Finalizing Search . . .")

HackFiles = {}
table.sort(miscFiles)

for _, afile in ipairs(miscFiles) do
    if afile == "rom" then
        --return    
    elseif afile == "disk" then
        --return
    else
        table.insert(HackFiles, afile)
    end
end

print("Listing user-made programs . . .")
for _, bfile in ipairs(HackFiles) do
    print("Found : "..bfile)
end

PPass = {}

for _, foundfile in ipairs(HackFiles) do
    content = fs.open(foundfile, "r")
    --print(content.readAll())
    for line in lines(content.readAll()) do
        if string.find(line, '"') then
            table.insert(PPass, line)
        end
    end
end
print("DONE!")
sleep(2)
term.clear()
term.setCursorPos(1,1)
print("Possible Passwords (in quotes)")    

for _, pass in ipairs(PPass) do
    print(pass)
end
Lupus590 #2
Posted 29 December 2017 - 10:43 AM
First program does nothing usesful.

Second program is going to get lot of noise, also I'm not sure if this counts as malicious or not.
Lyqyd #3
Posted 29 December 2017 - 07:30 PM
Not terribly malicious, it's essentially a cousin of the "strings" utility.
LoganDark2 #4
Posted 28 January 2018 - 07:36 PM
> aimed at getting around password-protected computers

Default Settings.

Namely, shell.allow_disk_startup - anybody who uses a password lock should be able to set that to false. In which case, your programs are useless.

But other than that, the first program can just be completely empty. CraftOS doesn't care.
Nothy #5
Posted 31 January 2018 - 11:07 AM
When I run the second program on CC 1.7 I get passwordfinder:97: attempt to index ? (a nil value)

pls fix
Lupus590 #6
Posted 31 January 2018 - 05:13 PM
When I run the second program on CC 1.7 I get passwordfinder:97: attempt to index ? (a nil value)

pls fix

Line 97 is commented out, are you sure you copied it right? Did you make any modifications? It might be worth sticking it on pastebin.
Nothy #7
Posted 01 February 2018 - 07:39 AM
Line 97 is commented out, are you sure you copied it right? Did you make any modifications? It might be worth sticking it on pastebin.

Typo, meant 98.