Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Eric_Speake
Contributor

Listing the members of a network group

Jump to solution

We are doing audits and cleanup of the network objects in our policy rules. I need to provide a list of servers in a specific network group. I have tried "$MDS_FWDIR/scripts/web_api_show_package.sh -k <policy_name>" but that seems to work only with the VS packages. I am running R80.10 on the management server.

Thanks,

Eric

Senior Systems Administrator

1 Solution

Accepted Solutions
Maik
Advisor

I've written a small python script that exports all groups and the related hosts within it (host, network, address range and security gateway objects) as a csv file. It also shows empty groups, that were possible forgotten about. The script works only for IPv4 objects!

# example csv header:
# groupname,groupuid,membername,membertype,memberip,membersubnetmask,memberuid

You can use the script and filter for the required group in the related group name column. The script usage is shown by specifying the -h parameter. Just make sure that you copy the whole folder within the zip as the subfolder "mgmt_api_lib" is also required (the script has only been tested with Python 2.7 - which is preinstalled within R80).

View solution in original post

10 Replies
Maik
Advisor

I've written a small python script that exports all groups and the related hosts within it (host, network, address range and security gateway objects) as a csv file. It also shows empty groups, that were possible forgotten about. The script works only for IPv4 objects!

# example csv header:
# groupname,groupuid,membername,membertype,memberip,membersubnetmask,memberuid

You can use the script and filter for the required group in the related group name column. The script usage is shown by specifying the -h parameter. Just make sure that you copy the whole folder within the zip as the subfolder "mgmt_api_lib" is also required (the script has only been tested with Python 2.7 - which is preinstalled within R80).

View solution in original post

PhoneBoy
Admin
Admin

I'm going to move this to Developers (Code Hub)

0 Kudos
Reply
Robert_Decker
Employee Alumnus
Employee Alumnus

Very good work, Maik.

0 Kudos
Reply
theodosis
Explorer

I get the below error

 

membername = jsonGroups[0][group]['members'][member]['name'].replace(',', ';')
TypeError: string indices must be integers

any ideas?

0 Kudos
Reply
mperveiz
Explorer

I am getting he same error. Did you get the solution for this issue ?

0 Kudos
Reply
mperveiz
Explorer

Did you find the solution to this error. 

0 Kudos
Reply
emma_on
Explorer

This bash script may not be the most efficient, but it works for us on R80.20. 

To be run on the management server.

mperveiz
Explorer

Where will the output file go ?

0 Kudos
Reply
emma_on
Explorer

That's up to you.  It's standard bash.

 

This will write the output to std_out (usually the terminal):

# ./list-group-info.bsh

 

This will write the output to both std_out and the file you specify:

# ./list-group-info.bsh | tee /var/tmp/group-list.out

 

This will write the output to the file you specify:

# ./list-group-info.bsh > /var/tmp/group-list.out

0 Kudos
Reply
Rabindra_Khadka
Contributor

hello friend,

 

can you briefly describe this, can we export the objects of the network group of the checkpoint management server to the csv file

0 Kudos
Reply