51 posts
Location
England
Posted 30 August 2012 - 01:00 PM
Is there a way to make a program that can change a password in another?
992 posts
Posted 30 August 2012 - 01:06 PM
Short Answer yes you can sorta
Long answer.
if you know exactly where the password is in the startup file you can write a program to take the hole program out edit that line and return it.If you don't know where the password is or what it is called then it becomes a extremely unlikely that you will edit the right line. you would most likely damage the target program.
If the password is stored on a different computer to the one you enter you user and pass into then there is slim to nill chance of getting it.
51 posts
Location
England
Posted 30 August 2012 - 01:14 PM
I know exactly where the password is and what it is. I just wanted to make it easier to change it.
992 posts
Posted 30 August 2012 - 01:28 PM
well you want to use fs api to open the file. read it in as lines into a table. then change the correct line in the table. then write all the data from the table to the file again.
51 posts
Location
England
Posted 30 August 2012 - 01:29 PM
Sorry but how do I do that?
992 posts
Posted 30 August 2012 - 02:27 PM
This lock can have its Password edited By the Patch program.
Spoiler
local user = "Random"
local password = "hello"
while true do
term.clear()
term.setCursorPos(1,1)
print("Please Enter Password")
if password == read("*") then
break
end
end
print("Welcome User")
Patcher
Spoiler
local sFile = "startup"
local line = 2
local tLines = {}
if fs.exists(sFile) then
local file = io.open(sFile, "r" )
local sLine = file:read()
while sLine do
table.insert( tLines, sLine )
sLine = file:read()
end
file:close()
write("New Passwordn:")
local pWord = read()
tLines[line] = [[local password = "]]..pWord..[["]]
print("Password Changed")
file = io.open(sFile,"w")
for i = 1,#tLines do
file:write(tLines[i].."n")
end
file:close()
end
You should be able to change the line the Patcher works with so it will work with your Lock. if you cane post your door code and i will make the ajustments
51 posts
Location
England
Posted 31 August 2012 - 07:55 PM
Thanks!