Audit Security
# Audit Security App (Tkinter)
# Proper Login System
# ================================
import tkinter as tk
from tkinter import messagebox
import hashlib
# -------------------------------
# Default Username & Password
# username = admin
# password = Admin123
# -------------------------------
saved_username = "admin"
# Password Hash
saved_password = hashlib.sha256("Admin123".encode()).hexdigest()
# ================================
# LOGIN FUNCTION
# ================================
def login():
username = entry_user.get()
password = entry_pass.get()
# Convert entered password to hash
hashed_password = hashlib.sha256([Link]()).hexdigest()
# Check username & password
if username == saved_username and hashed_password == saved_password:
[Link]("Login", "Login Successful")
open_dashboard()
else:
[Link]("Error", "Invalid Username or Password")
# ================================
# DASHBOARD WINDOW
# ================================
def open_dashboard():
dashboard = [Link](root)
[Link]("Audit Security Dashboard")
[Link]("500x300")
[Link](bg="#dff9fb")
title = [Link](
dashboard,
text="Audit Security Dashboard",
font=("Arial", 18, "bold"),
bg="#dff9fb",
fg="darkblue"
)
[Link](pady=20)
info = [Link](
dashboard,
text="""
Welcome Admin
Security Features:
✔ Secure Login
✔ Password Hashing
✔ Audit Access
✔ Protected Dashboard
""",
font=("Arial", 12),
bg="#dff9fb",
justify="left"
)
[Link](pady=10)
logout_btn = [Link](
dashboard,
text="Logout",
font=("Arial", 12, "bold"),
bg="red",
fg="white",
width=12,
command=[Link]
)
logout_btn.pack(pady=20)
# ================================
# MAIN WINDOW
# ================================
root = [Link]()
[Link]("Audit Security App")
[Link]("400x300")
[Link](bg="#f5f6fa")
# Title
title = [Link](
root,
text="Audit Security Login",
font=("Arial", 18, "bold"),
bg="#f5f6fa",
fg="darkblue"
)
[Link](pady=20)
# Username
label_user = [Link](
root,
text="Username",
font=("Arial", 12),
bg="#f5f6fa"
)
label_user.pack()
entry_user = [Link](root, font=("Arial", 12))
entry_user.pack(pady=5)
# Password
label_pass = [Link](
root,
text="Password",
font=("Arial", 12),
bg="#f5f6fa"
)
label_pass.pack()
entry_pass = [Link](root, show="*", font=("Arial", 12))
entry_pass.pack(pady=5)
# Login Button
login_btn = [Link](
root,
text="Login",
font=("Arial", 12, "bold"),
bg="green",
fg="white",
width=15,
command=login
)
login_btn.pack(pady=20)
# Run App
[Link]()
Audit Simple
import datetime
logs = [
'User login: ali - SUCCESS',
'User login: hacker - FAILED',
'File access: admin - SUCCESS',
'User login: unknown - FAILED'
]
print('=== SECURITY AUDIT REPORT ===')
print('Date:', [Link]())
for log in logs:
status = 'ALERT' if 'FAILED' in log else 'OK'
print(f'{status} -> {log}')
DSA Enter App
import tkinter as tk
from [Link] import rsa, padding
from [Link] import hashes
# Generate Keys
key = rsa.generate_private_key(
public_exponent=65537,
key_size=2048
)
# Sign Function
def sign_message():
global message, signature
message = msg_entry.get().encode()
signature = [Link](
message,
padding.PKCS1v15(),
hashes.SHA256()
)
[Link](text="Message Signed ✔", fg="blue")
# Verify Function
def verify_message():
verify_msg = verify_entry.get().encode()
try:
key.public_key().verify(
signature,
verify_msg,
padding.PKCS1v15(),
hashes.SHA256()
)
[Link](text="Signature Verified ✔", fg="green")
except:
[Link](text="Verification Failed ✘", fg="red")
# GUI Window
root = [Link]()
[Link]("Digital Signature App")
[Link]("400x300")
# Message Input
[Link](root, text="Enter Message").pack(pady=5)
msg_entry = [Link](root, width=40)
msg_entry.pack()
# Sign Button
[Link](
root,
text="Sign Message",
command=sign_message
).pack(pady=10)
# Verify Input
[Link](root, text="Enter Message for Verification").pack(pady=5)
verify_entry = [Link](root, width=40)
verify_entry.pack()
# Verify Button
[Link](
root,
text="Verify Signature",
command=verify_message
).pack(pady=10)
# Result Label
result = [Link](root, text="", font=("Arial", 12, "bold"))
[Link](pady=10)
# Run App
[Link]()
DSA
import tkinter as tk
from [Link] import rsa, padding
from [Link] import hashes
# Generate Keys
key = rsa.generate_private_key(
public_exponent=65537,
key_size=2048
)
# Sign Function
def sign_message():
global message, signature
message = msg_entry.get().encode()
signature = [Link](
message,
padding.PKCS1v15(),
hashes.SHA256()
)
[Link](text="Message Signed ✔", fg="blue")
# Verify Function
def verify_message():
verify_msg = verify_entry.get().encode()
try:
key.public_key().verify(
signature,
verify_msg,
padding.PKCS1v15(),
hashes.SHA256()
)
[Link](text="Signature Verified ✔", fg="green")
except:
[Link](text="Verification Failed ✘", fg="red")
# GUI Window
root = [Link]()
[Link]("Digital Signature App")
[Link]("400x300")
# Message Input
[Link](root, text="Enter Message").pack(pady=5)
msg_entry = [Link](root, width=40)
msg_entry.pack()
# Sign Button
[Link](
root,
text="Sign Message",
command=sign_message
).pack(pady=10)
# Verify Input
[Link](root, text="Enter Message for Verification").pack(pady=5)
verify_entry = [Link](root, width=40)
verify_entry.pack()
# Verify Button
[Link](
root,
text="Verify Signature",
command=verify_message
).pack(pady=10)
# Result Label
result = [Link](root, text="", font=("Arial", 12, "bold"))
[Link](pady=10)
# Run App
[Link]()