Export Report For assets csv

Hello,

I’m looking for an easy and straight forward way to export an asset report(csv preferrably) listing all discovered assets, with columns HostName(if found),IP, Operating System and nothing else. Is that possible? Please help.

You just have to export the assets page. There is a button in the bottom right hand corner below the list. If you have multiple pages you can use a filter to increase rows=100, etc. Alternatively you can use python-gvm to do this via python script.

This will create an XML file such as the one below. It has all the information you want. You can easily convert this to a CSV file with the fields you want. There may be another way, such as using a complex filter, but I’m not aware of that.

<?xml version="1.0"?>
<get_assets_response status="200" status_text="OK">
  <asset id="d487efbb-336a-468f-a2bd-49ca4b5a6477">
    <owner>
      <name>admin</name>
    </owner>
    <name>172.18.0.1</name>
    <comment/>
    <creation_time>2024-02-01T14:23:47Z</creation_time>
    <modification_time>2024-02-01T14:23:47Z</modification_time>
    <writable>1</writable>
    <in_use>0</in_use>
    <permissions>
      <permission>
        <name>Everything</name>
      </permission>
    </permissions>
    <identifiers>
      <identifier id="cf6334a6-e6fe-42ed-9d1d-c81fa2cbbd05">
        <name>OS</name>
        <value>cpe:/o:linux:kernel</value>
        <creation_time>2024-02-01T14:23:47Z</creation_time>
        <modification_time>2024-02-01T14:23:47Z</modification_time>
        <source id="2dd6c682-2954-4de0-8cd5-493b4d56434d">
          <type>Report Host Detail</type>
          <data>1.3.6.1.4.1.25623.1.0.102002</data>
          <deleted>0</deleted>
          <name/>
        </source>
        <os id="e0888c0e-4ad9-43ed-8a84-77e1b6dc661e">
          <title>(null)</title>
        </os>
      </identifier>
      <identifier id="a11e7abb-ad2a-4b85-9e0b-5650a8fc1e97">
        <name>MAC</name>
        <value>02:42:66:5A:4E:BA</value>
        <creation_time>2024-02-01T14:23:47Z</creation_time>
        <modification_time>2024-02-01T14:23:47Z</modification_time>
        <source id="2dd6c682-2954-4de0-8cd5-493b4d56434d">
          <type>Report Host Detail</type>
          <data>1.3.6.1.4.1.25623.1.0.103585</data>
          <deleted>0</deleted>
          <name/>
        </source>
      </identifier>
      <identifier id="a8f10d41-0de9-4ce2-8138-e555aa4cb178">
        <name>ip</name>
        <value>172.18.0.1</value>
        <creation_time>2024-02-01T14:23:47Z</creation_time>
        <modification_time>2024-02-01T14:23:47Z</modification_time>
        <source id="2dd6c682-2954-4de0-8cd5-493b4d56434d">
          <type>Report Host</type>
          <data/>
          <deleted>0</deleted>
          <name/>
        </source>
      </identifier>
    </identifiers>
    <type>host</type>
    <host>
      <severity>
        <value>2.1</value>
      </severity>
      <detail>
        <name>best_os_cpe</name>
        <value>cpe:/o:linux:kernel</value>
        <source id="2dd6c682-2954-4de0-8cd5-493b4d56434d">
          <type>Report</type>
        </source>
      </detail>
      <detail>
        <name>best_os_txt</name>
        <value>Linux Kernel</value>
        <source id="2dd6c682-2954-4de0-8cd5-493b4d56434d">
          <type>Report</type>
        </source>
      </detail>
      <detail>
        <name>traceroute</name>
        <value>172.18.0.5,172.18.0.1</value>
        <source id="2dd6c682-2954-4de0-8cd5-493b4d56434d">
          <type>Report</type>
        </source>
      </detail>
    </host>
  </asset>
  <filters id="">
    <term>sort-reverse=severity first=1 rows=10</term>
    <keywords>
      <keyword>
        <column>sort-reverse</column>
        <relation>=</relation>
        <value>severity</value>
      </keyword>
      <keyword>
        <column>first</column>
        <relation>=</relation>
        <value>1</value>
      </keyword>
      <keyword>
        <column>rows</column>
        <relation>=</relation>
        <value>10</value>
      </keyword>
    </keywords>
  </filters>
  <sort>
    <field>severity<order>descending</order></field>
  </sort>
  <assets start="1" max="10"/>
  <asset_count>1<filtered>1</filtered><page>1</page></asset_count>
</get_assets_response>

Thank you for your response @rippledj . That Im looking to it to extract the fields of the xml files, are you aware of the standard fields each asset uses to store these values? Because I found some inconsistencies.

I think the download button on the assets page uses the get_assets GMP command. You can find the GMP documentation here. And you should search for the Section 7.50 Command get_assets, which details the XML response.

When using python-gvm, I think the function that matches get_assets is get_hosts(), since there is no get_assets() function for python-gvm listed.