Class: Nexpose::AdminCredentials

Inherits:
Object
  • Object
show all
Includes:
Sanitize
Defined in:
lib/nexpose.rb

Overview

Description

Object that represents administrative credentials to be used during a scan. When retrived from an existing site configuration the credentials will be returned as a security blob and can only be passed back as is during a Site Save operation. This object can only be used to create a new set of credentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sanitize

#replace_entities

Constructor Details

#initialize(isblob = false) ⇒ AdminCredentials

Returns a new instance of AdminCredentials.



1598
1599
1600
# File 'lib/nexpose.rb', line 1598

def initialize(isblob = false)
	@isblob = isblob
end

Instance Attribute Details

#hostObject (readonly)

The host for these credentials. Can be Any.



1587
1588
1589
# File 'lib/nexpose.rb', line 1587

def host
  @host
end

#isblobObject (readonly)

Designates if this object contains user defined credentials or a security blob



1583
1584
1585
# File 'lib/nexpose.rb', line 1583

def isblob
  @isblob
end

#passwordObject (readonly)

The password



1593
1594
1595
# File 'lib/nexpose.rb', line 1593

def password
  @password
end

#portObject (readonly)

The port on which to use these credentials.



1589
1590
1591
# File 'lib/nexpose.rb', line 1589

def port
  @port
end

#realmObject (readonly)

The realm for these credentials



1595
1596
1597
# File 'lib/nexpose.rb', line 1595

def realm
  @realm
end

#securityblobObject (readonly)

Security blob for an existing set of credentials



1581
1582
1583
# File 'lib/nexpose.rb', line 1581

def securityblob
  @securityblob
end

#serviceObject (readonly)

The service for these credentials. Can be All.



1585
1586
1587
# File 'lib/nexpose.rb', line 1585

def service
  @service
end

#useridObject (readonly)

The user id or username



1591
1592
1593
# File 'lib/nexpose.rb', line 1591

def userid
  @userid
end

Instance Method Details

#setBlob(securityblob) ⇒ Object

TODO: add description



1624
1625
1626
1627
# File 'lib/nexpose.rb', line 1624

def setBlob(securityblob)
	@isblob = true
	@securityblob = securityblob
end

#setCredentials(service, host, port, userid, password, realm) ⇒ Object

Sets the credentials information for this object.



1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
# File 'lib/nexpose.rb', line 1603

def setCredentials(service, host, port, userid, password, realm)
	@isblob = false
	@securityblob = nil
	@service = service
	@host = host
	@port = port
	@userid = userid
	@password = password
	@realm = realm
end

#setHost(host) ⇒ Object



1619
1620
1621
# File 'lib/nexpose.rb', line 1619

def setHost(host)
	@host = host
end

#setService(service) ⇒ Object

TODO: add description



1615
1616
1617
# File 'lib/nexpose.rb', line 1615

def setService(service)
	@service = service
end

#to_xmlObject



1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
# File 'lib/nexpose.rb', line 1630

def to_xml
	xml = ''
	xml << '<adminCredentials'
	xml << %Q{ service="#{replace_entities(service)}"} if (service)
	xml << %Q{ userid="#{replace_entities(userid)}"} if (userid)
	xml << %Q{ password="#{replace_entities(password)}"} if (password)
	xml << %Q{ realm="#{replace_entities(realm)}"} if (realm)
	xml << %Q{ host="#{replace_entities(host)}"} if (host)
	xml << %Q{ port="#{replace_entities(port)}"} if (port)
	xml << '>'
	xml << replace_entities(securityblob) if (isblob)
	xml << '</adminCredentials>'

	xml
end