Advertisement
tanmay606

ShellShock Vulnerablity Scanner [ Python ]

May 5th, 2015
676
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.76 KB | None | 0 0
  1. """
  2. C0der : Tanmay [ 13lackD3m0n ]
  3. Facebook : tanmay606
  4. Script : ShellShock Vulnerablity Checking Script.
  5.  
  6. [+] If you want to use this script on remote server, first upload it and then open it. [/+]
  7.  
  8. """
  9. import os,sys,time
  10. try:
  11.  from colorama import Fore,Back
  12. except ImportError:
  13.  print "\n[ERROR]"
  14.  print "\t[1] You need colorama module to run this script. [ install it first ]"
  15.  print "\t[2] This script will not work in WIN. [ only for linux,unix,mac based ]";
  16.  sys.exit(1);
  17. exploit_cmd = "echo vulnerable"; #!execute if server is affected.
  18. sleep_time = int('2'); #!time to sleep.
  19. real_cmd = "echo complete successfull."; #! execute in both cases.
  20.  
  21. def _banner_():
  22.  print (Fore.GREEN+"\t- > ShellShock Vulnerablity Scanner Script."+Fore.RESET);
  23.  print (Fore.GREEN+"\t- > Author : Tanmay [ 13lackD3Mon ]"+Fore.RESET);
  24.  print "\n";
  25.  sys.stdout.write("\t[#] Checking SYSTEM/OS for ShellShock Vulnerablity . . . . . .\n\n\r");
  26.  sys.stdout.flush();
  27.  time.sleep(sleep_time);
  28.  
  29. _banner_();
  30.  
  31. def _vul_():
  32.  print (Back.RED + "\t[WARNING] Your SERVER/OS is affected with ShellShock Vulnerablity.\a" + Back.RESET)
  33.  print (Back.GREEN + "\t [FIX] immediately update BASH.".upper() + Back.RESET)
  34.  
  35. def _notvul_():
  36.  print "[SUCCESS] Your SYSTEM in properly pathed from shellshock vulnerablity.\a";
  37.  
  38. def _check_(exploit_cmd):
  39.  for cmd in os.popen("env val='() { :; }; %s' bash -c '%s'"%(exploit_cmd,real_cmd)):
  40.   if("vulnerable" in cmd): #!if vul. code found in result which means OS/SERVER execute crafted command and vulnerable to shellshock
  41.    _vul_();
  42.    sys.exit(1);
  43.   else: #! if not execute crafted command which means system is pathed from shellshock.
  44.    _notvul_();
  45.    sys.exit(1);
  46.  
  47. _check_(exploit_cmd); #!Trigger hook.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement