Advertisement
coderboy

rPhone (Roblox Phone) Software Test - Terminal

Jul 3rd, 2017
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.49 KB | None | 0 0
  1. local objs = {["container"]=nil,["textOutput"]=nil,["inputBar"]=nil,["fs"]=nil}
  2.  
  3. function download(URL,run)
  4.     print("URL --> https://pastebin.com/raw/" .. URL .. "|")
  5.     local hs = game:GetService("HttpService")
  6.     local code = hs:GetAsync("https://pastebin.com/raw/" .. URL, true)
  7.     local codem
  8.     local runn = true
  9.     while (runn and run) do
  10.         codem = script.Parent.run:FireServer(code)
  11.         codem = loadstring(code)
  12.         if (codem==nil) then print("[CODELOADER] RESULT NIL") else runn = false end
  13.         wait()
  14.         print("[CODELOADER] Attempting to compile code")
  15.     end
  16.     local function exe()
  17.         pcall(codem)
  18.     end
  19.     if (run) then
  20.         success, message = pcall( exe )
  21.         if success then
  22.             return true
  23.         else
  24.             print("code error")
  25.             return false
  26.         end
  27.     else
  28.         return code
  29.     end
  30. end
  31. function run(code)
  32.    
  33.     local runn = true
  34.     while (runn) do
  35.         codem = script.Parent.run:FireServer(code)
  36.         codem = loadstring(code)
  37.         if (codem==nil) then print("[CODELOADER] RESULT NIL") else runn = false end
  38.         wait()
  39.         print("[CODELOADER] Attempting to compile code")
  40.     end
  41.     local function exe()
  42.         pcall(codem)
  43.     end
  44.     success, message = pcall( exe )
  45.     if success then
  46.         return true
  47.     else
  48.         print("code error")
  49.         return false
  50.     end
  51. end
  52.  
  53. function save(code,name)
  54.     local sobj = Instance.new("StringValue")
  55.     sobj.Parent = objs["fs"]
  56.     sobj.Name = name
  57.     sobj.Value = code
  58.     objs["textOutput"].Text = "[APT] Code Saved"
  59. end
  60.  
  61. function lookupAPT(name)
  62.     local lib = require(script.Parent.API)
  63.     local addr = lib.repoLookup(name)
  64.     if (addr==nil) then
  65.         print("NILL ERROR")
  66.         return nil
  67.     else
  68.         return download(addr,false)
  69.     end
  70. end
  71.  
  72. function reboot()
  73.     print(" REBOOTING ")
  74.     local hs = game:GetService("HttpService")
  75.     local code = hs:GetAsync("https://pastebin.com/raw/Jwc507P3", true)
  76.     code = loadstring(code)
  77.     code()
  78. end
  79.  
  80. function pcmd()
  81.     print("Processing Command")
  82.     local cmd = objs["inputBar"].Text
  83.     local disp = objs["textOutput"]
  84.     if (string.sub(cmd,1,3)=="apt") then
  85.         print("APT READY")
  86.         disp.Text = "APT READY"
  87.         print(string.sub(cmd,5,7))
  88.         if (string.sub(cmd,5,7)=="get") then
  89.             print("DOWNLOADING")
  90.             local addr = string.sub(cmd,9)
  91.             disp.Text = "[APT] downloading and searching software repo"
  92.             local code = lookupAPT(addr)
  93.             if (code==nil) then
  94.                 disp.Text = "[APT] Error downloading code!"
  95.             else
  96.                 disp.Text = "[APT] saving code"
  97.                 save(code,addr)
  98.                 disp.Text = "[APT] code saved as '" .. addr .. "'!"
  99.             end
  100.         end    
  101.        
  102.         if (string.sub(cmd,5,7)=="run") then
  103.             print("Running Software")
  104.             local addr = string.sub(cmd,9)
  105.             local software = objs["fs"]:FindFirstChild(addr)
  106.             local state = run(software.Value)
  107.         end    
  108.        
  109.         if (string.sub(cmd,5,7)=="del") then
  110.             local addr = string.sub(cmd,9)
  111.             local software = objs["fs"]:FindFirstChild(addr)
  112.             software:Destroy()
  113.             disp.Text = "Software " .. addr .. " deleted!"
  114.         end    
  115.        
  116.         if (string.sub(cmd,5,8)=="repo") then
  117.             local addr = string.sub(cmd,10)
  118.             local lib = require(script.Parent.API)
  119.             lib.repoAddURL("https://pastebin.com/raw/" .. addr)
  120.             disp.Text = "Repository URL added!"
  121.         end
  122.         if (string.sub(cmd,5,8)=="mand") then
  123.             local addr = string.sub(cmd,10)
  124.             download(addr)
  125.         end
  126.     end
  127.  
  128. end
  129.  
  130. function runtime()
  131. print("Running TERMOS")
  132.  
  133. local display = script.Parent.Parent.Frame.screen
  134. display:ClearAllChildren()
  135.  
  136. --Load Objects into View
  137. local element
  138. --Start with the container
  139. element = objs["container"]
  140. element = Instance.new("Frame")
  141. element.Parent = display
  142. element.Size = UDim2.new(1,0,1,0)
  143. element.BackgroundColor = BrickColor.new(0,0,0)
  144. objs["container"] = element
  145.  
  146. --Now te textOutput
  147. element = objs["textOutput"]
  148. element = Instance.new("TextLabel")
  149. element.Parent = display.Frame
  150. element.Size = UDim2.new(1,0,0.2,0)
  151. element.BackgroundTransparency = 1
  152. element.Text = "> Loaded"
  153. element.TextColor3 = Color3.new(0,255,0)
  154. objs["textOutput"] = element
  155.  
  156. element = objs["inputBar"]
  157. element = Instance.new("TextBox")
  158. element.Parent = display.Frame
  159. element.Size = UDim2.new(1,0,0.1,0)
  160. element.Position = UDim2.new(0,0,0.9,0)
  161. element.BackgroundTransparency = 0
  162. element.Text = ""
  163. element.TextColor3 = Color3.new(0,255,0)
  164. objs["inputBar"] = element
  165.  
  166. objs["inputBar"].FocusLost:connect(pcmd)
  167.  
  168. --Create TMP FS
  169. objs["fs"] = Instance.new("Folder")
  170. objs["fs"].Parent = script.Parent
  171. objs["fs"].Name = "FS"
  172.  
  173.  
  174.  
  175. end
  176.  
  177. success, message = pcall( runtime )
  178. if success then
  179. else
  180.     print("An error occurred: "..message)
  181.     reboot()
  182. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement