Advertisement
1337ings

[Python] Server-Spy

Nov 6th, 2016
1,052
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.69 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. # |---------------------------------------------|
  4. # | Welcome to "Server-Spy" |
  5. # |---------------------------------------------|
  6. # | This is for finding out where attackers |
  7. # | are trying to bruteforce or just simply |
  8. # | trying to attack your server. If you're |
  9. # | intrested in a version two show support |
  10. # |---------------------------------------------|
  11. # | Normal execution |
  12. # |---------------------------------------------|
  13. # | python server-spy.py |
  14. # |---------------------------------------------|
  15. # |---------------------------------------------|
  16. # | Note: This has only been tested on Centos |
  17. # |---------------------------------------------|
  18. import time, sys, os
  19.  
  20. print "\x1b[31m|---------------------------------------------|\x1b[0m"
  21. print "\x1b[31m| Welcome to ''Server-Spy'' |\x1b[0m"
  22. print "\x1b[31m|---------------------------------------------|\x1b[0m"
  23. print "\x1b[31m| This is for finding out where attackers |\x1b[0m"
  24. print "\x1b[31m| are trying to bruteforce or just simply |\x1b[0m"
  25. print "\x1b[31m| trying to attack your server. If you're |\x1b[0m"
  26. print "\x1b[31m| intrested in a version two show support |\x1b[0m"
  27. print "\x1b[31m|---------------------------------------------|\x1b[0m"
  28. print "\x1b[31m| D I S C L A I M E R |\x1b[0m"
  29. print "\x1b[31m|---------------------------------------------|\x1b[0m"
  30. print "\x1b[31m| Please keep eyes on the screen and read |\x1b[0m"
  31. print "\x1b[31m| everything that's displayed for InfoSec |\x1b[0m"
  32. print "\x1b[31m| on your security system! |\x1b[0m"
  33. print "\x1b[31m|---------------------------------------------|\x1b[0m"
  34. time.sleep(20)
  35.  
  36. print "\x1b[31m __ __ \x1b[0m"
  37. print "\x1b[31m/ _\ ___ _ ____ _____ _ __ / _\_ __ _ _ \x1b[0m"
  38. print "\x1b[31m\ \ / _ \ __\ \ / / _ \ __|____\ \| _ \| | | |\x1b[0m"
  39. print "\x1b[31m_\ \ __/ | \ / __/ | |_____|\ \ |_) | |_| |\x1b[0m"
  40. print "\x1b[31m\__/\___|_| \_/ \___|_| \__/ __/ \__ |\x1b[0m"
  41. print "\x1b[31m |_| |___/ \x1b[0m"
  42. print "\x1b[31m \x1b[0m"
  43. print "\x1b[31m /!\ Lets see who's all on your server shall we? /!\ \x1b[0m"
  44. os.system('who')
  45. print "|-----------------------------------------------------------------------------|"
  46. print "\x1b[31m If you see more than one login then your server has someone else logged in\x1b[0m"
  47. print "|-----------------------------------------------------------------------------|"
  48. time.sleep(10)
  49.  
  50.  
  51.  
  52. print "\x1b[31m __ __ \x1b[0m"
  53. print "\x1b[31m/ _\ ___ _ ____ _____ _ __ / _\_ __ _ _ \x1b[0m"
  54. print "\x1b[31m\ \ / _ \ __\ \ / / _ \ __|____\ \| _ \| | | |\x1b[0m"
  55. print "\x1b[31m_\ \ __/ | \ / __/ | |_____|\ \ |_) | |_| |\x1b[0m"
  56. print "\x1b[31m\__/\___|_| \_/ \___|_| \__/ __/ \__ |\x1b[0m"
  57. print "\x1b[31m |_| |___/ \x1b[0m"
  58. print "\x1b[31m \x1b[0m"
  59. print "\x1b[31m /!\ Lets see who's all logged in as usernames shall we? /!\ \x1b[0m"
  60. os.system('users')
  61. print "|-----------------------------------------------------------------------------|"
  62. print "\x1b[31m If you see more than one root ID then someone else is logged in\x1b[0m"
  63. print "|-----------------------------------------------------------------------------|"
  64. time.sleep(10)
  65.  
  66.  
  67.  
  68. print "\x1b[31m __ __ \x1b[0m"
  69. print "\x1b[31m/ _\ ___ _ ____ _____ _ __ / _\_ __ _ _ \x1b[0m"
  70. print "\x1b[31m\ \ / _ \ __\ \ / / _ \ __|____\ \| _ \| | | |\x1b[0m"
  71. print "\x1b[31m_\ \ __/ | \ / __/ | |_____|\ \ |_) | |_| |\x1b[0m"
  72. print "\x1b[31m\__/\___|_| \_/ \___|_| \__/ __/ \__ |\x1b[0m"
  73. print "\x1b[31m |_| |___/ \x1b[0m"
  74. print "\x1b[31m \x1b[0m"
  75. print "\x1b[31m /!\ Lets see who we are shall we? /!\ \x1b[0m"
  76. os.system('whoami')
  77. print "|-----------------------------------------------------------------------------|"
  78. print "\x1b[31m This is the ID of your username connected\x1b[0m"
  79. print "|-----------------------------------------------------------------------------|"
  80. time.sleep(10)
  81.  
  82.  
  83. print "\x1b[31m __ __ \x1b[0m"
  84. print "\x1b[31m/ _\ ___ _ ____ _____ _ __ / _\_ __ _ _ \x1b[0m"
  85. print "\x1b[31m\ \ / _ \ __\ \ / / _ \ __|____\ \| _ \| | | |\x1b[0m"
  86. print "\x1b[31m_\ \ __/ | \ / __/ | |_____|\ \ |_) | |_| |\x1b[0m"
  87. print "\x1b[31m\__/\___|_| \_/ \___|_| \__/ __/ \__ |\x1b[0m"
  88. print "\x1b[31m |_| |___/ \x1b[0m"
  89. print "\x1b[31m \x1b[0m"
  90. print "|-----------------------------------------------------------------------------|"
  91. print "\x1b[31m ! THIS WILL TAKE A FEW MINUTES TO CAT THE SECURE.LOG ! \x1b[0m"
  92. print "|-----------------------------------------------------------------------------|"
  93. time.sleep(15)
  94. os.system('cat /var/log/secure')
  95. print "|-----------------------------------------------------------------------------|"
  96. print "\x1b[31m Look through and you can find failed login attempts \x1b[0m"
  97. print "|-----------------------------------------------------------------------------|"
  98. time.sleep(10)
  99.  
  100.  
  101. print "\x1b[31m __ __ \x1b[0m"
  102. print "\x1b[31m/ _\ ___ _ ____ _____ _ __ / _\_ __ _ _ \x1b[0m"
  103. print "\x1b[31m\ \ / _ \ __\ \ / / _ \ __|____\ \| _ \| | | |\x1b[0m"
  104. print "\x1b[31m_\ \ __/ | \ / __/ | |_____|\ \ |_) | |_| |\x1b[0m"
  105. print "\x1b[31m\__/\___|_| \_/ \___|_| \__/ __/ \__ |\x1b[0m"
  106. print "\x1b[31m |_| |___/ \x1b[0m"
  107. print "\x1b[31m \x1b[0m"
  108. print "|-----------------------------------------------------------------------------|"
  109. print "\x1b[31m ! THIS WILL TAKE A FEW MINUTES TO CAT THE MESSAGES.LOG ! \x1b[0m"
  110. print "|-----------------------------------------------------------------------------|"
  111. time.sleep(15)
  112. os.system('cat /var/log/messages')
  113. print "|-----------------------------------------------------------------------------|"
  114. print "\x1b[31m You can see new modules installed and new sessions of root \x1b[0m"
  115. print "|-----------------------------------------------------------------------------|"
  116. time.sleep(10)
  117.  
  118.  
  119. print "\x1b[31m __ __ \x1b[0m"
  120. print "\x1b[31m/ _\ ___ _ ____ _____ _ __ / _\_ __ _ _ \x1b[0m"
  121. print "\x1b[31m\ \ / _ \ __\ \ / / _ \ __|____\ \| _ \| | | |\x1b[0m"
  122. print "\x1b[31m_\ \ __/ | \ / __/ | |_____|\ \ |_) | |_| |\x1b[0m"
  123. print "\x1b[31m\__/\___|_| \_/ \___|_| \__/ __/ \__ |\x1b[0m"
  124. print "\x1b[31m |_| |___/ \x1b[0m"
  125. print "\x1b[31m \x1b[0m"
  126. print "|-----------------------------------------------------------------------------|"
  127. print "\x1b[31m ! THIS WILL TAKE A FEW MINUTES TO CAT THE BASH_HISTORY ! \x1b[0m"
  128. print "|-----------------------------------------------------------------------------|"
  129. time.sleep(15)
  130. os.system('cat .bash_history')
  131. print "|-----------------------------------------------------------------------------|"
  132. print "\x1b[31m Check and see if you see any commands outputted that wasn't you \x1b[0m"
  133. print "|-----------------------------------------------------------------------------|"
  134. time.sleep(10)
  135.  
  136.  
  137. print "\x1b[31m __ __ \x1b[0m"
  138. print "\x1b[31m/ _\ ___ _ ____ _____ _ __ / _\_ __ _ _ \x1b[0m"
  139. print "\x1b[31m\ \ / _ \ __\ \ / / _ \ __|____\ \| _ \| | | |\x1b[0m"
  140. print "\x1b[31m_\ \ __/ | \ / __/ | |_____|\ \ |_) | |_| |\x1b[0m"
  141. print "\x1b[31m\__/\___|_| \_/ \___|_| \__/ __/ \__ |\x1b[0m"
  142. print "\x1b[31m |_| |___/ \x1b[0m"
  143. print "\x1b[31m \x1b[0m"
  144. print "|-----------------------------------------------------------------------------|"
  145. print "\x1b[31m Lets find out how many failed login attempts there is \x1b[0m"
  146. print "|-----------------------------------------------------------------------------|"
  147. time.sleep(15)
  148. os.system('grep "authentication failure" /var/log/secure')
  149. print "|-----------------------------------------------------------------------------|"
  150. print "\x1b[31m This will show all faliured authentication attempts in SSH \x1b[0m"
  151. print "|-----------------------------------------------------------------------------|"
  152. time.sleep(10)
  153.  
  154.  
  155.  
  156. print "\x1b[31m __ __ \x1b[0m"
  157. print "\x1b[31m/ _\ ___ _ ____ _____ _ __ / _\_ __ _ _ \x1b[0m"
  158. print "\x1b[31m\ \ / _ \ __\ \ / / _ \ __|____\ \| _ \| | | |\x1b[0m"
  159. print "\x1b[31m_\ \ __/ | \ / __/ | |_____|\ \ |_) | |_| |\x1b[0m"
  160. print "\x1b[31m\__/\___|_| \_/ \___|_| \__/ __/ \__ |\x1b[0m"
  161. print "\x1b[31m |_| |___/ \x1b[0m"
  162. print "\x1b[31m \x1b[0m"
  163. print "|-----------------------------------------------------------------------------|"
  164. print "\x1b[31m Lets find out how many seccuessful login attempts there is \x1b[0m"
  165. print "|-----------------------------------------------------------------------------|"
  166. time.sleep(15)
  167. os.system('cat /var/log/secure | grep sshd.*opened')
  168. print "|-----------------------------------------------------------------------------|"
  169. print "\x1b[31m This will show all seccuessful authentication in SSH \x1b[0m"
  170. print "|-----------------------------------------------------------------------------|"
  171. time.sleep(10)
  172.  
  173.  
  174. print "\x1b[31m ______ _ _ _ _ \x1b[0m"
  175. print "\x1b[31m | ____(_) (_) | | | |\x1b[0m"
  176. print "\x1b[31m | |__ _ _ __ _ ___| |__ ___ __| |\x1b[0m"
  177. print "\x1b[31m | __| | | _ \| / __| _ \ / _ \/ _ |\x1b[0m"
  178. print "\x1b[31m | | | | | | | \__ \ | | | __/ (_| |\x1b[0m"
  179. print "\x1b[31m |_| |_|_| |_|_|___/_| |_|\___|\____|\x1b[0m"
  180. time.sleep(10)
  181. print "|-----------------------------------------------------------------------------|"
  182. print "\x1b[31m Thank you for using Server-Spy \x1b[0m"
  183. print "|-----------------------------------------------------------------------------|"
  184. print "| All credits goes to Chris Poole | @codingplanets via Twitter |"
  185. print "|-----------------------------------------------------------------------------|"
  186. print "| Any bugs? Report them to me via Twitter! |"
  187. print "|-----------------------------------------------------------------------------|"
  188. print "|-----------------------------------------------------------------------------|"
  189. print "|-----------------------------------------------------------------------------|"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement