Skip to main content
HPerdomo
Staff
Staff
January 5, 2024

Technical Tip: Exporting Endpoints from EMS and filtering columns with Python and Google Colab

  • January 5, 2024
  • 0 replies
  • 1016 views
Description This article describes that in EMS v7.2.2+ it is now possible to export endpoints into a CSV. However, the information that is often asked for can be difficult to find but doable with a simple Python code in Google Colab. 
Scope Forticlient EMS v7.2.2+.
Solution

Most of the time in ETAC, when encountering questions about this feature, questions were about how to collect FortiClient versions and when clients were last seen. Even when using filters in EMS, some organizations have over 1k+ endpoints and this can be difficult to read and use in EMS itself.

This may also be an easier way to simplify data than using Excel. Also, using Google Colab is a much simpler way to alter the data compared to installing jupyter notebooks. 

 

Related document:

Export endpoint information

 

Step 1: Export the CSV as in the documentation.

  • The example information will be used with 'Boromir' and 'Legolas'.
  • Copy/paste the information provided and save it as a CSV. 
  • Open it in Excel, and the information is spread out and can be difficult to find:

 

excel.PNG

 

Step 2: Google Colab and uploading the file.

 

newnotebook.PNG

 

  • Select the 'folder' icon, 'right-click' the white space, and select 'Upload':

 

middleearth.png

 

  • It is possible to navigate to the CSV and then select 'Open'.

 

Step 4: Python.

  • Import 2 libraries, OS and Pandas for this to work.
  • OS will help to confirm that it can read the file, and Pandas will convert and display the data.
  • Convert the CSV into a data frame, set the index to name (for organizational purposes).
  • Select the desired columns (fct_version, last_seen - but can use any).
  • Press the '>' (play button) icon on the left to run the code.
  • To get a new cell, press '+ code':

 

code.PNG

 

Step 5: Exporting and redisplaying in Excel.

  • There are two blue icons above, select the top one 'Convert this data frame to an interactive table'.
  • Select 'Copy Table':

 

copy.png

 

  • Copy the table as CSV, paste and then save it to notepad as simplify.csv:

 

csv export.PNG

 

  • Open in Excel and a much more easily manageable data set will be visible:

 

final.PNG

 

Note:

This solution is not supported by the TAC team. No further support or explanations will be provided by TAC. 

    Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
    Fortinet Flag the Hack. Wednesday, August 26, 9:00 AM - 5:00 PM ET, COSM, Atlanta, GA.