-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay48s1.java
More file actions
72 lines (59 loc) · 2.38 KB
/
Day48s1.java
File metadata and controls
72 lines (59 loc) · 2.38 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import java.util.Scanner;
import java.util.regex.*;
public class Day48s1 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Şifre Güvenlik Kontrolü");
System.out.println("----------------------");
System.out.print("Kontrol etmek istediğiniz şifreyi girin: ");
String password = scanner.nextLine();
int gucPuani = 0;
StringBuilder oneriler = new StringBuilder();
// Uzunluk kontrolü
if (password.length() >= 8) {
gucPuani += 2;
} else {
oneriler.append("- Şifreniz en az 8 karakter uzunluğunda olmalıdır.\n");
}
// Büyük harf kontrolü
if (Pattern.compile("[A-Z]").matcher(password).find()) {
gucPuani += 2;
} else {
oneriler.append("- Şifrenizde en az bir büyük harf bulunmalıdır.\n");
}
// Küçük harf kontrolü
if (Pattern.compile("[a-z]").matcher(password).find()) {
gucPuani += 2;
} else {
oneriler.append("- Şifrenizde en az bir küçük harf bulunmalıdır.\n");
}
// Rakam kontrolü
if (Pattern.compile("[0-9]").matcher(password).find()) {
gucPuani += 2;
} else {
oneriler.append("- Şifrenizde en az bir rakam bulunmalıdır.\n");
}
// Özel karakter kontrolü
if (Pattern.compile("[!@#$%^&*(),.?\":{}|<>]").matcher(password).find()) {
gucPuani += 2;
} else {
oneriler.append("- Şifrenizde en az bir özel karakter bulunmalıdır.\n");
}
// Sonuçları göster
System.out.println("\nŞifre Güvenlik Analizi");
System.out.println("----------------------");
System.out.println("Güç Puanı: " + gucPuani + "/10");
if (gucPuani >= 8) {
System.out.println("Durum: Güçlü şifre");
} else if (gucPuani >= 5) {
System.out.println("Durum: Orta seviye şifre");
} else {
System.out.println("Durum: Zayıf şifre");
}
if (oneriler.length() > 0) {
System.out.println("\nGüvenlik Önerileri:");
System.out.println(oneriler.toString());
}
scanner.close();
}
}