├── DPScan.py └── README /DPScan.py: -------------------------------------------------------------------------------- 1 | #!/home/bin/python 2 | #drupal modules scanner 3 | import os,sys,socket, subprocess 4 | 5 | __CMD__={ 6 | #WGET 7 | "wget":" wget -q -O - ", 8 | "grep":" | grep modules", 9 | "output_file":" cat ", 10 | "help": "DRUPAL Modules Enumerator v0.1beta-- written by Ali Elouafiq 2012" 11 | "\n [filename.txt]" 12 | "\n [URL]" 13 | "\n [URL] user password // FOR HTTP AUTHORIZATION" 14 | 15 | } 16 | __DEBUG_MODE__="off" 17 | def call(command): 18 | p=subprocess.Popen([command], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 19 | if ( len(p.stdout.readlines()) + len( p.stderr.readlines()) ) > 0 : 20 | raise CommandFailure(command) 21 | def main(): 22 | #check options 23 | Modules_List=[] 24 | command="" 25 | if len(sys.argv)==1: 26 | print __CMD__["help"] 27 | else: 28 | if len(sys.argv) == 2 : 29 | url=sys.argv[1] 30 | if len(url.split(".txt")) > 1: 31 | command=""+__CMD__["output_file"]+url 32 | else: command=""+__CMD__["wget"]+url 33 | if len(sys.argv) == 4 : 34 | url=sys.argv[1] 35 | user=sys.argv[2] 36 | password=sys.argv[3] 37 | command=""+__CMD__["wget"]+url+" --http-user "+user+" --http-password "+password 38 | 39 | #Retrieves the Page 40 | command=command+__CMD__["grep"] 41 | #---Command: 42 | p=subprocess.Popen([command], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 43 | if __DEBUG_MODE__=="wget": print p.stdout 44 | #SCAN the page 45 | for line in p.stdout: 46 | line=line.split("modules") 47 | if len(line)>1 : 48 | Modules_List.append(line[1].split("/")[1]) 49 | #Retrieve Results 50 | Modules_List=list(set(Modules_List)) 51 | for module in Modules_List: 52 | print module 53 | 54 | if __name__=="__main__": 55 | main() 56 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is a sample readme file. --------------------------------------------------------------------------------