---
# System prepended metadata

title: src_cs_it_01_tmp

---

# src_cs_it_01_tmp
```
import requests
import datetime
import base64

def main():
    try:
        with open("D:\KPI_List\WAF_KPI_Sec.txt", "r") as f:
            lines = f.readlines()
            urls=[]
            for line in lines:
                urls.append(line).replace("\n", "")
        #print(urls)
        requests.packages.urllib3.disable_warnings()
        
        _user = base64.b64decode('c2VydmljZV9hcGk=').decode('utf-8')
        _pass = base64.b64decode('MndheCNFREMkUkZW').decode('utf-8')
        
        headers = {
        'User-Agent':'Mozilla/5.0 (Windows NI 6.1;WOW64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/56.0.2924.76 Safari/537.36',
        'X-NITRO-USER' : _user ,
        'X-NITRO-PASS' : _pass
        }

        nowTime = f"{datetime.datetime.now().strftime('%Y%m%d%H%M%S')}"
        for url in urls:
            url = 'https://172.18.15.50/nitro/v1/stat/appfwprofile?args=name:'+ url
            #print (url)
            response = requests.get(url, headers=headers,verify=False)
            for fData in response.json()['appfwprofile']:
                print (f"{nowTime},{fData['name']},{fData['appfirewallviolstarturlperprofilerate']},{fData['appfirewallvioldenyurlperprofilerate']},{fData['appfirewallviolbufferoverflowperprofilerate']},{fData['appfirewallviolxssperprofilerate']},{fData['appfirewallviolsqlperprofilerate']},{fData['appfirewallviolfieldformatperprofilerate']},{fData['appfirewallviolsafeobjectperprofilerate']},{fData['appfirewallviolperprofilerate']}")
    except Exception as a:
        #print(a)
        print(',')
        
    
if __name__ == '__main__':
    main()
```