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.



1247
1248
1249
# File 'lib/nexpose.rb', line 1247

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

Instance Attribute Details

#hostObject (readonly)

The host for these credentials. Can be Any.



1236
1237
1238
# File 'lib/nexpose.rb', line 1236

def host
  @host
end

#isblobObject (readonly)

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



1232
1233
1234
# File 'lib/nexpose.rb', line 1232

def isblob
  @isblob
end

#passwordObject (readonly)

The password



1242
1243
1244
# File 'lib/nexpose.rb', line 1242

def password
  @password
end

#portObject (readonly)

The port on which to use these credentials.



1238
1239
1240
# File 'lib/nexpose.rb', line 1238

def port
  @port
end

#realmObject (readonly)

The realm for these credentials



1244
1245
1246
# File 'lib/nexpose.rb', line 1244

def realm
  @realm
end

#securityblobObject (readonly)

Security blob for an existing set of credentials



1230
1231
1232
# File 'lib/nexpose.rb', line 1230

def securityblob
  @securityblob
end

#serviceObject (readonly)

The service for these credentials. Can be All.



1234
1235
1236
# File 'lib/nexpose.rb', line 1234

def service
  @service
end

#useridObject (readonly)

The user id or username



1240
1241
1242
# File 'lib/nexpose.rb', line 1240

def userid
  @userid
end

Instance Method Details

#setBlob(securityblob) ⇒ Object

TODO: add description



1273
1274
1275
1276
# File 'lib/nexpose.rb', line 1273

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

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

Sets the credentials information for this object.



1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
# File 'lib/nexpose.rb', line 1252

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



1268
1269
1270
# File 'lib/nexpose.rb', line 1268

def setHost(host)
	@host = host
end

#setService(service) ⇒ Object

TODO: add description



1264
1265
1266
# File 'lib/nexpose.rb', line 1264

def setService(service)
	@service = service
end

#to_xmlObject



1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
# File 'lib/nexpose.rb', line 1279

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