<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ISE: how to extract MAC lists which are used for MAB in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4481881#M570245</link>
    <description>&lt;P&gt;Sharing a way to generate a csv file containing specific ISE endpoint group macs based on user input with python.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;#!/usr/bin/python&lt;BR /&gt;import json&lt;BR /&gt;import requests&lt;BR /&gt;import warnings&lt;BR /&gt;import sys&lt;BR /&gt;import csv&lt;BR /&gt;&lt;BR /&gt;#ignore invalid cert warnings&lt;BR /&gt;warnings.filterwarnings("ignore")&lt;BR /&gt;&lt;BR /&gt;groupID = ("")&lt;BR /&gt;temp1 = ("")&lt;BR /&gt;temp2 = ("")&lt;BR /&gt;&lt;BR /&gt;USR_CHOICE = raw_input ("Do you want to see MACs in Imaging (1) or Blacklist group(2)?")&lt;BR /&gt;    while USR_CHOICE not in ('1','2'):&lt;BR /&gt;    print "************************************"&lt;BR /&gt;    print "Error! You must enter 1 (ADD) or 2 (REMOVE)"&lt;BR /&gt;    print "************************************"&lt;BR /&gt;    sys.exit()&lt;BR /&gt;if USR_CHOICE == '1':&lt;BR /&gt;    groupID = '&amp;lt;xxx:xxx&amp;gt;'&lt;BR /&gt;else:&lt;BR /&gt;    groupID = '&amp;lt;xxx.xxx&amp;gt;'&lt;BR /&gt;&lt;BR /&gt;API_DEVICE = "https://&amp;lt;ise_pan&amp;gt;:9060/ers/config/endpoint?filter=groupId.EQ." + groupID + "&amp;amp;size=100"&lt;BR /&gt;API_ERS_USER = "&amp;lt;user&amp;gt;","&amp;lt;pass&amp;gt;"&lt;BR /&gt;HEADERS = {&lt;BR /&gt;    'Accept': "application/json",&lt;BR /&gt;    'Content-Type': "application/json",&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;r = requests.get(url=API_DEVICE, auth=API_ERS_USER, headers=HEADERS, verify=True)&lt;BR /&gt;&lt;BR /&gt;#print r.text&lt;BR /&gt;data = r.text&lt;BR /&gt;&lt;BR /&gt;endPoints = json.loads(data)&lt;BR /&gt;print "Total Number of Endpoints in Group:",endPoints['SearchResult']['total']&lt;BR /&gt;print "---------------------------------------"&lt;BR /&gt;&lt;BR /&gt;f = open ('Grp_Macs.csv','w')&lt;BR /&gt;w = csv.DictWriter(f, fieldnames = ['MAC Address','Description'])&lt;BR /&gt;w.writeheader()&lt;BR /&gt;f.close()&lt;BR /&gt;&lt;BR /&gt;for MAC in endPoints ["SearchResult"]["resources"]:&lt;BR /&gt;    temp1 = MAC['name']&lt;BR /&gt;    with open ('Grp_Macs.csv','a') as csvfile:&lt;BR /&gt;        w = csv.writer(csvfile)&lt;BR /&gt;        try:&lt;BR /&gt;            temp2 = MAC['description']&lt;BR /&gt;            w.writerow([temp1, temp2])&lt;BR /&gt;            print "MAC Address:", temp1, "||", "Description:", temp2&lt;BR /&gt;        except KeyError:&lt;BR /&gt;            w.writerow([temp1, temp2])&lt;BR /&gt;            print "MAC Address:", temp1, "||", "Description:"""&lt;BR /&gt;            continue&lt;BR /&gt;with open ('Grp_Macs.csv','a') as csvfile:&lt;BR /&gt;    w = csv.writer(csvfile)&lt;BR /&gt;    TOTAL = endPoints['SearchResult']['total']&lt;BR /&gt;    w.writerow(['Total Endpoints:', TOTAL])&lt;BR /&gt;&lt;BR /&gt;sys.exit()&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Use curl to get id group strings for the specific groups.&amp;nbsp; Update ers user/pass creds.&amp;nbsp; Sample output of csv is as follows:&lt;/P&gt;
