Skydata001 commited on
Commit
3e27030
·
verified ·
1 Parent(s): 49fbca7

Delete Password_AI

Browse files
Password_AI/app.py DELETED
@@ -1,87 +0,0 @@
1
- # app.py
2
-
3
- # 1. استيراد المكتبات الأساسية
4
- from flask import Flask, render_template, request, jsonify # Flask لإدارة الويب
5
- from password_data import COMMON_PASSWORDS # ملف البيانات المحلي (محاكاة بيانات التسريب)
6
- import re # مكتبة التعبيرات النمطية لفحص أنواع الأحرف
7
-
8
- # تهيئة تطبيق Flask
9
- app = Flask(__name__)
10
-
11
- # دالة (Function) لفحص القوة والتحقق من التسريب
12
- def check_password_strength(password):
13
- """تحليل قوة كلمة المرور وإرجاع الحالة والنصائح."""
14
- score = 0
15
- feedback = []
16
-
17
- # ------------------
18
- # أ. قواعد قوة كلمة المرور
19
- # ------------------
20
-
21
- # القاعدة 1: الطول (الأولوية القصوى)
22
- if len(password) >= 12:
23
- score += 3
24
- feedback.append("✔️ طول ممتاز (12 حرفًا أو أكثر).")
25
- elif len(password) >= 8:
26
- score += 2
27
- feedback.append("⭐ طول جيد (8-11 حرفًا).")
28
- else:
29
- feedback.append("❌ كلمة المرور قصيرة جداً (يجب أن تكون 8 أحرف على الأقل).")
30
-
31
- # القاعدة 2: تنوع الأحرف (نقاط إضافية لكل نوع)
32
- if re.search(r"[a-z]", password): score += 1 # أحرف إنجليزية صغيرة
33
- if re.search(r"[A-Z]", password): score += 1 # أحرف إنجليزية كبيرة
34
- if re.search(r"\d", password): score += 1 # أرقام
35
-
36
- # القاعدة 3: الرموز والأحرف العربية
37
- # هذا التعبير يبحث عن أي شيء ليس حرفاً إنجليزياً أو رقم، بما في ذلك الرموز والأحرف العربية.
38
- if re.search(r"[^a-zA-Z0-9\s]", password):
39
- score += 1
40
-
41
- # ------------------
42
- # ب. التحقق من التسريب (محاكاة Hugging Face)
43
- # ------------------
44
-
45
- # تحويل الكل إلى أحرف صغيرة للمقارنة غير الحساسة لحالة الأحرف
46
- is_leaked = password.lower() in [p.lower() for p in COMMON_PASSWORDS]
47
-
48
- if is_leaked:
49
- # إذا كانت مسربة، يتم إهمال القوة وتصنيفها كـ "ضعيفة جداً"
50
- status = "ضعيفة جداً"
51
- color = "red"
52
- feedback.append("🚨 تم العثور عليها ضمن كلمات المرور المسربة أو الشائعة جداً.")
53
- elif score >= 5:
54
- status = "آمنة"
55
- color = "green"
56
- elif score >= 3:
57
- status = "جيدة"
58
- color = "orange"
59
- else:
60
- status = "ضعيفة"
61
- color = "red"
62
-
63
- return status, color, feedback
64
-
65
- # مسار الصفحة الرئيسية: عرض الواجهة
66
- @app.route('/')
67
- def index():
68
- return render_template('index.html')
69
-
70
- # مسار الفحص: استقبال كلمة المرور وإرسال النتيجة
71
- @app.route('/check', methods=['POST'])
72
- def check():
73
- data = request.get_json()
74
- password = data.get('password', '')
75
-
76
- status, color, feedback = check_password_strength(password)
77
-
78
- # إرجاع النتائج بتنسيق JSON
79
- return jsonify({
80
- 'status': status,
81
- 'color': color,
82
- 'feedback': feedback
83
- })
84
-
85
- if __name__ == '__main__':
86
- # تشغيل التطبيق في وضع التطوير
87
- app.run(debug=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Password_AI/password_data.py DELETED
@@ -1,15 +0,0 @@
1
- # password_data.py
2
-
3
- # قائمة محاكاة لكلمات المرور المسربة / الشائعة
4
- COMMON_PASSWORDS = [
5
- "123456",
6
- "password",
7
- "qwerty",
8
- "admin",
9
- "تيكتوك",
10
- "كلمةسر",
11
- "مرحبا123",
12
- "iloveyou",
13
- "secret",
14
- "محمد",
15
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Password_AI/requirements.txt DELETED
File without changes
Password_AI/templates/index.html DELETED
@@ -1,65 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="ar" dir="rtl">
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>مدقق قوة وسلامة كلمة المرور</title>
6
- <style>
7
- /* كود CSS لتجميل الواجهة (تم اختصاره هنا لتجنب التكرار) */
8
- body { font-family: Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f7f6; direction: rtl; text-align: right; display: flex; justify-content: center; align-items: center; min-height: 100vh; }
9
- .container { background-color: #ffffff; padding: 30px; border-radius: 12px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1); width: 100%; max-width: 500px; }
10
- h1 { color: #2c3e50; border-bottom: 3px solid #3498db; padding-bottom: 10px; margin-bottom: 25px; text-align: center; }
11
- input[type="password"] { width: 100%; padding: 15px; margin-bottom: 20px; border: 2px solid #ccc; border-radius: 8px; box-sizing: border-box; font-size: 18px; direction: ltr; text-align: left; }
12
- .result { padding: 15px; border-radius: 8px; margin-top: 20px; font-weight: bold; display: none; }
13
- .red { background-color: #f8d7da; color: #721c24; }
14
- .orange { background-color: #ffe8b7; color: #856404; }
15
- .green { background-color: #d4edda; color: #155724; }
16
- </style>
17
- </head>
18
- <body>
19
- <div class="container">
20
- <h1>مدقق قوة وسلامة كلمة المرور 🔒</h1>
21
-
22
- <label for="password_input">أدخل كلمة المرور للفحص (عربي/إنجليزي/رموز):</label>
23
- <input type="password" id="password_input" onkeyup="checkPassword()">
24
-
25
- <div id="result_box" class="result">
26
- <p><strong>حالة كلمة المرور:</strong> <span id="password_status"></span></p>
27
- <ul id="feedback_details"></ul>
28
- </div>
29
- </div>
30
-
31
- <script>
32
- function checkPassword() {
33
- const password = document.getElementById('password_input').value;
34
- const resultBox = document.getElementById('result_box');
35
-
36
- if (password.length === 0) {
37
- resultBox.style.display = 'none';
38
- return;
39
- }
40
-
41
- // إرسال طلب POST إلى الخادم (app.py)
42
- fetch('/check', {
43
- method: 'POST',
44
- headers: { 'Content-Type': 'application/json' },
45
- body: JSON.stringify({ 'password': password })
46
- })
47
- .then(response => response.json())
48
- .then(data => {
49
- // تحديث الواجهة بالنتائج المستلمة
50
- resultBox.style.display = 'block';
51
- resultBox.className = `result ${data.color}`;
52
- document.getElementById('password_status').textContent = data.status;
53
-
54
- const feedbackDetails = document.getElementById('feedback_details');
55
- feedbackDetails.innerHTML = '';
56
- data.feedback.forEach(item => {
57
- const li = document.createElement('li');
58
- li.textContent = item;
59
- feedbackDetails.appendChild(li);
60
- });
61
- });
62
- }
63
- </script>
64
- </body>
65
- </html>