Bcom 6 Sem (Cyber Security Record
Bcom 6 Sem (Cyber Security Record
Bcom 6 Sem (Cyber Security Record
1). What are the Roles and Responsibilities of System Administrator? Write
the steps for creating the User account, setting permissions and protecting
your files with password.
Ans:
Write the steps for creating the User account, setting permissions and
protecting your files with password.
Introduction:
In case there is no Active Directory or LDAP in your environment, you will need to add local
users to one or two of servers such as an FTP Servers.
Password-protect a folder
Using a password to protect a folder means that you need to enter a password to see the
list of documents in the folder.
Windows 7
Hide a folder
When you hide a folder or file in Windows, the folder or file does not appear in the directory
list, unless the Don't show hidden files, folders, or drives setting is unchecked.
Windows 7, 8, and 10
1. Right-click on the file or folder that you want to hide. Select Properties.
2. Click the General tab, under the Attributes section, check Hidden.
3. Click Apply.
If the file or folder remains visible in the directory, you will need to enable another setting.
To see your hidden files or folder, repeat the instructions above, but click Show hidden files,
folders, and drives.
Conclusion
Although Microsoft has taken away the ability to password-protect a folder, you can still keep your
confidential information private by using either a password-protected zipped folder or hiding files
and folders so they don't appear in the directory list.
2Q: Write the steps for disk partitioning and perform operations like shrinking,
Extending, deleting and formatting?
Ans:
After installing Windows 10, we need to partition hard drive in Disk Management to distribute more
free space for Windows 10 future use. If you have unallocated space on your hard drive, it's ok to
create partition with it without data loss, but if you have no such space available, you have to split
exist partition into partitions, in Windows 10 Disk Management, Delete Volume is the function you
shall use, which will not keep data when operating.
1. Create a new Partition
Steps of creating a new partition in Windows 10 Disk Management:
1. Press Windows bottom and type disk management in search box to open Disk
Management.
2. Right-click on unallocated space and select New Simple Volume; follow New Simple
Volume Wizard.
3. Confirm Simple Volume size, assign drive letter, format volume with file system, allocate
unit size (cluster size), Volume label, and perform a quick format, Finish.
When a new window pops up, it means you succeed, this window is file explorer of the volume you
created.
2. Merge partitions
Windows 10 Disk Management has no function called Merge Partitions, but we simulate it in Disk
Management, without the help of any third-party partition software, the thoery is to maunally copy
everything from one partition to another, delete one partition, merge the free space to another
• Delete Volume
• Extend Volume
1. Press Windows + E to open File Explorer, or in Disk Management right-click on the target
partition and click Explore
2. Press Ctrl+A to select all files and navigate into another Drive you’d like to merge, right-click
on an empty (blank) area and choose New and choose Folder, name it as “Merged Drive” or any
other name you prefer
3. Double-click to go into that folder and Ctrl+V to paste everything there, time spend on this
progress may vary according to the file size
4. Then in Disk Management, right-click on the we copied data from and choose Delete
Volume and confirm when prompted with the warning message to make this area unallocated
5. Then right-click on the other partition and choose Extend Volume to evoke to Extend Volume
Wizard
What is Ransomware
Ransomware is a subset of malware that can lock and encrypt data on a victim's computer.
Attackers then notify the victim that an exploit has occurred and the data will not be unlocked or
decrypted until a payment is received.
Types of Ransomware
• Locker blocks access to computers, and attackers require payment to unlock access.
• Crypto encrypts all or some files on a computer, and attackers require payment before
handing over a decryption key.
• Ransomware as a service (RaaS) occurs when cybercriminals can access malicious code
for a fee.
Ransomware vectors
Phishing
Phishing, which targets an organization by embedding malware in email, remains one of the most
popular ways for cybercriminals to deliver their payload.
Some of the most notable ransomware attacks include the following recent victims:
1. An attack on Colonial Pipeline led to a multiday disruption of the fuel supply for a large swath of
the East Coast. Colonial paid a $4.4 million demand to speed its recovery efforts. Some of that
payment, made in cryptocurrency, was later recovered by the U.S. government.
2. Global beef manufacturer JBS USA had to shutter operations for several days after it was hit
by a ransomware attack. The company paid attackers $11 million to ensure no data was
exfiltrated.
3. The Buffalo Public Schools system in New York ceased instruction -- in-person and online -- in
the wake of a crippling ransomware attack. The system required a week to get back on its feet
and resume classes.
How to recognize attacks
Here are three types of ransomware detection techniques:
• signature-based ransomware compares a sample hash gathered from suspicious activity to
known signatures;
• behavior-based ransomware examines new behaviors in relation to historical data; and
• deception uses a lure such as a honeypot that normal users wouldn't touch to catch
attackers.
• Patch regularly.
Installing open source software depends on your operating system. This is a how-to
compilation for multiple operating systems;
Microsoft Windows
Acknowledge that Windows is not a friend of open source software. This is also because it
does not come with the make build system, so compiling from source code is harder. You will
need to install a precompiled version.
ANS:
Set Chrome as your default web browser
Follwe Below Steps:
6Q. Write the steps to establish peer to peer network connection using two
systemsin a LAN
Ans:
Hardware You Will Need
1. At least two computers.
2. Network adapters for each computer.
3. If you have 10Base-T adapters, and only two computers, you can directly connect
one computer to the other with a crossover cable.
4. If you have 10Base-T adapters and more than two computers you will need a 10Base-T hub to
connect them.
Adding Your Network Adapter
1. With the computer off, install the NIC card in an open bay (Slot 1 is
recommended)
2. Start the Computer
3. Open up the Control Panel
4. Click on Add New Hardware
5. Click the Next button
6. You can either have Windows95 search for the adapter by selecting YES or select
NO to manually enter the adapter
7. Click the Next button
8. If you selected NO, you will need to manually select an adapter.
9. If you have a driver diskette for your network adapter, use it to install the
appropriate driver for your NIC card
7. Reboot if requested
1. Under Control Panel / Network / Identification make sure each Computer has a unique
name.
2. Make sure that the Workgroup name is the SAME for all computers.
Do not have any spaces in either the Computer or Workgroup names. Keep them simple.
3. If you have TCP/IP installed, select different IP address with the same subnet mask. You do
not need to fill in WINS, Gateway, or DNS IP addresses.
4. Click on the File and Print Sharing button and check off whether you want share Files or
Printers.
7Q: What is wifi? How do you configure the wifi on windows operating
system?
Ans:
Wifi:Wi-Fi is the wireless technology used to connect computers, tablets, smartphones and other
devices to the internet.Wi-Fi is the radio signal sent from a wireless router to a nearby device,
which translates the signal into data you can see and use. The device transmits a radio signal
back to the router, which connects to the internet by wire or cable.
Before you can set up your wireless network, here’s what you’ll need:
Wireless router. A router sends info between your network and the Internet. With a wireless
router, you can connect PCs to your network using radio signals instead of wires. There are
several different kinds of wireless network technologies, which include 802.11a, 802.11b, 802.11g,
802.11n, 802.11ac, and 802.11ax.
Wireless network adapter. A wireless network adapter is a device that connects your PC to a
wireless network. To connect your portable or desktop PC to your wireless network, the PC must
have a wireless network adapter.
Select Start , type device manager in the search box, and then select Device Manager.
After you have all the equipment, you'll need to set up your modem and Internet connection. your
Internet service provider (ISP), follow the instructions that came with your modem to connect it to
your PC and the Internet. If you're using Digital Subscriber Line (DSL), connect your modem to a
phone jack. If you're using cable, connect your modem to a cable jack.
Security is always important; with a wireless network, it's even more important because your
network's signal could be broadcast outside your home. If you don't help secure your network,
people with PCs nearby could access info stored on your network PCs and use your Internet
connection.To help make your network more secure.
Change the default user name and password. This helps protect your router. Most router
manufacturers have a default user name and password on the router and a default network name
(also known as the SSID). Someone could use this info to access your router without you knowing
it. To help avoid that, change the default user name and password for your router.
Set up a security key (password) for your network. Wireless networks have a network security
key to help protect them from unauthorized access. We recommend using Wi-Fi Protected Access
3 (WPA3) security if your router and PC support it. See the documentation for your router for more
detailed info, including what type of security is supported and how to set it up.
Some routers support Wi-Fi Protected Setup (WPS). If your router supports WPS and it’s
connected to the network, follow these steps to set up a network security key:
In Windows 10, select Start , then select Settings > Network & Internet > Status > Network
and Sharing Center.
Connect a PC to your wireless network In Windows 10
2. In the list of networks, choose the network that you want to connect to, and then
select Connect.
If you have problems with your Wi-Fi network when using Windows 10, see Fix Wi-Fi problems in
Windows for advanced troubleshooting info.
8Q. Write the steps to Install and configure Network Components like
switches,Hub and Modem and how do you connect to Dial-Up networking
Aim
(a)Installing a network using switches and Hub
(b)Modem Installation and Configuration
(c)Connecting to the Network using Dial-Up networking
Requirements:
Pentium IV Computer
8 port Hub
Modem
Windows XP Professional Edition
Procedure:
Result:
By following the above procedures, we can install hub,modem and configure
dialup networking successfully.
9Q. What are the features of firewall? Write the steps in providing network
securityand to set Firewall Security in windows.
Aim:
Establish security in a system using firewall configuration.
Requirements:
Pentium four Computer
Windows XP Professional Edition
Procedure:
Actions
Windows XP and Vista provide a built-in firewall component, which controls
the
programs that can access the Internet and the types of connections that they
can make. IfWindows Firewall doesn't permit Firefox to make connections,
Firefox generates a"Server not found" error when you try to browse to
websites.
Checking for Windows Firewall
1. If you're using Windows Firewall, you must verify that it is properly configured.
In the Windows Security Center, open the Windows Firewall settings dialog.
a. (Windows Vista) Click Windows Firewall. Then click Change settings.
You may receive a User Account Control pop-up. Click Continue.
2. Click the General tab.
3. Allow connections:
a. (Windows Vista) Deselect the checkbox for Block all
incomingconnections.
b. (Windows XP) Deselect the checkbox for Don't allow exceptions.
4. Click the Exceptions tab.
5. If Mozilla Firefox is listed, select it and click the Delete button.
6. In the Delete a Program dialog, click Yes.
7. Set Windows to alert you when it blocks a program:
a. (Windows Vista) Select the checkbox for Notify me when
WindowsFirewall blocks a new program.
b. (Windows XP) Select the checbox for Display a notification
whenWindows Firewall blocks a program
8. Click OK.
9. Now, try browsing to a website with Firefox. You may receive a Windows
Security Alert dialog asking if you want to block Firefox. Click Unblock.
Result:
By following the above procedure, we can establish security in a system using
firewall configuration.
11Q. What do you mean by Spooling Printers? Write the Steps for Spooling
Printers.
Spooling allows programs to "hand off" work to be done by the peripheral and then
proceed to other tasks, or to not begin until input has been transcribed. A dedicated
program, the spooler, maintains an orderly sequence of jobs for the peripheral and
feeds it data at its own rate.
To access the Print Spooler you must open the Local Services console.
STEP 1: Click the Windows "Start" button, right-click "Computer" and choose
"Manage" from the context menu.
STEP 3: Scroll down and double-click the "Print Spooler" service to open its
Properties window.
STEP 4: Select "Automatic" in the Startup Type drop-down menu and click the
"Start" button to enable printer
STEP 5: Click "OK" to close the Properties window, and close the Computer
Management window.
Start by opening the Start menu of Windows OS. You can do so by pressing the
Windows key on your keyboard.
Otherwise, you can move your pointer to the bottom left corner of the desktop and
click on the Start icon.
Once the start menu opens, type “cmd”. Cmd is the short form of Command Prompt.
Once you finish typing, you must see the Command Prompt application listed on the
screen.
Step 4 – Stopping Printer Spooler Service in the command prompt, type the
command “net stop spooler” and press the Enter key. You will see a message on
the command prompt “The print spooler service is stopping”. After some time, you
will see another message confirming “The print spooler service stopped
successfully”.
Step 5 – Delete The Pending Orders Now that the spooler has stopped working, you
have to ensure that when the spooler service restarts, it does not print the previously
stopped order and pending orders.
Youmay be seeing a pop-up box asking for permission. Click on the Continue
button.
Now, you need to delete all the entries that you find inside the PRINTERS folder.
Remember not to delete the
PRINTERS folder.
Step 6 – Restart The Spooler Service.
Ans:
#include <stdio.h>
#include <string.h>
len=strlen(sourceString);
for(i=0;i<len;i++)
{
if(sourceString[i]!='.')
{
buf[cnt++] =sourceString[i];
}
if(sourceString[i]=='.' || i==len-1){
buf[cnt]='\0';
cnt=0;
oct[cnt1++]=atoi(buf);
}
}
ipAddress[0]=oct[0];
ipAddress[1]=oct[1];
ipAddress[2]=oct[2];
ipAddress[3]=oct[3];
}
int main()
{
unsigned char ip[20]={0};
shortipAddress[4];
extractIpAddress(ip,&ipAddress[0]);
printf("\nIp Address: %03d. %03d.
%03d.%03d\n",ipAddress[0],ipAddress[1],IpAddress[2],ipAddress[3]);
if(ipAddress[0]>=0 &&ipAddress[0]<=127)
printf("Class A Ip Address.\n");
if(ipAddress[0]>127 &&ipAddress[0]<191)
printf("Class B Ip Address.\n");
if(ipAddress[0]>191 &&ipAddress[0]<224)
printf("Class C Ip Address.\n");
if(ipAddress[0]>224 &&ipAddress[0]<=239)
printf("Class D Ip Address.\n");
if(ipAddress[0]>239)
printf("Class E Ip Address.\n");
return 0;
}
Output
Enter IP Address (xxx.xxx.xxx.xxx format): 145.160.017.001
Class.
#include <bits/stdc++.h>
using namespace std;
voidprintStrongNess(string& input)
{
int n = input.length();
// Checking lower alphabet in string
boolhasLower = false, hasUpper = false;
boolhasDigit = false, specialChar = false;
stringnormalChars = "abcdefghijklmnopqrstu"
"vwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 ";
for (inti = 0; i< n; i++) {
if (islower(input[i]))
hasLower = true;
if (isupper(input[i]))
hasUpper = true;
if (isdigit(input[i]))
hasDigit = true
size_t special = input.find_first_not_of(normalChars);
if (special != string::npos)
specialChar = true;
}
// Strength of password
cout<< "Strength of password:-";
if (hasLower&&hasUpper&&hasDigit&&
specialChar&& (n >= 8))
cout<< "Strong" <<endl;
else if ((hasLower || hasUpper) &&
specialChar&& (n >= 6))
cout<< "Moderate" <<endl;
else
cout<< "Weak" <<endl;
}
// Driver code
int main()
{
string input = "cyberpassWord!@12";
printStrongNess(input);
return 0;
}
Output:
Strength of password:-Strong
Q14. Write Steps to transfer files between Wireless Communication using Blue
Tooth and FTP.
Ans
This process is actually a bit easier but will drastically vary, depending on the operating
system you’re using. However,
most platforms have developed a very user-friendly process for sending files via Bluetooth. I’ll
demonstrate using Blueman , which should illustrate how easy sharing files can be.
Here’s the process:
Step 1. Open up the Bluetooth app (in this case, Blueman)
Step 2. Set the device to share files as trusted (right-click the device and select Trust, as shown in
Figure E)
Step 3. Right-click the trusted device, and select Send a File
Step 4. Locate and select the file to be sent, and click OK
Step 5. If prompted on your smartphone, tap to allow the transfer.
Bluetooth adapter is available on your desktop, you can make this process even easier by
taking advantage of the Android built-in sharing system.
Share a photo, video, or other kind of file with a friend who has a phone, laptop, or tablet.
Step 1. Make sure the other device you want to share with is paired with your PC, turned on, and
ready to receive
files. Learn how to pair.
Step 2. On your PC, select Start > Settings > Devices > Bluetooth & other devices.
Step 3. In Bluetooth & other devices settings, select Send or receive files via Bluetooth.
Step 4. In Bluetooth File Transfer, select Send files > choose the device you want to share to >
Next.
Step 5. Select Browse > the file or files to share > Open > Next (which sends it) > Finish.
Step 6. On the receiving device, have your friend accept the file. See Receive a file over
Bluetooth.
The procedure below will work with current versions of Internet Explorer and Firefox for
Windows. To transfer files via FTP using your web browser in Windows:
Consequence of attack:
The malware attack was done on the critical communication systems between the various
payment gateways after which an amount estimated to be INR 78 crore was withdrawn
“physically” through 12,000 ATM transactions outside India, while another 2,800 transactions were
made in different corners of the country, worth an estimated INR 2.5 crore. It was observed that
unusual repeated transactions were taking place through Visa and Rupay cards used at various
ATMs for nearly two hours. On August 13, INR 13.5 crore was transferred by the hackers to the
Hong Kong-based Hanseng bank, using the Society for Worldwide Interbank Financial
Telecommunication (SWIFT) facility. As per the payment settlement system, Visa and Rupay had
raised demands for payment for all of the fraudulent transactions and as per the agreement the
bank had to pay a total amount of INR 80.5 Cr to them.Regarding the transaction of transfer of
money (INR 13.92 Cr) to a Hong Kong based bank.
Reasons of the attack:Investigations showed that the cyber-criminals had made enough and
extremely through background surveillance of the cosmos banking infrastructure first.. The
researchers concluded that the heist would be very visible from the bank audit report generated by
the system itself.Also a few days prior to the attack, the American FBI had warned banks of a
major hacking threat to ATMs worldwide and despite increased awareness and spend,
organizations have proven themselves largely unprepared for a more organized, strategic and
persistent threat.
Technical Loopholes: It has been stated that the bank may have failed to adequately invest in its
SOC (Security Operation Center), which should have analyzed the traffic coming in. An analysis
was made that the bank’s fraud detection mechanism was non- existent as there should’ve been
red alerts when so many overseas transactions were taking place at such a short span of time.
However, in its statement the bank contended it had adequate IT security in place.
Results/Pending investigation:The Special Investigating Team (SIT) had recovered INR 10.25
Cr that was lost in the heist as was revealed on August 2018.The Hong Kong based bank ‘Hang
Seng bank’ also returned INR 5.72 Cr in the first installment to Cosmos bank. The police also
recovered INR 4 Lakh from genuine Cosmos cardholders, who had visited ATMs when the
malware was active and withdrew more money than their account balance.
Impact on the business of the bank:The bank was neither penalized for its weak cyber-security
nor has anyone been held accountable. This highlights the need for RBI to enforce its cyber
guidelines for cooperative banks as strictly as it has for commercial banks. Extensive audit reports
had been called for.The bank's annual report reported total amount involved in the attack to be
INR 100. 22 crore, including exchange loss on payment settlement. That was not the only impact.
The bank says that “the cyber-attack and restoration of payment systems back to normalcy
caused an impact on the customers and their transactions.
Timeline of refund by Pune police:
January 2020 Rs 8.37 lakh
February 2020 Rs 5.98 crore
March 2020 Rs 27.25 lakh
April 2020 Rs 50.52
Q21. What is Malware? Write Steps to remove the malware from your PC
Ans :
Malware, or malicious software, is any program or file that is intentionally harmful to a
computer, network or server.
Types of malware include computer viruses, worms, Trojan horses, ransomware and spyware.
These malicious programs steal, encrypt and delete sensitive data; alter or hijack core
computing functions and monitor end users'
computer activity.
Types of malware :
Virus, Worm, Trojan horse, Spyware , Ransomware , Rotkit , Back door, Adware ,
keyloggers
Steps to remove Malware from PC
22Q. What are the various types of Vulnerabilities for hacking the Web
Applications.
ANS:
Most Common Website Security Vulnerabilities
1. SQL INJECTIONS
SQL injection is a type of web application security vulnerability in which an attacker attempts to
use application code to access or corrupt database content. If successful, this allows the attacker
to create, read, update, alter, or delete data stored in the back-end database. SQL injection is one
of the most prevalent types of web application security
vulnerabilities.
2. CROSS SITE SCRIPTING (XSS)
Cross-site scripting (XSS) targets an application's users by injecting code, usually a client-side
script such as JavaScript, into a web application's output. The concept of XSS is to manipulate
client-side scripts of a web application to execute in the manner desired by the attacker. XSS
allows attackers to execute scripts in the victim's browser which can hijack user sessions, deface
websites or redirect the user to malicious sites.
3. BROKEN AUTHENTICATION & SESSION MANAGEMENT
Broken authentication and session management encompass several security issues, all of them
having to do with maintaining the identity of a user. If authentication credentials and session
identifiers are not protected at all times, an attacker can hijack an active session and assume the
identity of a user.
4. INSECURE DIRECT OBJECT REFERENCES
Insecure direct object reference is when a web application exposes a reference to an internal
implementation object.
Internal implementation objects include files, database records, directories and database keys.
When an application exposes a reference to one of these objects in a URL, hackers can
manipulate it to gain access t o a user's personal data.
5. SECURITY MISCONFIGURATION
Security mis configuration encompasses several types of vulnerabilities all centered on a lack of
maintenance or a lack of attention to the web application configuration.
A secure configuration must be defined and deployed for the application, frameworks,
application server, web server, database server and platform. Security mis configuration gives
hackers access to private data or features and can result in a complete system compromise.
6. CROSS-SITE REQUEST FORGERY (CSRF)
Cross-Site Request Forgery (CSRF) is a malicious attack where a user is tricked into
performing an action he or she didn't intend to do. A third-party website will send a request to a
web application that a user is already authenticated
against (e.g. their bank). The attacker can then access functionality via the victim's already
authenticated browser. Targets include web applications like social media, in browser email
clients, online banking, and web interfaces for
network devices. Don't get caught with your guard down. Practice safe website security measures
and always be ready to protect yourself, and your company's future, from an attack that you might
never recover from. The best way to tell if your
website or server is vulnerable is to conduct regular security audits.
Simple Ways to improve Web Security
1. KEEP YOUR SOFTWARE UP-TO-DATE
It is crucial to keep all platforms or scripts you've installed up-to-date. Hackers aggressively target
security flaws in
popular web software, and the programs need to be updated to patch security holes. It is important
to maintain and
update every software product you use.
2. ENFORCE A STRONG PASSWORD POLICY
It is important to use strong passwords. Hackers frequently utilize sophisticated software that use
brute force to crack passwords. To protect against brute force, passwords should be complex,
containing uppercase letters, lowercase letters, numerals, and special characters. Your passwords
should be at least 10 characters long. This password policy
should be maintained throughout your organization.
3.ENCRYPT YOUR LOGIN PAGES
Use SSL encryption on your login pages. SSL allows sensitive information such as credit card
numbers, social security numbers, and login credentials to be transmitted securely. Information
entered on a page is encrypted so that it's meaningless to any third party who might intercept it.
This helps to prevent hackers from accessing your login
credentials or other private data.
4. USE A SECURE HOST
Choosing a secure and reputable web hosting company is very important to your website security.
Make sure the host you choose is aware of threats and devoted to keeping your website secure.
Your host should also back up your data to a remote server and make it easy to restore in case
your site is hacked. Choose a host who offers ongoing technical
support whenever necessary. CommonPlaces offers secure, reliable hosting for our customers.
24Q. List various Mobile Security Apps. Write the Steps to install and use one
of the Mobile Security App.
Mobile application security focuses on the software security posture of mobile apps on various
platforms like Android,
iOS, and Windows Phone.
25Q.Write the algorithm for encoding and decoding the Hash-Based Message
Ans:
Authentication Code(HMAC)
HMAC algorithm stands for Hashed or Hash-based Message Authentication Code. It is a result of
work done on developing a MAC derived from cryptographic hash functions. HMAC is a great
resistance towards cryptanalysis attacks as it uses the Hashing concept twice. HMAC consists of
twin benefits of Hashing and MAC and thus is more secure than any other authentication code.
RFC 2104 has issued HMAC, and HMAC has been made compulsory to implement in IP security.
The FIPS 198 NIST standard has also issued HMAC.
What is the MD5 Algorithm?
MD5 (Message Digest Method 5) is a cryptographic hash algorithm used to generate a
128-bit digest from a string of any length. It represents the digests as 32 digit hexadecimal
numbers. Ronald Rivest designed this algorithm in 1991 to provide the means for digital signature
verification.
There are four major sections of the algorithm:
Padding Bits
When you receive the input string, you have to make sure the size is 64 bits short of a
multiple of 512. When it comes to padding the bits, you must add one(1) first, followed by zeroes
to round out the extra characters.
Padding Length
You need to add a few more characters to make your final string a multiple of 512. To do
so, take the length of the initial input and express it in the form of 64 bits. On combining the two,
the final string is ready to be hashed.
Initialize MD Buffer
The entire string is converted into multiple blocks of 512 bits each. You also need to
initialize four different buffers, namely A, B, C, and D. These buffers are 32 bits each and are
initialized as follows:
A = 01 23 45 67
B = 89 ab cd ef
C = fe dc ba 98
D = 76 54 32 10
Process Each Block
Each 512-bit block gets broken down further into 16 sub-blocks of 32 bits each. There are
four rounds of operations, with each round utilizing all the sub-blocks, the buffers, and a constant
array value.
AIM:
Write a Client program to download a file from HTTP server.
Algorithm:
Algorithm for Server:
1. Create a socket for transferring data
2. Get the hostname of the client
3. Bind the socket
4. Accept the connection request
5. Receive the message send by the client and process the message and send
the message to client.
Algorithm for Client:
1. Create a socket for transferring data
2. Get the hostname of the server
3. Connect the socket to the remote system.
4. Send a message to the server.
Program:
// Implementation of TCP/IP
// Server Program
#include <unistd.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <string.h>
#include <sys/socket.h>
#include <stdio.h>
int main()
{
intsd,nsd,i,port=6200;
char c[30]=”/0”,fname[30];
structsockaddr_inser;
structsodkaddr_in cli;
FILE*fp;
if ((sd=socket(AF_INET,SOCK_STREAM,0))<0)
{ printf (“\nError:Socket Creation”);
return 0;
}
bzero((char*)&ser,sizeof(ser);
printf(“\nPort Address is %d”,port);
ser.sin_family=AF_INET;
ser.sin_port=htons(port);
ser.sin_addr.s_addr=htonl(INADDR_ANY);
Prepared By : C.ChellaPandian /SL 38 V Semester
Department of Computer Engineering Computer networks & Security Lab
if (bind(sd,(structsockaddr*)&ser,sizeof(ser))<0)
{ printf(“\nError:Binding”);
return 0;
}
i=sizeof(cli);
listen(sd,1);
printf(“\nServer Module\n”);
nsd=accept(sd,(sd,(structsockaddr*)&cli).&i);
if (nsd==-1)
{ printf(“\nError:Client accepts the problem”);
return 0;
}
printf(“\nClient accepted\n”);
i=recv(nsd,fname,30,0);
fname[i]=’\0’;
fp=fopen(fname,”rb”);
printf(“File Reading….\n”);
while(1)
{
i=fread(&c,1,30,fp);
c[i]=’\0’;
send(nsd,c30,0);
printf(“%s”,c);
strcpy(c,”\0”);
if(i<30)
break;
}
send(nsd,”EOF”,4,0);
printf(“\nFile has been Transferred”);
fclose(fp);
close(sd);
close(nsd);
return 0;
}
// Client Program
#include <unistd.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <string.h>
#include <sys/socket.h>
#include <stdio.h>
#include <arpa/inet.h>
int main()
{
intsd,nsd,i,port=6200;
char c[30]=”/0”,fname[30];
structsockaddr_inser;
Prepared By : C.ChellaPandian /SL 39 V Semester
Department of Computer Engineering Computer networks & Security Lab
FILE*fp;
if ((sd=socket(AF_INET,SOCK_STREAM,0))<0)
{
printf(“\nError:Socket Creation”);
return 0;
}
bzero((char*)&ser,sizeof(ser));
printf(“\nPort Address is %d”,port);
ser.sin_family=AF_INET;
ser.sin_port=htons(port);
ser.sin_addr.s_addr=htonl(INADDR_ANY);
if (connect(sd,(structsockaddr*)&ser,sizeof(ser))==-1)
{
printf(“\nError:Binding”);
return 0;
}
Printf(“client module\n”);
Printf(“Enter the source filename”);
Scanf(“%s”,fname);
Printf(“Enter the destination filename”);
Scanf(“%s”,file);
send(sd,fname,30,0);
fp=fopen(file,’w’);
printf(“receiving…\n”);
while(1)
{
i=recv(sd,c,30,0);
c[i]=’\0’;
printf(“%s”,c);
if(!strcmp(c,”EOF”))
break;
fwrite(&c,strlen(c) ,1,fp);
strcpy(c,”\0”);
}
printf(“\nFile has been Transferred”);
fclose(fp);
close(sd);
return 0;
}
Output
:
By following the above program, we can download a file from HTTP server.
33Q: Write an algorithm and program for encrypting a plain text and decrypting a cipher
text using Caesar Cipher?
Ans:
35Q). Write RSA algorithm and Program to implement RSA Standard for
encryptionand decryption?
Ans:
#include<stdio.h>
#include<math.h>
//to findgcd
intgcd(int a, int h)
{
int temp;
while(1)
{
temp = a%h;
if(temp==0)
return h;
a = h;
h = temp;
}
}
int main()
{
//2 random prime numbers
double p = 3;
double q = 7;
double n=p*q;
double count;
double totient = (p-1)*(q-1);
//public key
//e stands for encrypt
double e=2;
//private key
//d stands for decrypt
double d;
return 0;
}#include<stdio.h>
#include<math.h>
//to findgcd
intgcd(int a, int h)
{
int temp;
while(1)
{
temp = a%h;
if(temp==0)
return h;
a = h;
h = temp;
}
}
int main()
{
//2 random prime numbers
double p = 3;
double q = 7;
double n=p*q;
double count;
double totient = (p-1)*(q-1);
//public key
//e stands for encrypt
double e=2;
return 0;
Output
ANS:
Email is the dream delivery platform for any and all types of cyberattacks; it provides a
mechanism capable of placing almost any kind of threat in front of almost any target.
Attackers use email to send malicious software attacks to an end user. Even when filters
are able to find potentially unwanted programs, attackers can still fall back to time-tested social
engineering tactics to convince victims to take actions against their own interests.
For decades, email has been the predominant end-user network application, so it should be
no surprise that attackers have focused their attention on exploiting email security threats. While
the attack techniques have become much more sophisticated over the years, security teams have
long understood the fundamentals of email security threats.
While the forms and intentions of email security threats have morphed many times, from
sowing chaos and denial of service via spam campaigns to today's dominant threats of
ransomware and email fraud, the email security threats themselves still generally fall into three
categories:
• Malware delivery
• Phishing
• Domain spoofing
Malware delivery:
Ever since email applications began to include attachments, file attachments have been
used to deliver malware. Once email applications began to support executable content using the
same types of content that are offered on the web, attackers quickly learned to subvert that
content with malicious code.
Phishing:
Phishing, in all its forms, is the practice of using email or other types of messaging
applications to carry out social engineering campaigns in an effort to convince the victim to
perform some action. Ordinary phishing campaigns spread generic phishing emails to a broad
spectrum of potential targets in order to harvest user credentials or infect users' systems with
ransomware by prompting them to click on malicious links.
Domain spoofing:
Spoofing domains is a common tactic attackers use against email users. The domain being
spoofed may be in the headers of a message to try to fool the recipient into believing that the
email originated from a known domain. For example, an attacker may send a phishing message
that appears to have originated from the recipient's employer, bank or other trusted source.
37.What is SQL Injection? Write steps for SQL Injection attack on Insert, Update
and Delete?
ANS:
SQL injection is a web security vulnerability that allows an attacker to interfere with the
queries that an application makes to its database. It generally allows an attacker to view
data that they are not normally able to retrieve. This might include data belonging to other
users, or any other data that the application itself is able to access. In many cases, an
attacker can modify or delete this data, causing persistent changes to the application's
content or behavior.
There are a wide variety of SQL injection vulnerabilities, attacks, and techniques, which
arise in different situations. Some common SQL injection examples include:
Retrieving hidden data, where you can modify an SQL query to return additional results.
Subverting application logic, where you can change a query to interfere with the
application's logic.
UNION attacks, where you can retrieve data from different database tables.
Examining the database, where you can extract information about the version and structure
of the database.
Blind SQL injection, where the results of a query you control are not returned in the
application's responses.
Most SQL injection vulnerabilities arise within the WHERE clause of a SELECT query. This
type of SQL injection is generally well-understood by experienced testers.
But SQL injection vulnerabilities can in principle occur at any location within the query, and
within different query types. The most common other locations where SQL injection arises
are:
ANS:
#include <stdio.h>
// Function to compute `a^m mod n`
int compute(int a, int m, int n)
{
int r;
int y = 1;
while (m > 0)
{
r = m % 2;
// fast exponention
if (r == 1) {
y = (y*a) % n;
}
a = a*a % n;
m = m / 2;
}
return y;
}
// choose a secret integer for Alice's private key (only known to Alice)
a = 6; // or, use `rand()`
// choose a secret integer for Bob's private key (only known to Bob)
b = 15; // or, use `rand()`
// Alice and Bob Exchange their public key `A` and `B` with each other
return 0;
}
39Q.Write an RSA algorithm and Program to implement digital Signature
Scheme?
ANS:
#include<stdio.h>
#include<math.h>
// Message to be encrypted
Double msg = 20;
// Encryption c = (msg ^ e) % n
double c = pow(msg, e);
c = fmod(c, n);
printf("\nEncrypted data = %lf", c);
// Decryption m = (c ^ d) % n
double m = pow(c, d);
m = fmod(m, n);
printf("\nOriginal Message Sent = %lf", m);
return 0;
}