&lt;P&gt;MAC Address,Description&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description1&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description2&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description3&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description4&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description5&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description6&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description7&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description8&lt;BR /&gt;Total Endpoints:,8&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Curl example to get group id string:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;curl -k --include --header 'Content-Type:application/json' --header 'Accept: application/json' --user &amp;lt;user&amp;gt;:&amp;lt;pass&amp;gt; --request GET https://&amp;lt;ise_pan&amp;gt;:9060/ers/config/endpointgroup?filter=name.EQ.&amp;lt;your_group_name&amp;gt; &lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Oct 2021 13:46:49 GMT</pubDate>
    <dc:creator>Mike.Cifelli</dc:creator>
    <dc:date>2021-10-07T13:46:49Z</dc:date>
    <item>
      <title>ISE: how to extract MAC lists which are used for MAB</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4481574#M570235</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the list of MAC addresses which&amp;nbsp; I manually registered by using csv.file and manually entering.&lt;/P&gt;&lt;P&gt;I mean the MAC lists I want is MAC lists used for MAB.&lt;/P&gt;&lt;P&gt;On the panel Context visibility &amp;gt; Endpoints, if I just click Export and download csv file, the content of file&amp;nbsp;would include not only MAC used for MAB but also, unfortunately , MAC of users who logged in via dot1x.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 05:45:58 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4481574#M570235</guid>
      <dc:creator>naoki_Japan</dc:creator>
      <dc:date>2021-10-07T05:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: ISE: how to extract MAC lists which are used for MAB</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4481695#M570239</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1246830"&gt;@naoki_Japan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you export all the MAC addresses, you can open the CSV file in excel (or another program) and filter on StaticAssignment column, there are two options TRUE or FALSE. If FALSE then these are your dynamically added endpoint MAC address for 802.1x users, the remaining MAC addresses would be set to TRUE and are the MAC address you statically added.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 09:07:46 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4481695#M570239</guid>
      <dc:creator>Rob Ingram</dc:creator>
      <dc:date>2021-10-07T09:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: ISE: how to extract MAC lists which are used for MAB</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4481881#M570245</link>
      <description>&lt;P&gt;Sharing a way to generate a csv file containing specific ISE endpoint group macs based on user input with python.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;#!/usr/bin/python&lt;BR /&gt;import json&lt;BR /&gt;import requests&lt;BR /&gt;import warnings&lt;BR /&gt;import sys&lt;BR /&gt;import csv&lt;BR /&gt;&lt;BR /&gt;#ignore invalid cert warnings&lt;BR /&gt;warnings.filterwarnings("ignore")&lt;BR /&gt;&lt;BR /&gt;groupID = ("")&lt;BR /&gt;temp1 = ("")&lt;BR /&gt;temp2 = ("")&lt;BR /&gt;&lt;BR /&gt;USR_CHOICE = raw_input ("Do you want to see MACs in Imaging (1) or Blacklist group(2)?")&lt;BR /&gt;    while USR_CHOICE not in ('1','2'):&lt;BR /&gt;    print "************************************"&lt;BR /&gt;    print "Error! You must enter 1 (ADD) or 2 (REMOVE)"&lt;BR /&gt;    print "************************************"&lt;BR /&gt;    sys.exit()&lt;BR /&gt;if USR_CHOICE == '1':&lt;BR /&gt;    groupID = '&amp;lt;xxx:xxx&amp;gt;'&lt;BR /&gt;else:&lt;BR /&gt;    groupID = '&amp;lt;xxx.xxx&amp;gt;'&lt;BR /&gt;&lt;BR /&gt;API_DEVICE = "https://&amp;lt;ise_pan&amp;gt;:9060/ers/config/endpoint?filter=groupId.EQ." + groupID + "&amp;amp;size=100"&lt;BR /&gt;API_ERS_USER = "&amp;lt;user&amp;gt;","&amp;lt;pass&amp;gt;"&lt;BR /&gt;HEADERS = {&lt;BR /&gt;    'Accept': "application/json",&lt;BR /&gt;    'Content-Type': "application/json",&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;r = requests.get(url=API_DEVICE, auth=API_ERS_USER, headers=HEADERS, verify=True)&lt;BR /&gt;&lt;BR /&gt;#print r.text&lt;BR /&gt;data = r.text&lt;BR /&gt;&lt;BR /&gt;endPoints = json.loads(data)&lt;BR /&gt;print "Total Number of Endpoints in Group:",endPoints['SearchResult']['total']&lt;BR /&gt;print "---------------------------------------"&lt;BR /&gt;&lt;BR /&gt;f = open ('Grp_Macs.csv','w')&lt;BR /&gt;w = csv.DictWriter(f, fieldnames = ['MAC Address','Description'])&lt;BR /&gt;w.writeheader()&lt;BR /&gt;f.close()&lt;BR /&gt;&lt;BR /&gt;for MAC in endPoints ["SearchResult"]["resources"]:&lt;BR /&gt;    temp1 = MAC['name']&lt;BR /&gt;    with open ('Grp_Macs.csv','a') as csvfile:&lt;BR /&gt;        w = csv.writer(csvfile)&lt;BR /&gt;        try:&lt;BR /&gt;            temp2 = MAC['description']&lt;BR /&gt;            w.writerow([temp1, temp2])&lt;BR /&gt;            print "MAC Address:", temp1, "||", "Description:", temp2&lt;BR /&gt;        except KeyError:&lt;BR /&gt;            w.writerow([temp1, temp2])&lt;BR /&gt;            print "MAC Address:", temp1, "||", "Description:"""&lt;BR /&gt;            continue&lt;BR /&gt;with open ('Grp_Macs.csv','a') as csvfile:&lt;BR /&gt;    w = csv.writer(csvfile)&lt;BR /&gt;    TOTAL = endPoints['SearchResult']['total']&lt;BR /&gt;    w.writerow(['Total Endpoints:', TOTAL])&lt;BR /&gt;&lt;BR /&gt;sys.exit()&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Use curl to get id group strings for the specific groups.&amp;nbsp; Update ers user/pass creds.&amp;nbsp; Sample output of csv is as follows:&lt;/P&gt;
