def predict(url):
    f = Features()
    features = f.Create_features(url)
    # print(features)
    test = Testing()
    r = test.Test(rules, features)
    label = eval(r[-1])
    d = dict(label)
    # print(d.keys())
    if not url:
        return ("Empty string")
    else:
        for key in d.keys():
            if (key == '0'):
                return (
                    "\nYou are safe!This website is not vulnerable to XSS attack\n"
                )
            else:
                return ("\nAlert!This website is vulnerable to XSS attack\n")
            return 1
        else:
            return 0
    
    #.........Returning count of spcl char............
    def Spcl_char(self,url):
        spcl = re.findall("(<)|(>)|(/)|(=)",url)
        return len(spcl)

    #.........Create feature set...............
    def Create_features(self,url):
        features = [self.url_length(url),self.Keywords(url),self.url_count(url),self.Spcl_char(url)]
        return features


url = input('Enter the website URL : ')
f = Features()
features = f.Create_features(url)
#print(features)
test = Testing()
r = test.Test(rules,features)
label = eval(r[-1])
d = dict(label)
#print(d.keys())

for key in d.keys() :
    
    if(key == '0'):
        print("\nYou are safe!This website is not vulnerable to XSS attack\n")
    else:
        print("\nAlert!This website is vulnerable to XSS attack\n")