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

Fallout style Hacking terminal

Started by BionicBear, 20 February 2013 - 02:30 AM
BionicBear #1
Posted 20 February 2013 - 03:30 AM
Title: Fallout style Hacking terminal

Hello i was just wondering if anyone has the Hacking terminal that was apparently at http://kyoshiku.net/fo3_term.rar I get a 404 error…

Overwise would someone be able to help me with designing my own, i already got a way of making it spit out random strings

local words = {"Hello", "World", "Random", "Word", "Gangnam", "wanker", "tosser", "", ""} -- A table containing all of the words that could get randomly put in to a line
local chars = "!#£$%&amp;'[]{}()/><~"..'"' --string containing all possible random character
local cols = {colours.green}
local word_col = colors.white
local l = 12 --length of each line
local Monitor = peripheral.call("top", "write", "Security: Online")
local h = 17 --amount of lines
local offset = {1,1} --offset of x,y cursor pos
for y=1,17 do
							    local line = ""
							    for i=1,l do
															    local n = math.random(string.len(chars)) --get a random character index from the string "chars"
															    line = line..chars:sub(n,n) -- put the random character on the end of the line
							    end
							    local n = math.random(string.len(line)) --get a random index of the string "line"
							    local str = {line:sub(1, n-1), line:sub(n, -1)} --split the string "line" before and after this index
							    local word = words[math.random(#words)]
							    line = str[1]..word..str[2] --put a random word either side of this n
							    for x=1,string.len(line) do
										 term.setCursorPos(offset[1]+(x-1), offset[2]+(y-1))
										 local col = cols[math.random(#cols)]
										 if x >= n and x <= (n+string.len(word)) then col = word_col end
										 term.setTextColor(col)
										 term.write(line:sub(x,x))
							    end
end

But i cant seem to get a couple of things to work,

External file loading (For a Dictionary.txt) so the words are not based in the code
Random password from generated words (i havent got a clue how to do this i only started learning lua this morning)
ChunLing #2
Posted 20 February 2013 - 08:03 PM
Check out the fs API (or the io API, but the wiki doesn't say as much, you'll have to read the code).

Describe a little more precisely what you mean by "Random password from generated words".
BionicBear #3
Posted 21 February 2013 - 06:08 PM
Thanks for that, but i figured i was biting off more than i could chew so i'm starting smaller, But what i meant was it reads the words it uses and chooses one as a password

Say if it loaded 5 words , It would choose one of those 5 to be a password, if that's any clear-er
BionicBear #4
Posted 21 February 2013 - 08:16 PM
Hey its me again, Im working on Something a tad bit smaller; A Screen that tells you if Security is on or off, and If It receives a red stone current it changes status (and colour!) And then Proceeds to unlock the door (sort of like Parsing the current)

Heres the Code :


local Mon0 = "back"
local Sct = "Security:"
local Err0 = "Offline"
local Err1 = "Online"
local Rdstn = "left"
local status = SecStatus
local Redstone1 = 5
function Mon0Stat(side, text0, status, times)
if peripheral.isPresent(side) then
  term.redirect(peripheral.wrap(side))
  for i = 1, times do
					    local cx, cy = term.getCursorPos()
					    write(status)
					    term.setCursorPos(cx, cy)
--   term.setTextColor(colours.red) commented due to not really needed
					    os.sleep(1)
   term.setTextColor(colours.white)
					    term.clearLine()
   term.setCursorPos(1,1) --Resets Cursor position to start to avoid Marquee Effect
   write(text0)
   local Err0 = redstone.getInput(Rdstn)
   if Err0
	 then
    term.setTextColor(colours.red) else --if its powered the color is red and Opens doors
    term.setTextColor(colours.green)
    redstone.getOutput("top", false) --if its not powered its green and closes doors
   end
   os.sleep(1)
   SecStatus(Rdstn) --Checks for redstone input change
   doorcont() 
			    end
			    term.restore()
	    end
end
function doorcont() -- Door Controls
if redstone.getInput(Rdstn) then --if it Recieves a redstone input from Side labeled "Rdstn" then Start a current on the top
redstone.getOutput("top", true) else
redstone.getOutput("top", false)
end
end
function SecStatus(side)
  if  redstone.getInput(side)
   then
    Mon0Stat(Mon0, Sct, Err0, 100) else
    Mon0Stat(Mon0, Sct, Err1, 100)
   end
end
SecStatus(Rdstn)
--peripheral.call(Mon0, "write", Sct) --Fallback Basic Monitor code
--flashyText(Mon0, "Offline", 2, 100) --Fallback from when i was using an api, Obsolete and wouldnt work anymore

The Redstone parsing bit doesnt seem to be working

Btw this Links into the Terminal, but this was just something i was doing while i got my head around lua
BionicBear #5
Posted 21 February 2013 - 08:51 PM
Oops Just realised what was wrong! I was using redstone.getOutput rather than redstone.setOutput…. That and a couple of other changes have made this work…Now i need to get back onto the Main terminal!
savior67 #6
Posted 03 March 2013 - 08:55 AM
I've actually been working on a nearly exact copy of the fallout hacking terminal. Almost finished too, ill keep you posted.

Edit:
Finished it today, check it out. http://www.computercraft.info/forums2/index.php?/topic/10978-fallout-terminal/