Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This functionality was first introduced in the Hillary release series. The specific methods described on this page work with Hillary R2 and later releases.

...

FieldDescriptionCan be empty?Example or Possible Values
LocationPathName of the location. Sub-locations seperated by the pipe symbol "|"NOSample|Node
Sample|Node2|Leaf1
Sample|Node2|Leaf2
TargetWhat category of target is this (Either Application or Device)NODevice
Application
TypeWhat sub-type of target is this (What type of Device, or Which Application)NOSee the list of valid target types
NameThe name of the location (This is a freeform text field)NOMain Lab
QA Lab
My Test Location
Instance NameThe name of the database instanceYESFor scanning database application targets
HostnameThe host name for hostname targetsYESvm-test.localdomain
www.myserver.example.com
vm-myserver
StartIPThe Start IP Address - use this for Application targets, Single, Range and Subnet targetsYES10.0.0.1
EndIPThe End IP Address - use this for Range targets onlyYES10.0.0.99
SubnetMaskThe netmask - as a number not as a dotted quad - use for Subnet targets onlyYESUse "24" not "255.255.255.0"
"0" can be used for an empty target
PortThe port on which to scan, for Application Targets onlyYESE.g. scan a web server on port 80 usually, but might also be port 8080an SQL Server is usually on port 1433 but can be set to an arbitrary number.
ExclusionWhether this is a target exclusion. Use to exclude IP addresses from a larger listYESMust be Valid values are "True" or "False". Empty implies False

...

The list of valid Application Target types is:

  • "vCenterfill in the rest of these" (a VMware vCenter application)
  • "Informix" (an Informix database application target)
  • "Oracle Database Server"
  • "SQL Server" (A Microsoft SQL Server application target)

An application target is used when we need to scan an application on a non-standard port, or when we need to scan an application if we cannot scan the underlying OS on the target.

Sample JSON data file

info
Code Block
languagejs
titleJSON Datafile
collapsetrue
{
    "Name":"LOCATION TARGET",
    "Version":"1.3",
	"Locations":
	[
		{
			"LocationPath":"Demo|TestScan",
			"Target":"Device",
			"Type":"Hostname",
			"Name":"Hostname Target 1",
			"InstanceName":"",	
			"Hostname":"vm-myserver",
			"StartIP":"",
			"EndIP":"",
			"SubnetMask":"0",
			"Port":"",
			"Exclusion":""
		},
		{
			"LocationPath":"Demo|TestScan",
			"Target":"Device",
			"Type":"Single",
			"Name":"Single IP Address",
			"InstanceName":"",	
			"Hostname":"",
			"StartIP":"10.0.0.1",
			"EndIP":"",
			"SubnetMask":"0",
			"Port":"",
			"Exclusion":""
		},
		{
			"LocationPath":"Demo|TestScan",
			"Target":"Device",
			"Type":"Range",
			"Name":"Multiple IP Addresses",
			"InstanceName":"",	
			"Hostname":"",
			"StartIP":"10.0.0.2",
			"EndIP":"10.0.0.99",
			"SubnetMask":"0",
			"Port":"",
			"Exclusion":""
		},
		{
			"LocationPath":"Demo|SecondNetwork",
			"Target":"Device",
			"Type":"Subnet",
			"Name":"Different network",
			"InstanceName":"",	
			"Hostname":"",
			"StartIP":"192.168.1.0",
			"EndIP":"",
			"SubnetMask":"24",
			"Port":"",
			"Exclusion":""
		}
	]
}

How to invoke the command

For any non-trivial estate size, you will want to store the JSON as a file rather than trying to put the data on the command line. Save the JSON data file, either editing it manually or generating it from a data source. For these examples, we store the data in a file in the current directory called file.json

Call the RestAPI using cURL

Code Block
languagebash
themeMidnight
titleCall using cURL
curl --data "@file.json" \
    -H 'Authorization: Basic YWRtaW46cGFzc3dvcmQ=' \
	-H "Content-Type: application/json" \
    -X 'POST' 'http://youriqsonarserver/api/v1/targets'

Call the RestAPI using Powershell

Code Block
languagepowershell
themeMidnight
titleCreate Targets using PowerShell Invoke-RestMethod
$cred = Get-Credential
$body = Get-Content file.json
$url = 'http://youriqsonarserver/api/v1/targets'
Invoke-RestMethod -Method POST -ContentType 'application/json' -Credential $cred -Body $body -Uri $url




Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@1fb5c7
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ( "iqsonar_v4" , "restapi" , "configuration" ) and type = "page" and space = "CSKB"
labelsRestAPI configuration iqsonar_v4

...