Skip to main content
Solved

device export script


HansHenrikMoerkholt
Forum|alt.badge.img+1

Hi

Today I have a Python script for exporting devices in to a csv-file with the following fields:

device_name,device_ips,device_groups,log_collection_policies,distributed_collector,confidentiality,integrity,availability,timezone

Does a script exist that also extract the additional fiels:

uses_proxyproxy_iphostname

This will make moving devices from LogPoint 5 to LogPoint 6 considerably more easy.

 Regards

Hans

Best answer by markus.nebel@8com.de

Hello @HansHenrikMoerkholt ,

 

okay, this version is old :)

Try to add this line in the import section at the top of the file:

from mongokit import ObjectId

 

View original
Did this topic help you find an answer to your question?

9 replies

Joon Hansen
LogPoint Team
  • LogPoint Team
  • 3 replies
  • July 21, 2021

Hi Hans,

Could you post the script that you are using (remove thecredentials), maybe we can help you extend the script to export the additional fields?

Joon


HansHenrikMoerkholt
Forum|alt.badge.img+1

Hi Joon

It is a scrip created by LogPoint, and requires cli access to the LogPoint server.

It is executed using:

/opt/immune/bin/envdo python "file_name"

Regards

Hans

 


markus.nebel@8com.de
Forum|alt.badge.img+8

Hello @HansHenrikMoerkholt,

I upgraded your script to be python3 compatible and added the proxy config to the CSV:

 


HansHenrikMoerkholt
Forum|alt.badge.img+1

Hi @markus.nebel@8com.de 

Thanks for the input.

apparently something goes wrong.

Errors generated when running script attached with some info anonymized.

Regards

Hans


markus.nebel@8com.de
Forum|alt.badge.img+8

Hello @HansHenrikMoerkholt, which logpoint version are you using?

I’ve tested it on 6.11.2.


HansHenrikMoerkholt
Forum|alt.badge.img+1

Hi @markus.nebel@8com.de 

This is used on LogPoint 5.6.4, where we are using it for extracting infomation to prepare for migrating to most current LogPoint version.

Regards

Hans


markus.nebel@8com.de
Forum|alt.badge.img+8

Hello @HansHenrikMoerkholt ,

 

okay, this version is old :)

Try to add this line in the import section at the top of the file:

from mongokit import ObjectId

 


HansHenrikMoerkholt
Forum|alt.badge.img+1

Hi @markus.nebel@8com.de 

This actually did the trick - Thank you very much for the help!!!

Export file generated with desired info.

Regards

Hans


Reinhard Vielhaber

Hi,

this is older but I have a question regarding the following three lines/statements from the script:

device_groups = str(';'.join([db.dereference(device_group)["name"]
        for device_group in device["device_groups"]])) log_collection_policies = str(';'.join([db.dereference(lcp)["name"]         for lcp in device["log_policies"]]))
distributed_collector =

        str(';'.join([db.dereference(DBRef('distributedcollector',         ObjectId(dc), MONGODB_DATABASE))["name"]

        for dc in device["distributed_collector"]]))

The first to “lines” just use “db.dereference()” for getting the related data, the third “line” uses a more complex way. Is this necessary or would it be sufficient to also just use “db.dereference()” (I have no dsitributed collector in my test environment, otherwise I would have tested it myself ;-) ).

Best regards, Reinhard

(unfortunately I couldn’t manage it to display just one indented code block here)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings