CS_LAB MANUAL PROGRAMS
CS_LAB MANUAL PROGRAMS
Steps for Creating a User Account, Setting Permissions, and Protecting Files with
Password:
2. Setting Permissions:
- Determine the files or directories that the user should have access to.
- Open the properties or permissions settings for those files or directories.
- Adjust the permissions to grant the appropriate level of access to the user. This
typically involves setting read, write, and execute permissions.
- Save the changes to apply the new permissions.
3. Protecting Files with Password:
- Encrypt sensitive files or directories using encryption tools or built-in encryption
features of the operating system.
- Set a strong password for accessing encrypted files or directories.
- Regularly update the password to maintain security.
- Consider implementing additional security measures such as multi-factor
authentication for accessing sensitive files.
2. Write the steps for disk partitioning and perform
operations like shrinking, Extending, deleting and
formatting.
The steps for disk partitioning and performing operations like shrinking,
extending, deleting, and formatting are as follows:
1. Disk Partitioning:
- Launch disk management utility:
- For Windows: Use Disk Management (diskmgmt.msc).
- For Linux: Utilize tools like GParted or command-line utilities like fdisk or
parted.
- Identify the disk you want to partition (be cautious to select the correct
disk).
- Select the unallocated space on the disk.
- Choose to create a new partition.
- Specify the size for the partition.
- Assign a drive letter (for Windows) or mount point (for Linux) to the
partition.
- Choose a file system (NTFS for Windows, ext4 for Linux).
- Complete the partition creation process.
2. Shrinking a Partition:
- Open the disk management utility.
- Locate the partition you want to shrink.
- Right-click on the partition and choose "Shrink Volume" (in Windows) or
use resize/move options in Linux tools like GParted.
- Specify the amount of space to shrink.
- Confirm the operation.
- Wait for the process to complete.
3. Extending a Partition:
- Open the disk management utility.
- Identify the adjacent unallocated space next to the partition you want to
extend.
- Right-click on the partition you want to extend.
- Choose "Extend Volume" (in Windows) or use resize/move options in
Linux tools like GParted.
- Specify the amount of space to add.
- Confirm the operation.
- Wait for the process to complete.
4. Deleting a Partition:
- Open the disk management utility.
- Identify the partition you want to delete.
- Right-click on the partition.
- Choose "Delete Volume" (in Windows) or use delete options in Linux
tools like GParted.
- Confirm the deletion.
- Note: Deleting a partition will erase all data on it, so ensure you have
backed up any important data beforehand.
5. Formatting a Partition:
- Open the disk management utility.
- Identify the partition you want to format.
- Right-click on the partition.
- Choose "Format" (in Windows) or use format options in Linux tools like
GParted.
- Select the file system you want to format the partition with.
- Optionally, provide a volume label.
- Confirm the formatting operation.
- Wait for the process to complete.
3.Prepare a Case study on Ransomware attacks. (Ex: Media
Markt)
Introduction:
In recent years, ransomware attacks have emerged as a significant cybersecurity
threat, targeting organizations across various industries worldwide. One notable
case is the ransomware attack on Media Markt, a leading European retailer
specializing in consumer electronics.
Background:
Media Markt operates a vast network of stores across Europe, offering a wide range
of products, including smartphones, laptops, TVs, and home appliances. With a
strong online presence and a large customer base, Media Markt relies heavily on its
IT infrastructure to manage operations, sales, and customer data.
Incident Overview:
In early 2023, Media Markt fell victim to a sophisticated ransomware attack that
infiltrated its systems, causing widespread disruption and chaos. The attack began
when employees across multiple departments received suspicious emails containing
malicious attachments disguised as legitimate documents or invoices. Unsuspecting
employees who opened these attachments inadvertently triggered the ransomware
infection, allowing it to spread rapidly throughout Media Markt's network.
Attack Execution:
Once inside the network, the ransomware encrypted critical files and systems,
rendering them inaccessible to employees. This included customer databases,
inventory management systems, and point-of-sale terminals, severely impacting
Media Markt's ability to process transactions and serve customers effectively. The
attackers, identified as a notorious cybercrime group known for targeting large
corporations, demanded a hefty ransom payment in exchange for providing
decryption keys to unlock the encrypted data.
However, despite their efforts, the ransomware attack had already caused
significant financial losses, operational disruptions, and reputational damage to
Media Markt. The retailer was forced to temporarily close several stores, resulting
in lost revenue and customer dissatisfaction. Moreover, the incident raised
concerns among customers regarding the security of their personal information
stored in Media Markt's systems, leading to a decline in trust and brand loyalty.
Lessons Learned:
The ransomware attack on Media Markt serves as a stark reminder of the evolving
cybersecurity threats faced by organizations in today's digital age. Several key
lessons can be drawn from this incident:
1. Employee Training
2. Robust Security Measures
3.Incident Response Preparedness
4. Regular Backups
5. Transparency and Communication
3. Verify Authenticity:
- Verify the authenticity of the software download by checking digital
signatures or checksums provided by the software developers.
4. Installation:
- Once downloaded, locate the installer file (e.g., .exe for
Windows, .dmg for macOS, or package manager for Linux).
- Double-click the installer file to begin the installation process.
- Follow the on-screen instructions provided by the installer wizard.
- Choose installation options such as destination folder, shortcuts, and
additional components if applicable.
- Wait for the installation process to complete.
1. Subscription Purchase:
- Select the desired software product or service from the vendor's
website.
- Choose the appropriate subscription plan based on your
requirements (e.g., monthly, annual).
- Proceed to checkout and make the payment using the provided
payment methods.
2. Account Creation:
- If you're a new user, create an account on the vendor's website.
- Provide necessary information such as name, email address, and
payment details.
- Verify your email address and set up account credentials
(username/password).
4. Installation:
- Download the installation files or follow the setup instructions
provided by the vendor.
- Run the installer executable or follow the deployment guidelines
provided for cloud-based services.
- Follow the on-screen instructions to complete the installation
process.
To make Microsoft Edge your default browser, add ActiveX controls, and install add-
ons, follow these steps:
3. Workgroup Configuration:
- Ensure both systems are part of the same workgroup.
- To change workgroup settings in Windows:
- Go to Control Panel > System and Security > System.
- Click on "Change settings" next to "Computer name, domain, and
workgroup settings."
- Click on the "Change" button under "Member of" and enter the
same workgroup name for both systems.
- Click OK and restart the system if prompted.
Wi-Fi, short for "Wireless Fidelity," is a technology that allows electronic devices to
connect to a wireless local area network (WLAN), typically using the 802.11
standards. It enables devices such as computers, smartphones, tablets, and other
devices to connect to the internet and communicate with each other without the
need for physical wired connections.
3. Connect to a Network:
- If the network is secured, you will be prompted to enter the network security
key (password).
- Enter the security key and click "Next" or "Connect."
- If the network is open (unsecured), you may be connected automatically.
4. Network Authentication:
- Some Wi-Fi networks may require additional authentication methods, such as
WPA2-Enterprise or 802.1X.
- If prompted, enter your username and password for network authentication.
7. Troubleshooting:
- If you encounter issues connecting to a Wi-Fi network, Windows offers built-in
troubleshooting tools.
- Right-click on the Wi-Fi icon in the system tray and select "Troubleshoot
problems" to diagnose and fix network connectivity issues.
**1. Switches:**
Installation:
- Place the switch in a central location within the network.
- Connect the power adapter to a power source and the switch's power
input.
- Connect Ethernet cables from the switch to the devices you want to
connect (e.g., computers, printers, servers).
Configuration:
- Access the switch's management interface using a web browser or
dedicated management software.
- Configure VLANs (Virtual Local Area Networks) if necessary.
- Set up port settings, such as speed, duplex mode, and port mirroring.
- Configure security settings, including MAC address filtering and port
security.
- Save and apply the configuration changes.
**2. Hubs:**
Installation:
- Place the hub in a central location within the network.
- Connect the power adapter to a power source and the hub's power input.
- Connect Ethernet cables from the hub to the devices you want to connect.
Configuration:
- Hubs are typically plug-and-play devices and do not require configuration.
**3. Modems:**
Installation:
- Connect the modem to a power source and turn it on.
- Connect the modem's Ethernet port to the WAN (Wide Area Network) port
on the router or directly to a computer.
- Connect the telephone line to the modem's phone jack if using a DSL
(Digital Subscriber Line) connection.
Configuration:
- Access the modem's configuration interface using a web browser.
- Enter the ISP (Internet Service Provider) credentials, such as username and
password, for PPPoE (Point-to-Point Protocol over Ethernet) connections.
- Configure other settings provided by the ISP, such as DNS servers and
connection type (static IP, dynamic IP, or PPPoE).
Installation:
- Connect the modem to the computer's serial port or USB port.
- Install any necessary drivers for the modem provided by the manufacturer.
Configuration:
- Open the Control Panel on the computer.
- Navigate to Network and Internet > Network and Sharing Center.
- Click on "Set up a new connection or network."
- Choose "Set up a dial-up connection" and click Next.
- Enter the dial-up phone number, username, and password provided by the
ISP.
- Click Connect to establish the dial-up connection.
Connecting:
- To connect to the internet using dial-up networking, open the dial-up
connection created earlier.
- Enter the username and password if prompted.
- Click Connect to establish the dial-up connection.
Firewalls are essential network security devices that monitor and control
incoming and outgoing network traffic based on predetermined security
rules. They act as a barrier between a trusted internal network and
untrusted external networks, such as the internet.
Some key features of firewalls include:
1. Packet Filtering
2. Stateful Inspection
3. Application Layer Filtering
4. Intrusion Detection and Prevention
5. Virtual Private Network (VPN) Support
6. Logging and Reporting
7. Traffic Shaping and Bandwidth Management
Configure Settings:
- After installation, configure system settings such as user accounts, time
zone, network settings, and security preferences.
Complete Installation:
- Wait for the installation process to complete.
- Depending on the software, you may need to restart the computer to
finalize the installation.
Configure Settings:
- After installation, configure the software settings according to your
preferences.
- Activate the software if required by entering the product key or license
information.
Complete Installation:
- Wait for the installation process to complete.
- After installation, the antivirus software may perform an initial scan of
your computer to check for any existing threats.
- Configure the antivirus software settings, such as scheduled scans, real-
time protection, and threat detection options.
Update Definitions:
- After installation, update the antivirus software definitions to ensure it
can detect the latest threats.
- Configure automatic updates to keep the antivirus software up-to-date
with the latest security definitions.
11.What do you mean by Spooling printers? Write the steps for spooling
printer.
2. Spooling: The spooler software then holds the print job temporarily in a queue,
typically in a designated area on the computer's storage device (such as a hard drive
or SSD). This allows the user to continue working on their computer without having
to wait for the print job to complete.
3. Queue Management: The spooler manages the print queue, ensuring that print
jobs are processed in the order they were received. It also handles tasks such as
prioritizing print jobs, managing printer resources, and handling any errors or
interruptions that may occur during printing.
5. Printing: The printer then retrieves the print job from its buffer or memory and
prints it onto paper or other media as specified by the print job.
6. Completion and Removal: After the print job has been successfully printed, the
spooler software removes it from the queue and frees up any resources associated
with it. The user can then either submit another print job or continue with other
tasks.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LEN 15
int main() {
char ip[MAX_LEN];
printf("Enter an IP address: ");
scanf("%s", ip);
return 0;
}
13.Write a Program to check the strength of the password.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MIN_LENGTH 8
#define MAX_LENGTH 20
// Function to check the strength of a password
int password_strength(char password[]) {
int length = strlen(password);
// Check length
if (length < MIN_LENGTH)
return 0; // Weak password
// Check if the password contains at least one uppercase letter, one lowercase letter, and one
digit
int has_upper = 0, has_lower = 0, has_digit = 0;
for (int i = 0; i < length; i++) {
if (isupper(password[i]))
has_upper = 1;
else if (islower(password[i]))
has_lower = 1;
else if (isdigit(password[i]))
has_digit = 1;
}
int main() {
char password[MAX_LENGTH + 1];
printf("Enter your password (between 8 and 20 characters): ");
scanf("%s", password);
switch(strength) {
case 1:
printf("Your password is very weak.\n");
break;
case 2:
printf("Your password is weak.\n");
break;
case 3:
printf("Your password is medium.\n");
break;
case 4:
printf("Your password is strong.\n");
break;
default:
printf("Invalid password.\n");
}
return 0;
}
14.Write the steps to transfer files between Wireless
communication using Bluetooth and FTP
Transferring files between wireless devices using Bluetooth and FTP (File Transfer Protocol)
involves a few steps. Below are the general steps to accomplish this:
Using Bluetooth:
1. Pairing Devices: Ensure that both devices (the sender and the receiver) have Bluetooth enabled
and are discoverable. Pair the devices by searching for nearby Bluetooth devices and selecting the
appropriate device to pair with.
2. Enable File Transfer: Once paired, ensure that both devices support the necessary Bluetooth
profiles for file transfer. Most modern devices support the Object Push Profile (OPP) or File
Transfer Profile (FTP) for file transfer over Bluetooth.
3. Select Files to Transfer: On the device that contains the files to be transferred, navigate to the
file manager or file browser app and select the files or folders you want to transfer.
4. Send Files: Choose the option to share or send the selected files via Bluetooth. Select the paired
device to which you want to send the files. The recipient device will likely prompt for permission to
accept the incoming files.
5. Receive Files: On the receiving device, accept the incoming file transfer request. The files will be
transferred over Bluetooth from the sender to the receiver.
Using FTP:
1. Set up FTP Server: On the device from which you want to transfer files (usually a computer or a
smartphone), set up an FTP server. You can use third-party FTP server software or apps available
for your operating system.
2. Connect to Wi-Fi Network: Ensure that both the sender and the receiver devices are connected
to the same Wi-Fi network. This is necessary for them to communicate with each other over FTP.
3. Access FTP Server: On the device to which you want to transfer files, open an FTP client
application. Enter the IP address or hostname of the FTP server (which is the device from which
you want to transfer files) and the appropriate login credentials (username and password) if
required.
4. Navigate and Transfer Files: Once connected to the FTP server, navigate through the directory
structure to find the files you want to transfer. You can then download or upload files between the
FTP server and the FTP client application on the other device.
5. Disconnect: After transferring the files, properly disconnect from the FTP server to ensure
security and release any resources being used for the FTP connection.
1. Investigation
2. Incident Response
3.Security Enhancements
4. Customer Communication
Lessons Learned:
The cyber attack on Cosmos Bank underscores the importance of robust cybersecurity measures
for financial institutions:
1. Proactive Security
2. Continuous Monitoring
3.Collaboration and Information Sharing
4. Regulatory Compliance
Conclusion:
The cyber attack on Cosmos Bank serves as a wake-up call for the banking industry, highlighting
the evolving nature of cyber threats and the critical importance of cybersecurity preparedness. By
learning from this incident, financial institutions can strengthen their defenses, enhance resilience,
and safeguard against future cyber attacks.
Conclusion:
The social media crime that occurred in Pune in 2021 serves as a cautionary tale about the dangers
of online harassment, cyberbullying, and defamation. It underscores the need for proactive
measures to combat social media crimes, protect individuals' digital rights, and promote a safe and
inclusive online environment. By raising awareness, strengthening legal frameworks, and fostering
digital literacy, communities can work together to prevent and address social media crimes
effectively.
18.Prepare a case study on Japanese Bank for Key logger Scam
Title: Japanese Bank Keylogger Scam: A Case Study
Introduction:
In recent years, cybersecurity threats have become increasingly sophisticated, posing significant
risks to financial institutions worldwide. This case study examines a keylogger scam that targeted a
Japanese bank, highlighting the methods used by cybercriminals, the impact on the bank and its
customers, and the measures taken to mitigate the attack.
Background:
Keyloggers are malicious software programs designed to covertly monitor and record keystrokes
on a user's computer. Cybercriminals use keyloggers to steal sensitive information such as login
credentials, credit card numbers, and personal data, which can then be exploited for financial gain
or identity theft.
The Incident:
In this case, a Japanese bank (let's refer to it as "XYZ Bank") fell victim to a sophisticated keylogger
scam that compromised the security of its online banking system. The perpetrators, believed to be
part of an organized cybercrime group, deployed keylogger malware to infect the computers of
unsuspecting bank customers.
Key Points of the Incident:
1. Malware Distribution
2. Unauthorized Access
3. Data Theft
4. Financial Losses
Impact:
The keylogger scam had profound consequences for XYZ Bank, its customers, and the broader
financial ecosystem:
1. Customer Trust
2. Reputation Damage
3. Regulatory Scrutiny
4. Legal Liability
Response and Resolution:
In response to the keylogger scam, XYZ Bank took several proactive measures to address the
security breach and mitigate its impact:
1. Incident Response
2. Customer Communication
3. Security Enhancements
4. Regulatory Compliance
Conclusion:
The keylogger scam targeting XYZ Bank serves as a stark reminder of the evolving cybersecurity
threats facing financial institutions globally. By investing in robust cybersecurity measures,
fostering a culture of vigilance and resilience, and collaborating with stakeholders, banks can
mitigate the risk of cyberattacks and protect their customers' assets and trust in the digital age.
19.Write the steps to prevent the denial of Service attacks.
Preventing Denial of Service (DoS) attacks requires a multi-layered approach that involves both
proactive measures and reactive responses. Below are steps that organizations can take to prevent
DoS attacks:
5. Generate Traffic
6. Monitor Alerts
7. Analyze Alerts
8. Respond to Alerts
9. Fine-tune Configuration
10. Document Findings
Malware, short for "malicious software," refers to any type of software designed to infiltrate,
damage, or otherwise interfere with a computer system, without the owner's consent. Malware
can take many forms, including viruses, worms, trojans, ransomware, spyware, adware, and
more. Its purposes can range from stealing sensitive information, disrupting normal computer
operations, to causing financial harm or gaining unauthorized access to a system.
Here are steps to remove malware from your PC:
1.Disconnect from the Internet
2. Enter Safe Mode
3. Update Antivirus Software
4. Scan Your System
5. Use Malware Removal Tools
6. Manually Remove Malicious Files
7. Restore from Backup
8. Reset Your Browsers
9. Reconnect to the Internet and Update Software
10. Monitor Your System
22.What are the various types of Vulnerabilities for hacking the web
applications.
Web applications are prone to various vulnerabilities that can be exploited by hackers. Some of the
most common vulnerabilities include:
1. Injection Attacks
2. Broken Authentication
3. Sensitive Data Exposure
4. XML External Entity (XXE)
5. Security Misconfigurations
6. Cross-Site Request Forgery (CSRF)
7. Broken Access Control
8. Security Headers Misconfiguration
9. Insecure Deserialization
10. Insecure File Uploads
These are just a few examples of the many vulnerabilities that hackers can exploit in web
applications. It's essential for developers and security professionals to be aware of these
vulnerabilities and take proactive measures to mitigate them during the development and
maintenance of web applications. Regular security assessments, code reviews, and implementing
best practices can help reduce the risk of exploitation and enhance the overall security posture of
web applications.
23.Write steps for sharing files and printer remotely between two
system
Sharing files and printers remotely between two systems involves setting up appropriate
permissions and network configurations. Here are the steps to achieve this:
24.List out the various Mobile security apps . Write the steps to install
and use ,one of the mobile security app
There are several mobile security apps available for both Android and iOS devices. Some
popular ones include:
Here are the general steps to install and use a mobile security app, using Avast Mobile
Security as an example:
Input:
- Message (M)
- Secret Key (K)
- Hash Function (H)
Steps:
1. If the length of the secret key (K) is greater than the block size of the hash function (H), hash
the key (K) using the hash function (H) and set the result as the new key (K).
2. If the length of the secret key (K) is less than the block size of the hash function (H), pad the
key (K) with zeros until it matches the block size.
3. Create two blocks:
- Inner Block (Inner_pad): XOR the key (K) with the constant 0x36 repeated to match the
block size.
- Outer Block (Outer_pad): XOR the key (K) with the constant 0x5C repeated to match the
block size.
4. Calculate the HMAC:
- Inner_Hash = HashFunction(Inner_pad || M)
- HMAC = HashFunction(Outer_pad || Inner_Hash)
5. Output the HMAC as the authentication code.
Input:
- Message (M)
- Received HMAC (HMAC_recv)
- Secret Key (K)
- Hash Function (H)
Steps:
1. Calculate the HMAC using the same process as the encoding algorithm with the received
message (M), secret key (K), and hash function (H).
2. Compare the calculated HMAC with the received HMAC (HMAC_recv).
3. If the calculated HMAC matches the received HMAC, the message (M) is considered
authentic; otherwise, it may have been tampered with.
Title: Mahesh Bank Cyber Attack: Safeguarding Financial Institutions in the Digital Age
Introduction:
Mahesh Bank, a prominent financial institution known for its commitment to customer service and
technological innovation, found itself at the center of a cybersecurity crisis in October 2023. This
case study delves into the details of the cyber attack that targeted Mahesh Bank, the impact it had
on the bank and its customers, and the strategies employed to mitigate the damage and prevent
future incidents.
Background:
Mahesh Bank, headquartered in a bustling metropolis, boasted a vast network of branches and a
substantial customer base. Recognizing the importance of embracing digital transformation, the
bank had invested heavily in advanced technology to enhance its operations, streamline customer
experiences, and ensure robust cybersecurity measures.
Incident:
In early October 2023, Mahesh Bank's cybersecurity team detected unusual activity within the
bank's network. Investigation revealed that the bank had fallen victim to a sophisticated cyber
attack orchestrated by a group of highly skilled hackers. The attackers exploited vulnerabilities in
the bank's systems to gain unauthorized access to sensitive data, including customer information
and financial records.
The cyber attack targeted multiple facets of the bank's operations, including:
Title: Unveiling the Risks: A Case Study of a Cyber Attack Through a Compromised Facebook
Account
Introduction:
In the digital age, social media platforms like Facebook have become integral parts of our daily
lives, facilitating communication, networking, and sharing of information. However, these
platforms also pose significant cybersecurity risks, as demonstrated by a cyber attack perpetrated
through a compromised Facebook account. This case study explores the details of the attack, its
impact on the victim and their network, and the measures taken to mitigate the damage and
enhance security.
Background:
Facebook, one of the world's largest social media platforms, boasts billions of active users
worldwide. Its vast user base and interconnected nature make it an attractive target for
cybercriminals seeking to exploit vulnerabilities for various malicious purposes, including identity
theft, phishing, malware distribution, and financial fraud.
Incident:
In this case, a user named Sarah, an avid Facebook user with a large network of friends and
followers, fell victim to a cyber attack through her compromised Facebook account. The incident
unfolded as follows:
1. Unauthorized Access
2. Account Takeover
3. Impact
Response and Mitigation Efforts:
Upon discovering the unauthorized activity on her Facebook account, Sarah took immediate steps
to mitigate the damage and regain control:
1. Account Recovery
2. Communication
3. Reporting
4. Education and Awareness
Lessons Learned and Future Preparedness:
The cyber attack through Sarah's compromised Facebook account served as a wake-up call,
highlighting the following key lessons and best practices:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
// Create socket
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
error("ERROR opening socket");
}
// Connect to server
if (connect(sockfd, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
error("ERROR connecting");
}
char buffer[BUFFER_SIZE];
int bytes_received;
while ((bytes_received = recv(sockfd, buffer, BUFFER_SIZE, 0)) > 0) {
fwrite(buffer, 1, bytes_received, file);
}
if (bytes_received < 0) {
error("ERROR receiving data");
}
fclose(file);
close(sockfd);
printf("File downloaded successfully.\n");
return 0;
}
31.Write the steps to detect the number of devices connected to wifi and
block unauthorized devices
Detecting the number of devices connected to a Wi-Fi network and blocking unauthorized devices
involves several steps. Below are the general steps you can follow:
1. Access Router Settings
2. Navigate to Connected Devices
3. Identify Authorized Devices
4. Identify Unauthorized Devices
5. Block Unauthorized Devices
6. Verify Block
7. Regular Monitoring and Maintenance
Introduction:
The emergence of cryptocurrencies has transformed the landscape of finance, offering
decentralized and secure alternatives to traditional banking systems. However, this revolutionary
technology also presents new challenges, including cybersecurity threats. This case study delves
into the Grim Finance cyber attack, a notable incident that rocked the cryptocurrency world,
highlighting the vulnerabilities inherent in digital assets and the repercussions of such attacks.
Background:
Grim Finance was a prominent cryptocurrency exchange platform known for its user-friendly
interface, wide range of supported cryptocurrencies, and robust security measures. Catering to a
global clientele, the platform facilitated trading, investment, and storage of various digital assets,
attracting a large user base of investors and enthusiasts alike.
Incident:
In a stunning turn of events, Grim Finance fell victim to a sophisticated cyber attack in July 2023,
marking one of the largest breaches in the history of cryptocurrency exchanges. The attack
unfolded as follows:
1. Breach of Security
2. Theft of Funds
3. Manipulation of Markets
Response and Mitigation Efforts:
In the aftermath of the cyber attack, Grim Finance initiated a multifaceted response aimed at
containing the breach, mitigating the damage, and restoring trust in the platform:
Program:
#include <stdio.h>
int main() {
char plaintext[100], ciphertext[100];
int shift;
// Encrypt plaintext
strcpy(ciphertext, plaintext);
encrypt(ciphertext, shift);
// Decrypt ciphertext
decrypt(ciphertext, shift);
return 0;
}
Algorithm:
1. Define the initial and final permutation tables (IP and FP).
2. Define the 16 round keys using the key schedule algorithm.
3. Perform the initial permutation (IP) on the plaintext.
4. Divide the permuted plaintext into left and right halves (L0 and R0).
5. Perform 16 rounds of encryption/decryption using the Feistel function:
a. Expand the right half (Ri) to 48 bits using the expansion permutation table.
b. XOR the expanded Ri with the round key (Ki).
c. Apply the S-box substitutions to the XOR result.
d. Permute the result using the P-box permutation table.
e. XOR the permuted result with the left half (Li-1).
f. Update Li = Ri-1 and Ri = XOR result.
6. Perform the final permutation (FP) on the concatenated Ri and Li.
7. Output the ciphertext.
Program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Perform permutation
void permutation(int *input, int *output, int *permutation_table, int size) {
for (int i = 0; i < size; i++) {
output[i] = input[permutation_table[i] - 1];
}
}
// DES encryption/decryption
void des_encrypt_decrypt(int *block, int *subkeys, int rounds) {
int left[32], right[32], temp[32];
// Initial permutation
permutation(block, temp, initial_permutation, 64);
memcpy(left, temp, 32);
memcpy(right, temp + 32, 32);
// Rounds
for (int i = 0; i < rounds; i++) {
memcpy(temp, right, 32);
// Expansion permutation
permutation(right, temp, expansion_permutation, 48);
// S-box substitution
sbox_substitution(temp);
// P-box permutation
permutation(temp, temp, pbox_permutation, 32);
// Final permutation
memcpy(temp, right, 32);
memcpy(temp + 32, left, 32);
permutation(temp, block, final_permutation, 64);
}
int main() {
// Define plaintext and key
int plaintext[64] = {0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 1, 1,
0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 1, 0, 1,
0, 0, 0, 0, 0, 1, 1, 0,
0, 0, 0, 0, 0, 1, 1, 1,
0, 0, 0, 0, 1, 0, 0, 0};
// Generate subkeys
int subkeys[16][48];
generate_subkeys(key, subkeys);
// Output ciphertext
printf("Ciphertext: ");
for (int i = 0; i < 64; i++) {
printf("%d", plaintext[i]);
}
printf("\n");
return 0;
}
35.Write RSA algorithm and Program to implement RSA Standard for
encryption
and decryption
Algorithm:
1. Key Generation:
a. Choose two large prime numbers, p and q.
b. Calculate the modulus n = p * q.
c. Compute Euler's totient function φ(n) = (p - 1) * (q - 1).
d. Choose an integer e such that 1 < e < φ(n) and gcd(e, φ(n)) = 1.
e. Compute the modular multiplicative inverse d of e modulo φ(n), i.e., d * e ≡ 1 (mod φ(n)).
f. The public key is (n, e) and the private key is (n, d).
2. Encryption:
a. Convert the plaintext message M to an integer m such that 0 ≤ m < n.
b. Compute the ciphertext C ≡ m^e (mod n).
3. Decryption:
a. Compute the plaintext message M ≡ C^d (mod n).
Program:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// Choose public key exponent e such that 1 < e < phi(n) and gcd(e, phi(n)) = 1
*e = 2;
while (gcd(*e, phi) != 1) {
(*e)++;
}
int main() {
int p, q, n, e, d;
int plaintext, ciphertext;
// Input plaintext
printf("Enter plaintext message: ");
scanf("%d", &plaintext);
// RSA encryption
ciphertext = rsa_encrypt(plaintext, e, n);
printf("Encrypted message (ciphertext): %d\n", ciphertext);
// RSA decryption
plaintext = rsa_decrypt(ciphertext, d, n);
printf("Decrypted message (plaintext): %d\n", plaintext);
return 0;
}
4. Update Attack
- Example:
```
User input: ' WHERE id=1; DROP TABLE users; --
SQL query: UPDATE table_name SET column1 = 'new_value' WHERE
condition;
Malicious input: ' WHERE id=1; DROP TABLE users; --
Resulting query: UPDATE table_name SET column1 = 'new_value' WHERE
condition; DROP TABLE users; --';
```
5. Deletion Attack
- Example:
```
User input: ' OR 1=1; DROP TABLE users; --
SQL query: DELETE FROM table_name WHERE condition;
Malicious input: ' OR 1=1; DROP TABLE users; --
Resulting query: DELETE FROM table_name WHERE condition OR 1=1;
DROP TABLE users; --';
```
6. Execute Attack
7. Mitigation
Algorithm:
Program:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
unsigned long long p, g, a, b, A, B, K1, K2;
// Step 2: Alice computes her private key (a) and public key (A)
printf("Enter Alice's private key (a): ");
scanf("%llu", &a);
A = power_modulo(g, a, p);
// Step 3: Bob computes his private key (b) and public key (B)
printf("Enter Bob's private key (b): ");
scanf("%llu", &b);
B = power_modulo(g, b, p);
Algorithm:
1. Key Generation
2. Signature Generation
3. Signature Verification
Program:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main() {
unsigned long long p, q, n, e, d, message, signature, decrypted_signature;
n = p * q;
unsigned long long phi = (p - 1) * (q - 1);
// Choose public key exponent 'e' such that 1 < e < phi(n) and gcd(e,
phi(n)) = 1
printf("Enter public key exponent e: ");
scanf("%llu", &e);
return 0;
}
Algorithm:
1. Input the lower bound (min) and upper bound (max) of the desired range.
2. Use a random number generator function to generate a pseudo-random
number.
3. Scale and shift the generated number to fit within the specified range.
4. Output the generated pseudo-random number.
Program:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// Scale and shift the generated number to fit within the specified range
random_num = (random_num % (max - min + 1)) + min;
return random_num;
}
int main() {
int min, max, num;
return 0;
}
int main() {
char email[100];
return 0;
}
To check the devices connected to your internet network and monitor data
usage, you can follow these steps:
50. Write the steps to read Email Headers and identify them as
SPAM.
Reading email headers and identifying them as spam involves analyzing the
information contained in the headers and looking for indicators that suggest
the email may be spam. Below are the steps to read email headers and
identify them as spam:
6.Take Action:
- Once you have identified an email as spam, take appropriate action:
- Delete the email to prevent further interaction.
- Report the email as spam to your email provider or spam reporting
organization.
- Add the sender's email address or domain to your email client's blocklist
to prevent future emails from reaching your inbox.
- Educate yourself and others about common spam tactics and how to
recognize and avoid them.