cancel
Showing results for 
Search instead for 
Did you mean: 

Tag via Python

Hi, Wondering if some can suggest solution here. I am tagging systems via python on IP Address basis.

I have text file where I have all the IP address which we want to tag. It seems  working fine with small issue.

For example if I have IP address 10.XXX.XXX.19 in my test file, it tagging all IP address which are smillar to it. Like in my case it's tagging 10.XXX.XXX.19 and 10.XXX.XXX.191.

How can I make sure it tag only that IP which is in my text file.

Here is the code I am using for it.

mc = mcafee.client(ePOIP,'Port#',ePOUser,ePOUserPwd,'https','json')

file = open('Path to the text file.txt', 'r')

for IPV6 in file:

IPV6 = IPV6.rstrip('\r\n')

print 'IPV6: '+IPV6

systems = mc.system.find(IPV6);

for system in systems:

  if system['EPOComputerProperties.IPV6']== IPV6:

   mc.system.applyTag(system['EPOComputerProperties.IPV6'],ePOTag);