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.



1469
1470
1471
# File 'lib/nexpose.rb', line 1469

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

Instance Attribute Details

#hostObject (readonly)

The host for these credentials. Can be Any.



1458
1459
1460
# File 'lib/nexpose.rb', line 1458

def host
  @host
end

#isblobObject (readonly)

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



1454
1455
1456
# File 'lib/nexpose.rb', line 1454

def isblob
  @isblob
end

#passwordObject (readonly)

The password



1464
1465
1466
# File 'lib/nexpose.rb', line 1464

def password
  @password
end

#portObject (readonly)

The port on which to use these credentials.



1460
1461
1462
# File 'lib/nexpose.rb', line 1460

def port
  @port
end

#realmObject (readonly)

The realm for these credentials



1466
1467
1468
# File 'lib/nexpose.rb', line 1466

def realm
  @realm
end

#securityblobObject (readonly)

Security blob for an existing set of credentials



1452
1453
1454
# File 'lib/nexpose.rb', line 1452

def securityblob
  @securityblob
end

#serviceObject (readonly)

The service for these credentials. Can be All.



1456
1457
1458
# File 'lib/nexpose.rb', line 1456

def service
  @service
end

#useridObject (readonly)

The user id or username



1462
1463
1464
# File 'lib/nexpose.rb', line 1462

def userid
  @userid
end

Instance Method Details

#setBlob(securityblob) ⇒ Object

TODO: add description



1495
1496
1497
1498
# File 'lib/nexpose.rb', line 1495

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

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

Sets the credentials information for this object.



1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
# File 'lib/nexpose.rb', line 1474

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



1490
1491
1492
# File 'lib/nexpose.rb', line 1490

def setHost(host)
	@host = host
end

#setService(service) ⇒ Object

TODO: add description



1486
1487
1488
# File 'lib/nexpose.rb', line 1486

def setService(service)
	@service = service
end

#to_xmlObject



1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
# File 'lib/nexpose.rb', line 1501

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