Canstralian commited on
Commit
25094da
1 Parent(s): b68999f

Create utils.py

Browse files
Files changed (1) hide show
  1. utils.py +36 -0
utils.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import ipaddress
3
+ from urllib.parse import urlparse
4
+
5
+ def load_sample_data():
6
+ """Loads the sample vulnerability dataset."""
7
+ return pd.DataFrame({
8
+ "ID": [1, 2],
9
+ "Type": ["SQL Injection", "Cross-Site Scripting (XSS)"],
10
+ "Severity": ["High", "Medium"],
11
+ "Description": [
12
+ "SQL injection vulnerability found in user input field.",
13
+ "Potential XSS vulnerability detected on the login page."
14
+ ]
15
+ })
16
+
17
+ def is_valid_ip(ip):
18
+ """Validates the IP address format."""
19
+ try:
20
+ ipaddress.ip_address(ip)
21
+ return True
22
+ except ValueError:
23
+ return False
24
+
25
+ def is_valid_domain(domain):
26
+ """Validates the domain format."""
27
+ try:
28
+ result = urlparse(domain)
29
+ return all([result.scheme, result.netloc])
30
+ except ValueError:
31
+ return False
32
+
33
+ def analyze_target(target):
34
+ """Placeholder for the actual vulnerability scanning logic."""
35
+ # Implement real scanning functionality here
36
+ st.success(f"Analysis completed for target: {target}.")