SHOW:
|
|
- or go back to the newest paste.
| 1 | local args = {...}
| |
| 2 | - | function starts(String,Start) |
| 2 | + | |
| 3 | - | return string.sub(String,1,string.len(Start))==Start |
| 3 | + | |
| 4 | print("Usage:")
| |
| 5 | - | connterm = false |
| 5 | + | |
| 6 | print("ssh open [port]")
| |
| 7 | print("ssh broadcast <message> <id> [port] ")
| |
| 8 | - | print("-----------Secure Shell 2.7-----------")
|
| 8 | + | |
| 9 | end | |
| 10 | if #args < 1 then | |
| 11 | usage() | |
| 12 | - | --print("ssh broadcast <message> <id> [port] ")
|
| 12 | + | |
| 13 | - | print("ssh setnick <nickname>")
|
| 13 | + | |
| 14 | - | print("ssh testopen <id> [port]")
|
| 14 | + | |
| 15 | - | print("ssh update")
|
| 15 | + | |
| 16 | - | print("-----------Secure Shell 2.7-----------")
|
| 16 | + | |
| 17 | local server = rednet.lookup(args[3], args[4]) | |
| 18 | if server then | |
| 19 | rednet.broadcast(args[2], args[3]) | |
| 20 | print("Broadcasted: \"", args[2], "\" to: \"", args[3])
| |
| 21 | else | |
| 22 | print("Error: Secure shell server does not exist!")
| |
| 23 | end | |
| 24 | - | if args[1] == "update" then |
| 24 | + | |
| 25 | - | shell.setAlias("pastebin", "/rom/programs/http/pastebin")
|
| 25 | + | |
| 26 | - | shell.run("pastebin run qHUXSZHg")
|
| 26 | + | |
| 27 | - | shell.setAlias("pastebin", "/os/un")
|
| 27 | + | |
| 28 | print("Broadcasted: \"", args[2], "\" to: \"", args[3])
| |
| 29 | - | if args[1] == "testopen" then |
| 29 | + | |
| 30 | print("Error Secure shell server does not exist!")
| |
| 31 | - | if #args > 2 then |
| 31 | + | |
| 32 | - | local server = rednet.lookup(args[2], args[3]) |
| 32 | + | |
| 33 | else | |
| 34 | - | print("That server does exist!")
|
| 34 | + | |
| 35 | local id = os.getComputerID() | |
| 36 | - | print("That server does Not exist!")
|
| 36 | + | |
| 37 | print("Trying to open on id: ", id, " Port: 25674")
| |
| 38 | rednet.open("top")
| |
| 39 | - | local server = rednet.lookup(args[2], "25674") |
| 39 | + | |
| 40 | rednet.host(ids, "25674") | |
| 41 | - | print("That server does exist!")
|
| 41 | + | |
| 42 | print("Trying to open on id: ", id, " Port: ", args[2])
| |
| 43 | - | print("That server does Not exist!")
|
| 43 | + | |
| 44 | local ids = tostring(id) | |
| 45 | rednet.host(ids, args[2]) | |
| 46 | - | |
| 46 | + | |
| 47 | else | |
| 48 | - | if args[1] == "setnick" then |
| 48 | + | |
| 49 | - | local file = fs.open("sshnickname", "w")
|
| 49 | + | |
| 50 | - | file.writeLine(args[2]) |
| 50 | + | |
| 51 | - | file.close() |
| 51 | + | |
| 52 | - | print("Nickname Set As: ", args[2])
|
| 52 | + | |
| 53 | print("Entering secure shell server!")
| |
| 54 | while true do | |
| 55 | local id, rec = rednet.receive(args[1]) | |
| 56 | - | local nnfile = fs.exists("sshnickname")
|
| 56 | + | print(id, ":", rec) |
| 57 | os.sleep(1) | |
| 58 | end | |
| 59 | else | |
| 60 | - | if nnfile then |
| 60 | + | |
| 61 | - | local filea = fs.open("sshnickname", "r")
|
| 61 | + | |
| 62 | - | local bc = filea.readLine()..": "..args[2] |
| 62 | + | |
| 63 | - | filea.close() |
| 63 | + | |
| 64 | - | rednet.broadcast(bc, args[3]) |
| 64 | + | |
| 65 | - | print("Broadcasted: ", bc, " to: \"", args[3],":",args[4], "\"")
|
| 65 | + | |
| 66 | if server then | |
| 67 | print("Entering secure shell server!")
| |
| 68 | - | print("Broadcasted: ", args[2], " to: \"", args[3],":",args[4], "\"")
|
| 68 | + | |
| 69 | local id, rec = rednet.receive(args[1]) | |
| 70 | print(id, ":", rec) | |
| 71 | os.sleep(1) | |
| 72 | end | |
| 73 | else | |
| 74 | print("Error: Secure shell server does not exist!")
| |
| 75 | end | |
| 76 | - | if nnfile then |
| 76 | + | |
| 77 | - | local filea = fs.open("sshnickname", "r")
|
| 77 | + | |
| 78 | - | local bc = filea.readLine()..": "..args[2] |
| 78 | + | |
| 79 | - | filea.close() |
| 79 | + | |
| 80 | - | rednet.broadcast(bc, args[3]) |
| 80 | + | |
| 81 | - | print("Broadcasted: ", bc, " to: \"", args[3],":",args[4], "\"")
|
| 81 | + |