File size: 865 Bytes
b20ccea
 
 
 
 
 
77390a2
b20ccea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from flask import Flask, render_template, request
import pickle

app = Flask(__name__)

# Load the pre-trained phishing detection model from the .pkl file
with open('phishing (2).pkl', 'rb') as model_file:
    phishing_model = pickle.load(model_file)

def is_phishing(url):
    # Replace this with your actual prediction logic
    # Example: You might need to preprocess the URL before making predictions
    # prediction = phishing_model.predict(preprocess(url))
    prediction = phishing_model.predict([url])  # Assuming the model expects a list of URLs
    return prediction[0]

@app.route('/', methods=['GET', 'POST'])
def index():
    result = None

    if request.method == 'POST':
        url = request.form['url']
        result = is_phishing(url)

    return render_template('index.html', result=result)

if __name__ == '__main__':
    app.run(debug=True)