IPv6 Mapping Records CSV

How to add and remove IPv6 mapping records in CSV format.

Add IPv6 Records in CSVAdd IPv6 Records in CSV

1) View Mapping Records in CSV

API Request

$ curl -u username:password -H "X-Requested-With: curl""https://<qualys_base_url>/api/2.0/fo/asset/ip/v4_v6/?action=list&output_format=csv"

Qualys automatically returns an ID value in the ID column for each IPv6 mapping record. This ID is assigned by Qualys when the record is created.

XML Output

----BEGIN_RESPONSE_BODY_CSV
ID,IPv4,IPv6
"46947","0.0.0.7","2001:db8:85a3::8a2e:370:84"
"47036","0.0.0.1","2001:db8:85a3::8a2e:370:77"
----END_RESPONSE_BODY_CSV
----BEGIN_RESPONSE_FOOTER_CSV
"Status Message"
"Finished"
----END_RESPONSE_FOOTER_CSV

2) Prepare file1.csv with records to be added

The CSV file contents identify one or more IPv6 mapping records to be added. The columns in the CSV upload file are described below.

IPv4 (Required) An IPv4 address. The IPv4 address can be defined in only one IPv6 mapping record within your subscription.

IPv6 (Required) An IPv6 address. The IPv6 address can be defined in only one IPv6 mapping record within your subscription.

ID (Optional) A user-defined, custom ID may be included. Important: Custom ID values will not be saved with record data within your subscription.

The CSV file must include the input parameters action=add and csv_data=. The parameter all_or_nothing is optional. When set to 1 or unspecified, the service cancels the request and does not add any new records if it finds the upload data has one record with an IP conflict. When set to 0 the service does not cancel the request if an IP conflict is found.

Sample file1.csv to add IPv6 mapping records

$ cat file1.csv
action=add&all_or_nothing=1&csv_data=
"0.0.0.2","2001:470:8418:a18::a0a:1805"%0A
"0.0.0.3","2001:470:8418:a18::a0a:ab7"%0A
"0.0.0.4","2001:470:8418:a18::a0a:1849"%0A
"0.0.0.5","2001:470:8418:a18::a0a:189c"%0A
"0.0.0.6","2001:470:8418:a18::a0a:189d"%0A
"0.0.0.8","2001:470:8418:a18::a0a:189e"%0A
"0.0.0.9","2001:470:8418:a18::a0a:18d0"%0A
"0.0.0.10","2001:470:8418:a18::a0a:18d1"%0A
"0.0.0.11","2001:470:8418:a18::a0a:18d2"%0A
"0.0.0.12","2001:470:8418:a18::a0a:18d6"%0A
"0.0.0.13","2001:470:8418:a18::a0a:18d7"%0A
"0.0.0.14","2001:470:8418:a18::a0a:18da"%0A
"0.0.0.15","2001:470:8418:a18::a0a:18db"%0A
"0.0.0.16","ff00:abcd::1234"%0A

3) POST data from file1.csv (Success)

API Request

$ curl -u username:password -H "X-Requested-With: curl" -d @file1.csv"https://<qualys_base_url>/api/2.0/fo/asset/ip/v4_v6/"

XML Output

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://<qualys_base_url>/api/2.0/simple_return.dtd">
<SIMPLE_RETURN>
  <RESPONSE>
    <DATETIME>2017-11-03T19:31:27Z</DATETIME>
    <TEXT>Successfully imported 14 records
</TEXT>
  </RESPONSE>
</SIMPLE_RETURN>

Remove IPv6 Records in CSVRemove IPv6 Records in CSV

1) View mapping records in CSV

API Request

$ curl -u username:password -H "X-Requested-With: curl""https://<qualys_base_url>/api/2.0/fo/asset/ip/v4_v6/?action=list&output_format=csv"

2) Prepare file3.csv with records to be removed

The CSV file contents identify one or more IPv6 mapping records to be removed.

Sample file3.csv used to remove IPv6 mapping records

$ cat file3.csvaction=remove&csv_data="0.0.0.4","2001:470:8418:a18::a0a:1849""0.0.0.5","2001:470:8418:a18::a0a:189c"

3) POST data from file3.csv (Success)

API Request

$ curl -u username:password -H "X-Requested-With: curl"-d @file3.csv"https://<qualys_base_url>/api/2.0/fo/asset/ip/v4_v6/"

XML Output

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://<qualys_base_url>/api/2.0/simple_return.dtd">
<SIMPLE_RETURN>
  <RESPONSE>
    <DATETIME>2017-11-03T19:31:27Z</DATETIME>
    <TEXT>Removed 2 records (any associated scanned host data is now queued for purging)</TEXT>
  </RESPONSE>
</SIMPLE_RETURN>