-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpoofedUrlDetector.java
More file actions
42 lines (42 loc) · 1.03 KB
/
SpoofedUrlDetector.java
File metadata and controls
42 lines (42 loc) · 1.03 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
/* write a program which will detect the spoofed url and the verify the correct url
input:
Enter the correct URL
www.sololearns.com
Enter the number of test cases
6
www.sololærn.com
www.sololèarn.com
www.so|o|earn.com
www.sololearns.com
www.sololaern.com
www.solo.learn.com
output:
Spoofed:www.solol?rn.com
Spoofed:www.solol?arn.com
Spoofed:www.so|o|earn.com
Verified:www.sololearns.com
Spoofed:www.sololaern.com
Spoofed:www.solo.learn.com
*/
import java.util.*;
public class SpoofedUrlDetector{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter the correct URL");
String url = in.nextLine();
System.out.println("Enter the number of test cases");
int tc = in.nextInt();
in.nextLine();
String tcs[] = new String[tc];
for (int i=0;i<tc ;i++ ) {
tcs[i] = in.nextLine();
}
for (int i=0;i<tc ;i++ ) {
if(url.equals(tcs[i])){
System.out.println("Verified:"+tcs[i]);
}else{
System.out.println("Spoofed:"+tcs[i]);
}
}
}
}