cisco_meraki_fw_ap_rules_api.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:cisco-meraki-fw-ap-rules-api 作者: robertcsapo 项目源码 文件源码
def meraki_ap_fw_rules(status):
    json_fw_ap_list = meraki_requests("/networks/%s/ssids/%s/l3FirewallRules" % (args.network,args.ssid),meraki_api_key, "enable")
    global fw_ap_list
    key=0
    for item in json_fw_ap_list:
        key +=1
        # If there's only 2 firewall rules, then that's propably only the default meraki rules (which has their own string vars)
        if len(json_fw_ap_list) == 2:
            fw_ap_list.append([item["policy"],item["proto"],item["dst_cidr"],item["dst_port"],item["comment"]])
        else:
            # Split by , (csv support)
            fw_ap_list_raw.append([item["policy"]+','+item["protocol"]+','+item["destCidr"]+','+item["destPort"]+','+item["comment"]])
            fw_ap_list.append([item["policy"],item["protocol"],item["destCidr"],item["destPort"],item["comment"]])
    print(tabulate(fw_ap_list,headers=['Policy','Protocol','Destination','Port','Comment'],tablefmt="rst"))
    if status == "pre":
        print("")
        print(tabulate(fw_ap_list_raw,headers=['- Copy paste output (use as template) -'],tablefmt="rst"))
    print("")
    return fw_ap_list

# Import CSV file
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号