&lt;P&gt;MAC Address,Description&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description1&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description2&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description3&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description4&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description5&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description6&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description7&lt;BR /&gt;XX:XX:XX:XX:XX:XX,description8&lt;BR /&gt;Total Endpoints:,8&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Curl example to get group id string:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;curl -k --include --header 'Content-Type:application/json' --header 'Accept: application/json' --user &amp;lt;user&amp;gt;:&amp;lt;pass&amp;gt; --request GET https://&amp;lt;ise_pan&amp;gt;:9060/ers/config/endpointgroup?filter=name.EQ.&amp;lt;your_group_name&amp;gt; &lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Oct 2021 13:46:49 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4481881#M570245</guid>
      <dc:creator>Mike.Cifelli</dc:creator>
      <dc:date>2021-10-07T13:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: ISE: how to extract MAC lists which are used for MAB</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4482288#M570255</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;This morning I got it by doing as you said!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 01:04:54 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4482288#M570255</guid>
      <dc:creator>naoki_Japan</dc:creator>
      <dc:date>2021-10-08T01:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: ISE: how to extract MAC lists which are used for MAB</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4482289#M570256</link>
      <description>&lt;P&gt;Thank you sharing the code useful !!!&lt;/P&gt;&lt;P&gt;I can use this code in various way by customizing the code!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 01:06:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-how-to-extract-mac-lists-which-are-used-for-mab/m-p/4482289#M570256</guid>
      <dc:creator>naoki_Japan</dc:creator>
      <dc:date>2021-10-08T01:06:21Z</dc:date>
    </item>
  </channel>
</rss>

