0% found this document useful (0 votes)
104 views88 pages

Cyber Security PDF

Uploaded by

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

Cyber Security PDF

Uploaded by

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

6.

program

Peer to Peer Network Sharing:-

Step 1: Navigate to the Desktop:-


 Open command prompt and then use the command <cd Desktop> to change into the
desktop directory. This step is simply for convenience so that it is easier to find the
folder you're going to be working with .
 we can open command prompt by clicking on the windows button at the bottom left
and tying <cmd>.

Step 2: Create Your Folder:-


 Use the command <md *folder name*> .
 Make sure that it is visible on your desktop.
 The command md allows you to create a new folder. After tying md press space and
type the name of the folder you want to create. If the folder has more than one word in
the name make sure to put the name in quotation marks.

Step 3: Navigate to the Folder and Open the Properties:-


 Open the file explorer and go under the Desktop section.
 Left-click then right-click on the folder. The left-click highlights the folder, and the right-
click opens a menu of options. Once the menu of options pops up click on the properties.

Step 4: Choose Who You Want to Share With:-


 Type <Everyone> and click add [3]. Once you're done with that click share and then go
to the advanced sharing.
 The default setting for the folder is set to only read. This means that if a person accesses
the folder they will only be able to view the files and not actually be able to write to the
folder.
Step 5: Sharing the Folder:-
 Press the box that lets you share the folder and then go into the permissions section.

Step 6: Permissions
 Make sure to give full control to the people that have access to the shared folder. Click
Apply then click OK. Once you press OK you'll be back at the advanced sharing page.
Press Apply and OK on that page too.

Step 7: Open Control Panel


 Navigate into the control panel and click on the Network and Internet section.

Step 8: Network and Sharing


 Navigate into the Network and Sharing section.

Step 9: Advanced Sharing


 Navigate to the advanced sharing settings.

Step 10: Choose Home and Work / Public


 There are many settings that need to be changed in both of the options.

Step 11: Select All Options


 There are going to be many options, the ones you need for the sharing to work are
pretty common sense like making sure that your device is allowed to be discovered. And
turn off password protected sharing.

Step 12: Go Into Network


 Go onto another computer and open the file explorer. Go into the Network section found
on the left hand side at the bottom.
Step 13: Find the Device
 Find the original device that the file was shared from.

Step 14: Find the Folder That Was Shared


 Once you click on the device you will find all the files that were shared from it. You can
tell that the folder is shared over the network because it has the green crossroads
looking thing under its name.

7.program
 Connect to a Wi-Fi network in Windows
 Whether you're at home, work, or out and about, chances are you'll find a Wi-Fi network
that we can connect to for internet access.
1. Select the Network icon on the taskbar. The icon that appears depends on your
current connection state. If you don’t see one of the network icons (or a similar one)
shown in the following image, select the Up arrow to see if it appears there.
2. Choose the Wi-Fi network you want, then select Connect.
3. Type the network password, and then select Next.
4. Choose Yes or No, depending on the type of network you're connecting to and if
you want your PC to be discoverable by other PCs and devices on the network.

8. program

a)configuring switches

Step 1: Inspect your hardware:-


 Check the model number of your shiny new switch. Or, if you are using a spare, check
the device hardware and its connected cables for any damages. If everything checks out,
power on the switch and verify that all the indicator lights are in working order. Next,
use a rollover cable to console into the switch from your computer. To do this, you will
need to download and install Putty (or a similar, fun-named software tool). Run Putty
and select the 9600 speed serial connection.

Step 2: Set up management IP


 Unlike with that punny name you gave your home Wi-Fi network, when setting up the
hostname for your switch you should probably stick to a more professional and
standard naming convention. Follow any preset naming assignment your company is
using and then assign an IP address on the management VLAN. Next, make sure your
switch has a set hostname and domain name:

Step 3: Check VTP revision number


 Hit the show vtp status command to reveal your Virtual Trunking Protocol (VTP)
revision numbers. The VTP revision numbers determine which updates are to be used in
a VTP domain. When you set a VTP domain name, the revision number is set to zero—
after which each change to the VLAN database increases the revision number by one.
Your switch will only process data from a neighboring switch coming from the same
domain and if the revision number of the neighboring switch is higher than its own. This
means that the switches will update their VLAN configuration based on the VTP
information being sent by the switch with the highest revision number.
 So, before you add your switch to the network, you’re going to want to set its revision
number to zero. To easily reset the domain back to zero, change the config mode to
transparent:

Step 4: Configure access ports


 You might already have a template ready for access port configuration, but in case you
don’t, here are some commands you should use:

Step 5: Configure trunk ports


 Enter the command sh int g0/1 capabilities and check the trunking protocol supported.
If ISL is supported, you have to issue the switchport trunk encapsulation dot1q on the
trunk port configuration. If not, simply type switchport mode trunk. It means there is no
other encapsulation supported so there is no need for an encapsulation command. It
only supports 802.1Q.

Step 6: Configure access ports


 After already performing basic network switch configurations, it’s time to generate RSA
keys to be used during the SSH process, using the crypto commands shown here:
 Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose
Keys. Choosing a key modulus greater than 512 may take a few minutes.

Step 7: Set up VTY line configure


 If you have not set the console line yet, you can easily input these values:
 Set the enable password using the enable secret password command. Then, set the
privilege exec password with username name privilege 15 secret password. Make sure
that the password-encryption service is activated.
 Verify SSH access by typing ‘shipssh’ to confirm that the SSH is enabled. You can now try
to log in from a remote machine to verify that you can ssh to your Cisco switch.

Make sure that your modem will work with your Internet subscription. While rare, some
modems encounter issues when paired with a specific Internet company (e.g., Comcast).
Double-check your modem's compatibility with your current Internet subscription before
buying (if possible).
If you find that your modem won't work with your current subscription, try to exchange the
modem for a different one that will work, or switch your Internet subscription.

2.Find your room's cable output. The cable output resembles a metal cylinder with a small
hole in the middle and screw threads all around the sides. You'll usually find cable outputs in the
wall near the floor in living rooms and bedrooms.
In some cases, there will already be a cable connected to the cable outlet.

3.Decide on a place to mount the modem. The modem should be relatively high up (e.g., on
top of a bookshelf), and it will need to be close enough to the cable output that you can connect
it without stretching or bending the cable.
You'll also need to have a power outlet nearby.

4.Make sure that you have all of the required cables. A modem generally requires a coaxial
cable to connect to the cable output, as well as a power cable to connect to an electrical outlet.
Both of these cables should come with your modem, but if you bought it used, you may need to
find replacement cables.
If you plan on attaching the modem to a router, you will also need an Ethernet cable.
Consider buying a longer coaxial cable if the one that you have is too short to allow you to
mount properly your modem.

5.Read your modem's instructions. Each modem is unique, and yours may require additional
setup outside of this article's capacity. Reading your modem's manual will help make you aware
of any additional steps that you have to take to install the modem.
Installing

6.Attach one end of the coaxial cable to the cable output. The coaxial cable has a connection
that resembles a needle on each end. This will plug into the cable output. Make sure that you
screw the coaxial cable onto the cable outlet to ensure that the connection is solid.

7.Attach the other end of the cable to the input on your modem. On the back of the modem,
you should see an input that resembles the cable output cylinder. Attach the free end of the
coaxial cable to this input, making sure to tighten as needed.

8.Plug your modem's power cable into an electrical outlet. A wall socket or a surge
protector will do. It's important to plug the cable into the power outlet before connecting it to
the modem, since connecting the power cable to the modem first can cause damage.

9.Insert the modem power cable's free end into the modem. You'll usually find the power
cable input port at the bottom of the back of the modem, but check your modem's
documentation to confirm if you can't find the power port.

10.Place your modem in its spot. With the cables attached, gently move your modem into its
designated position. You shouldn't feel any resistance from the cables.

11.Attach the modem to a router. If you have a Wi-Fi router that you want to use in
conjunction with your modem, plug one end of an Ethernet cable into the square port on the
back of the modem, then plug the other end into the "INTERNET" (or similarly labeled) square
port on the back of the router. As long as the router is plugged into a power source, the router
should immediately light up.
Give your modem and router a few minutes to boot up before attempting to connect to Wi-Fi.
You can also connect your computer directly to your modem via Ethernet if you have an
Ethernet port enabled computer (ex. A PC or Ethernet Adapter for most Macs)

b)How to Set up an Hub


When expanding an existing computer network or building a new one, one of the many devices
that can be used in the process is an Ethernet hub. A hub is a simple device that connects
multiple computers together and to the rest of the network, allowing communication to occur
between all connected devices. When there is no need for the enhanced functions available on a
router or the higher communications speed of a switch, an Ethernet hub can be an efficient way
to create or expand a network at a lower cost when compared to a router or switch.
Step 1
 Find the WAN or uplink port of the Ethernet hub. Typically, it is located on the rear of
the unit, and it is often separate from the LAN ports.
Step 2
 Connect an Ethernet cable from the WAN port of the hub to either the Ethernet port of
the internet modem or, if expanding a network, to an empty LAN port on the existing
network’s router, switch or hub.
Step 3
 Plug an Ethernet cable into one of the LAN ports on the Ethernet hub and connect the
other end of cable to the computer or device that will be added to the network. Repeat
for any other devices that will need to be on the network.
Step 4
 Power up the Ethernet hub and the computers or other devices attached to it. On the
front of the hub will be a series of LEDs that correspond to each LAN and WAN port on
the hub. Every port that has a cable plugged into it should have one or more of the LEDs
lit that represent that port. If not, check the connections and swap out the Ethernet cable
if necessary.

Step 5
 Configure the network settings on each connected computer. If you are expanding a
network and the network uses DCHP, or dynamic IP addressing, no configuration will be
necessary. On networks using static IP addressing or on a new network setup using the
Ethernet hub, each computer or device must be assigned a unique IP address. Local IP
addresses must use the allowed “private” address pools that will not interfere with
internet addresses. Acceptable addresses include 192.168.x.x, 172.16.x.x to 172.31.x.x,
or 10.x.x.x. The “x” represents a number that is chosen by the user, from 0 to 254. All
computers on the network should share the first three numbers in the address, with the
final number representing the individual computer. In a network with three computers,
for example, the first could be 192.168.1.1, the second could be 192.168.1.2 and the
third could be 192.168.1.3, though the final number does not need to be sequential.
Step 6
 Click the “Start” button in Windows, select “Control Panel" and double-click the icon
labeled “Network Connections.”
Step 7
 Right-click the icon for the Ethernet adapter and select “Properties.” Click on the check
box marked “Internet Protocol (TCP/IP)” and press the “Properties” button.
Step 8
 Select the radio button labeled “Use the following IP address.” Enter a unique IP address
for the computer and the applicable subnet mask. If a router is used on the network,
enter the router’s IP address as the default gateway. Press the “OK” button and reboot if
necessary.
Step 9
 Enable file and printer sharing from the “Properties” dialog for the Ethernet card if files
will be transferred between the networked computers.
Step 10
 Click the “Start” button, select “Control Panel” and double-click on the “System” icon.
Select the “Computer Name” tab and click on the button labeled “Change” to set the
computer’s network name. In the “Computer Name” box, enter a unique name for the
computer. In the “Member of” section, choose the radio button marked “Workgroup”
and enter the workgroup of the network. If setting up a new network, this name can be
change but all computers on the network must share the same workgroup name.
Step 11
 Verify that all computers can access the network and the Internet if connected.

c)How to setup a dial up internet connection

1.Call an internet service provider (Bell, Rogers, Wightman Telecom) to obtain your
internet service. While you are on the phone setting up your account the customer care person
should then give you a user name, phone number, and a password. This is so you can log on
securely.

2.Make sure your PC is plugged in. Connect a telephone cord from the back of your PC to the
Telephone jack outlet located on the wall of the room you are in. Turn your PC power on.

3.Go to the control panel. When your PC is finished starting up, you should be on your main
desktop page. You should also see various icons. Look for the icon that is named “my computer”.
Enter my computer. When you enter you should see a small square panel to left of your screen
that says “other places”. In that panel are 4 items you can click on. Click on the one that says
“control panel”.

4.Go to network connections. In the control panel you will see various icons. The control panel
lets you change the settings of your computer such as; adding new software to your computer,
changing your mouse icon, adding a new user to the computer, or in this case creating/editing
your internet account. While in the control panel, look for the icon that says “network
connections”. Double click the icon to enter it.

5.Create a new connection. On this screen you will see basically nothing. Look to the upper left
hand side of your screen, you should see a small square panel that says “network tasks”. In this
panel there is a small icon with the words “create a new connection”. Enter this icon.

6.A small window will pop up, just click the next button once.
7.There are 4 bulletins to choose from. Since this is a dial-up connection that is being set up.
Click on the one that says “connect to the internet”. Then click the next button.
8.There are now 3 bulletins you can click on, click the one that says “set up my connection
manually”. Click the next button.

9.Another set of 3 bulletins will appear, click on “connect using a dial up modem”. Then
click the next button.

10.You will now be asked to type in your internet’s ISP name. You may name this whatever
you want to name it. (Ex, Your name, last name, nickname) Type in your ISP name then click the
next button.

11.Now you will be asked to type in a phone number (The number you type in will be the
number that you got from customer care while you were setting up your account in step
1) Type in the phone number and click the next button.

12.Now you will see 3 boxes, one asks for your user name. The other two are for your
password. Type in your user name. (You got your user name while you were on the phone with
your internet service provider in step 1) Do the same process for the password. Once you have
filled in the 3 boxes click the next button.

13.The setup will now tell you that you have completed setting up the internet
connection. Click the finish button.

10.program
Installation of system software

Installing from a CD-ROM


 From the mid-1990s through the late 2000s, the most common way to get new software
was to purchase a CD-ROM. You could then insert the disc, and the computer would walk
you through the installation.
 Now, almost all software has moved away from this model. Many new computers no
longer include a CD-ROM for this reason. However, if you do need to install software
from a CD-ROM, simply insert the disc into your computer, then follow the instructions.
 Installing software from the Web
 Today, the most common way to get new software is to download it from the Internet.
Applications like Microsoft Office and Adobe Photoshop can now be purchased and
downloaded right to your computer. You can also install free software this way. For
example, if you wanted to install the Google Chrome web browser, you can visit this
page and click the Download button.
 The installation file will be saved to your computer in .exe format. Pronounced dot e-x-e,
this is the standard extension for installation files on Windows computers. You can
follow the steps below to install an application from an .exe file.
 Locate and download an .exe file.
 Locate and double-click the .exe file. (It will usually be in your Downloads folder.)
 A dialog box will appear. Follow the instructions to install the software.
 The software will be installed. You can now open the application from the Start
menu (Windows 7) or the Start Screen (Windows 8).

Installation of application software

Installing software from the Web

 Today, the most common way to get new software is to download it from the Internet.
Applications like Microsoft Office and Adobe Photoshop can now be purchased and
downloaded right to your computer. You can also install free software this way. For
example, if you wanted to install the Google Chrome web browser, you can visit this
page and click the Download button.
 The installation file will be saved to your computer in .exe format. Pronounced dot e-x-e,
this is the standard extension for installation files on Windows computers. You can
follow the steps below to install an application from an .exe file.
 Locate and download an .exe file.
 Locate and double-click the .exe file. (It will usually be in your Downloads folder.)
 A dialog box will appear. Follow the instructions to install the software
 The software will be installed. You can now open the application from the Start
menu (Windows 7) or the Start Screen (Windows 8).

Install the antivirus program

 To install an antivirus program on your computer, follow the steps below.


 If you purchased the antivirus program from a retail store, insert the CD or DVD into the
computer's disc drive. The installation process should start automatically, with a
window opening to help guide you through the install process.
 If you downloaded the antivirus program on the Internet, find the downloaded file on
your computer. If the downloaded file is a zip file, unzip the file to extract and access the
installation files. Look for a file named setup.exe, install.exe, or something similar,
then double-click that file. The installation process should start, with a window opening
to help guide you through the install process.
 In the installation process window, follow the steps provided to install the antivirus
program. The install process provides recommended options so the antivirus program
will function properly, which in most cases can be accepted as is. The one exception is if
the install process recommends to install any toolbars for Internet browsers or other
helpful programs for your computer. If prompted to install other software with the
antivirus program, uncheck all boxes or decline the install of those extra programs. No
additional programs should be needed for the antivirus program to install and run
successfully on your computer.
 When the install process is complete, close out of the install window.
 If used, remove the CD or DVD from the computer's disc drive.
 The antivirus program is now installed and ready to use. While it may not be required,
we recommend restarting your computer so that any modified settings in the operating
system can take effect correctly.

11.program
 A printer is an essential output device that a user needs for printing documents. It works
on a spooling mechanism through which it receives orders for printing from the user
and executes them. Spooling stands for simultaneous peripheral operation online. The
main issue with the spooling mechanism is that once you give an order to print
something, you cannot stop it midway.
 There could be times when you might have ordered to print something by mistake. Once
you give the order, you cannot stop it. Even if you unplug your printer and put it back
after some time, the spooler will continue with the previous order. In this article, we will
illustrate various methods on how to stop printer spooling on Windows operating
system.
Method 1: Stop Spooling With Command Prompt

Step 1 – Go To The Start Menu


 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.
Step 2 – Search For Command Prompt
 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 3 – Open Command Prompt Application
 Right-click on the Command Prompt icon, and you will see a dropdown menu appear on
the screen. Click on “Run as administrator” option from the menu. You may see a pop-
up dialog box showing you a warning. Click on Yes to continue.
Note: Command Prompt is an application where you type commands for the operating system
to execute instantly. Instead of using the command prompt, you can use the graphical interface
of the operating system. But, at times, the command prompt saves a lot of time by letting you
avoid various steps at once.
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.
 Open File Explorer and in the address bar, type
“C:\windows\system32\spool\PRINTERS” and press Enter key. You may 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
 You need to restart the spooler service so that your printer continues to print
documents for future orders without any issue. In the CMD type “net start spooler” and
tap the Enter key. You will see the message “The print spooler service started
successfully”.
 Finally, close the command prompt and restart your computer.
12.program
Program to find class of an IP Address in C
#include <stdio.h>
#include <string.h>
/*
Function :extractIpAddress
Arguments :
1) sourceString - String pointer that contains ip address
2) ipAddress - Target variable short type array pointer that will store ip
address octets
*/
voidextractIpAddress(unsignedchar*sourceString,short*ipAddress)
{
unsignedshortlen=0;
unsignedchar oct[4]={0},cnt=0,cnt1=0,i,buf[5];

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];
}

intmain()
{
unsignedcharip[20]={0};
shortipAddress[4];

printf("Enter IP Address (xxx.xxx.xxx.xxx format): ");


scanf("%s",ip);

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");

return0;
}

Output
Enter IP Address (xxx.xxx.xxx.xxx format): 145.160.017.001

Ip Address: 145. 160. 017. 001


Class B Ip Address.
13.

// C++ program to check if a given password is

// strong or not.

#include <bits/stdc++.h>

usingnamespacestd;

voidprintStrongNess(string& input)

intn = input.length();

// Checking lower alphabet in string

boolhasLower = false, hasUpper = false;

boolhasDigit = false, specialChar = false;

string normalChars = "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_tspecial = 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;

elseif((hasLower || hasUpper) &&

specialChar&& (n >= 6))

cout<< "Moderate"<<endl;

else

cout<< "Weak"<<endl;

// Driver code

intmain()

string input = "GeeksforGeeks!@12";

printStrongNess(input);

return0;

Output
Strength of password: -Strong
14.program
How to Use Bluetooth to Transfer Files Between Devices
Send Files from Smartphones and Tablets
To transfer files from a smartphone or tablet to a PC:
1. Open the File Manager app. This also could be called Explorer, Files, File Explorer, My
Files, or something similar. On Android Marshmallow or later, open the Settings app to
find the file manager.
2. While iOS has a Files app, it doesn't generally allow Bluetooth transfers. Instead, it
uses AirDrop for non-internet file transfers, which uses Bluetooth and Wi-Fi.
 Go to the folder that contains the files you want to transfer. Camera photos are
usually found in the DCIM folder.
 Tap the Menu icon and choose Select.
 Select the files you want to send.
 Tap the Share icon.
 In the list of sharing options, tap Bluetooth.
 Send Files from Computers
 15.program
 Pune Cosmos Bank cyber-attack: Supplementary chargesheet filed against five from
Thane
 In one of the biggest cyber attacks on an Indian bank, several cloned debit cards of
the Cosmos Cooperative Bank, which has its headquarters in Pune, were used for
thousands of ATM transactions from India and 28 other countries in a period of
seven hours on August 11, 2018.
 The Pune City Police on Thursday filed another supplementary chargesheet in the
Cosmos Bank cyber attack case before a court in Pune. Police have so far arrested 18
people in connection with the malware attack on Cosmos Bank.
 A special investigation team (SIT) of Pune City Police filed a supplementary
chargesheet of almost 400 pages against five accused, identified as Ferzo Yasin
Shaikh (37) of Mumbai, Salman Naeem Baig (31), Shahbaz Arif Khatri (30), Asif Jamil
Shaikh (31) and Shahbaz Farooq Shaikh (29), all from Thane.
 All five are currently under judicial custody and lodged in Yerwada Central Prison.
Police said the five accused are “money mules” who had allegedly withdrawn money
to the tune of Rs 61 lakh from different ATMs in Jaipur and Indore.
 Deputy Commissioner of Police, cyber crime, Sambhaji Kadam confirmed that
another supplementary chargesheet was filed before the court on Thursday in the
Cosmos Bank cyber attack case.
 In one of the biggest cyber attacks on an Indian bank, several cloned debit cards of
the Cosmos Cooperative Bank, which has its headquarters in Pune, were used for
thousands of ATM transactions from India and 28 other countries in a period of
seven hours on August 11, 2018.
 While nearly Rs 78 crore was withdrawn in more than 12,000 ATM transactions
outside India, another 2,800 transactions were made in different places within India,
to the tune of Rs 2.5 crore.
 Deputy Commissioner of Police, cyber crime, Sambhaji Kadam confirmed that
another supplementary chargesheet was filed before the court on Thursday in the
Cosmos Bank cyber attack case.
 In one of the biggest cyber attacks on an Indian bank, several cloned debit cards of
the Cosmos Cooperative Bank, which has its headquarters in Pune, were used for
thousands of ATM transactions from India and 28 other countries in a period of
seven hours on August 11, 2018.
 While nearly Rs 78 crore was withdrawn in more than 12,000 ATM transactions
outside India, another 2,800 transactions were made in different places within India,
to the tune of Rs 2.5 crore.
16.program
Optimized Algorithm for Pattern Searching
#include <bits/stdc++.h>

usingnamespacestd;

voidsearch(string pat, string txt)

intM = pat.size();

intN = txt.size();

inti = 0;

while(i<= N - M) {

intj;

for(j = 0; j < M; j++)

if(txt[i + j] != pat[j])

break;

if(j == M)

cout<<"Pattern found at index "<<i<<endl;

i = i + M;

elseif(j == 0)

i = i + 1;

else

i = i + j;

intmain()

string txt = "ABCEABCDABCEABCD";

string pat = "ABCD";

search(pat, txt);

return0;

}
Output

Pattern found at index 4

Pattern found at index 12

17.program

Social media crime recorded 100% rise in 2021 in Pune

PUNE Technology has been a silver lining during the ongoing Coronavirus pandemic as
communication, business and personal interactions moved online
PUNE Technology has been a silver lining during the ongoing Coronavirus pandemic as
communication, business and personal interactions moved online. But cybercrime remains a
problem for citizens and the police in Pune
The number of cybercrime complaints reported based on misuse of social networking sites
doubled in 2021 compared to 2020. (REPRESENTATIONAL IMAGE)
The number of cybercrime complaints reported based on misuse of social networking sites
doubled in 2021 compared to 2020. The overall number of complaints have seen an exponential
increase since 2018. The city cybercrime cell received 19,023 total complaints in 2021 that
belong to various categories, such as monetary frauds, sending vulgar messages on phones,
email hacking, stealing online data and defaming people by posting morphed pictures in social
media and many more. According to Pune cybercrime police data, 14,950 such complaints were
reported in 2020 and 7,795 in 2019.
The methods of defrauding people have become innovative, according to BhagyashreeNavatake,
deputy commissioner of police, cybercrime and Economic offence wing of Pune police. “There
were innovative ways of defrauding people every 8-10 days. When Covid began, the number of
cases of calling up positive patients and duping them increased. This happened in addition to
the casual approach of people who click on links and share OTP. The use of e-commerce and
various kinds of software also increased . These factors contributed to the rise in cases,” said
DCP Navatake.
Among social media-related cybercrime, the cases from popular platforms Facebook and
Instagram are the highest. The city police introduced a new section for its records for
“sextortion” and “friendship fraud”, on Facebook and Instagram, which consist of cases of using
sexual images or videos for extortion. The highest number of cases were of defamation and
posts by making fake profiles or making vulgar comments on posts or through messages. The
number of cases doubled from 791 in 2020, to 1,518 in 2021.
On other platforms including Twitter, the new section added for record was of posting vulgar
comments on Zoom meetings and uploading of videos on social media sites other than Facebook
and Instagram. The trend has seen a worrying rise among minor victims and adults equally.
Children were exposed to added screentime owing to the online schooling necessitated by the
lockdown, said officials.
While social media cases rose exponentially, the highest contributor of cybercrime complaints
was online banking fraud. The cases of online banking fraud include bank cards, third party
payment options, QR code scan, lottery fraud, job fraud, matrimonial fraud, loan fraud, and KYC
update fraud. Among the cases of online banking fraud, the number of cases of misuse of bank
cards was the highest contributor followed by job fraud, loan fraud, money transfer using third
party methods. The new entrant in this list is Fastag cheating which took up pace when the
central government made use of Fastag mandatory.
The police have managed to get a refund of the money lost in some of the cases. The total
amount refunded in 2021 by the cybercrime cell, however, has seen a record low in the past
four years. The cyber cell refunded ₹37,902,535 in 2021 compared to ₹ 96,090,893 in
2020, ₹113,935,459 in 2019, and ₹41,855,975 in 2018, according to police records.
“In 2020 as well as 2019, there was a major chunk of refund from cases like Cosmos bank fraud
and Bitcoin case. That way, the recovery in multiple smaller cases is much more this year
compared to earlier years,” said DCP Navatake.
In the final quarter 2021 year, the cybercrime cell has registered five major cases related to
malpractices in exams including Teacher eligibility test (TET) 2018, TET 2020, health
department recruitment exam Group D, Group C, and Maharashtra housing and area
development authority (MHADA) recruitment exam.

18.program

Case study on Japanese bank for key logger scam

In the London case, where the criminals attempted to transfer $420 from a London branch of
Japanese bank, the technique applied was password cracking. Through the use of Key loggers
the criminals were in a position to get access to some of the key passwords to the bank system.
The information that was obtained from the key logger programs was used to access some of
the most important and restricted data areas, including access codes that were private the
banking top managerial staff. This gave the criminals directs access to the bank information that
led to the attempted crime.
It is also possible that the criminals also used session hijacking through the internet to enable
them get into important accounts of the bank. A combination of these two techniques must have
led to successful log in to the private accounts of the bank. These are some of the top most
methods that the criminals always use in accessing private information from the banks. Recent
crimes related to the same have been witnesses in various regions of the world. It has still been
realized that password cracking is still the main method that is usually employed.
There are numerous measures that exist in order to control cybercrimes. One of these is the use
of strong passwords or user ID. This should be frequently reviewed and changed to limit the
extent to which the key logger programs can access the passwords. It may be able to detect the
password, but in changing this password again and again, successful hacking may be limited.

19.program

How can denial-of-service attacks be prevented?


One of the first known DoS attacks was on internet service provider (ISP) Panix in September of
1996. The attack lasted for five days, crippling the company and concerning security experts. In
his remarks about the incident made to the New York Times, computer scientist Peter G.
Neumann noted, “In principle, most of the denial-of-service attacks we see have no solution.”
While DoS attacks have grown in complexity and popularity since the nineties, the cybersecurity
industry has grown to meet the challenge. Now, there is a blueprint for denial-of-service attack
prevention:

1. Perform a network vulnerability audit: In order to properly defend your network,


you have to understand its weaknesses. Do a complete review of all the devices on your
network. This process includes defining their function within the network, recording the
system information, and outlining their existing vulnerabilities. This level of visibility
allows you to understand your network’s deficiencies, prioritize them by urgency, and
patch any holes to keep them from being exploited. Audits are time-consuming, but they
are also worth it. It is better for someone on your team to discover a flaw in your
security — no matter how egregious — than an attacker.

2. Secure your infrastructure: To successfully defend against a DoS attack, you need to
make sure your castle’s walls are fully fortified. For this, it is essential to have multi-level
protection strategies that use intrusion prevention and threat management systems.
These systems can use anti-spam, content filtering, VPN, firewalls, load balancing, and
security layers to spot and block attacks before they overwhelm your network. That
said, software cannot do the job alone: You need a hardware component. Edge
microsegmentation — which we will cover in the next point — is one of the most
powerful ways of protecting your network from DoS attacks.
3. Reduce the attack surface: One of the most effective strategies against DoS attacks is to
reduce the size of the available attack area. The smaller the attack surface, the easier it is
to defend. While there are many ways of implementing this
strategy, microsegmentation is an innovative approach gaining traction in the industry.
Microsegmentation spits a network into granular zones and protects each zone
separately. The net effect is a higher overall security profile. Byos has built a powerful
edge microsegmentation solution that uses hardware-enforced isolation to secure
endpoints on small microsegments, maximizing the defensive capabilities of the
network as a whole. Ready to learn more? Get started here.

4. Create a DoS response plan: Benjamin Franklin once said, “If you fail to plan, you are
planning to fail,” and this principle holds with DoS attacks. The purpose of the plan is to
ensure that your current setup is secure, that you can detect an attack as soon as
possible, that everyone on your team knows their role should an attack occur, and that
escalation and resolution procedures are all clear.
This means the plan should provide a systems checklist, define the response team, and
lay out the entire response process. In the heat of an attack, it is easy to lose focus and
make errors, so have a plan for how to resolve a denial-of-service attack in place to
make sure that everyone is ready when the time comes.

5. Know the warning signs: The earlier you can spot the onset of a DoS attack, the more
likely it is that you will be able to defend against it successfully. Common warning signs
of the beginning of an attack are poor connectivity, network slowdown, repeated site
crashes, or any sustained disruption of performance.
It is important to remember that these symptoms can result from both high-volume and
low-volume DoS attacks. Low-volume attacks are more challenging to identify because
of their similarity to less serious security incidents, so it is essential to have team
members with the experience or instinct to follow up on the subtle warning signs that
could portend a larger breach.

20.

1. Installation

Snort can be downloaded from it’s official website at http://www.snort.org. Snort is supported
on a number of hardware platforms and operating systems. These include:
 Linux
 OpenBSD
 FreeBSD
 NetBSD
 Solaris (both Sparc and i386)
 HP-UX
 AIX
 IRIX
 MacOS
Windows
In this report, we downloaded the source file package and compiled from scratch, however,
Snort website also provide binary version for linux and windows platforms.

1.1 Softwares Installed Before Snort

Before compile and install snort, we have to first install the related software and libraries.
2 Components of Snort
A Snort-based IDS contains the following components:

 Packet Decoder
 Preprocessors
 Detection Engine
 Logging and Alerting System
 Output Modules
Below shows how these components work together to detect particular attacks and to generate
output. Any data packet coming from the Internet enters the packet decoder. On its way towards
the output modules, it is either dropped, logged or an alert is generated.

2.1 Packet Decoder

In an organization’s network, the network interface can be Ethernet, SLIP, or PPP and so on. The
packet decoder takes packets from different types of network interfaces and prepares the
packets to be preprocessed or to be sent to the detection engine.

2.2 Preprocessors

Preprocessors are components that can be used to arrange or modify data packets before the
detection engine does some operation to find out if the packet is being used by an intruder.
Hackers use different techniques to fool an IDS in different way, these may include:

Exact match: For examples, you may have created a rule to find a signature “httpd/conf” in
HTTP packets. If you are matching this string exactly, a hacker can easily fool you by modifying
the string as “httpd/./conf” or “httpd../httpd/conf”. In addition, since the web servers usually
understand hexadecimal characters or Unicode characters, hackers can also inset these kinds of
characters into the web URI. This also makes the exact match rule void. A preprocessor can
rearrange the string so that it is detectable by the IDS.

Packets fragmentation: When a large data chunk is transferred to a host, the packet is usually
fragmented into multiple data packets so that each packet fragment satisfies the requirement of
default maximum length of some particular network interface. Later, the receiving systems need
to reassemble these smaller units to form the original data packets. Hackers can use
fragmentation to hide a signature into several small units to fool the IDS. A Preprocessor can
reassemble these small units first and send the whole packet to the detection engine for
signature testing.

2.3 The Detection Engine

The detection engine is the most important part of Snort. Its responsibility is to detect if any
intrusion activity exists in a packet. The detection engine employs Snort rules for this purpose.
The rules are read into internal data structures or chains where they are matched against all
packets. If a packet matches any rule, Snort will send alerts to system logs or output plug-ins;
otherwise the packet is dropped. The detection engine is the time-critical part of Snort. The load
on it depends on the following factors:
 Number of rules
 Power of the machine on which Snort is running
 Speed of internal bus used in the Snort machine
 Load on the network
Note that the detection engine can dissert a packet and apply rules on different parts of the
packet. These parts may be:

The IP header of the packet

The Transport layer header: This header includes TCP, UDP or other transport layer headers. It
may also work on the ICMP header.
The application layer level header: Application layer headers include, but are not limited to, DNS
header, FTP header, SNMP header, and SMTP header. You may have to use some indirect
methods for application layer headers, like offset of data to be looked for.

Packet payload. This means that you can create a rule that is used by the detection engine to
find a string inside the data that is present inside the packet.

2.4 Logging and Alerting System

Depending on what the detection engine finds inside a packet, the packet may be used to log the
activity or generate an alert. Logs are kept in simple text files, tcpdump-style files or some other
form. All of the log files are stored under /var/log/snort folder by default. You can use –l
command line options to modify the location of generating logs and alerts. Many command line
options discussed in the next chapter can modify the type and detail of information that is
logged by the logging and alerting system.

2.5 Output Modules

Output modules or plug-ins can do different operations depending on how you want to save
output generated by the logging and alerting system of Snort. Basically, these modules control
the type of output generated by the logging and alerting system. Depending on the
configuration, output modules can do things like the following:
 Simply logging to /var/log/snort/alerts file or some other file
 Sending SNMP traps
 Sending messages to syslog facility
 Logging to a database like MySQL or Oracle.
 Generating eXtensible Markup Language (XML) output
 Modifying configuration on routers and firewalls
 Sending Server Message Block (SMB) messages to Microsoft Windows-based machines
Other tools can also be used to send alerts in other formats such as e-mail messages or viewing
alerts using a web interface.

21.program
What is Malware?
As software designed to interfere with a computer's normal functioning, malware is a blanket
term for viruses, trojans, and other destructive computer programs threat actors use to infect
systems and networks in order to gain access to sensitive information.
How to remove malware from a PC
Follow these six steps to malware removal on a PC.

Step 1: Disconnect from the internet


Disconnecting from the internet will prevent more of your data from being sent to a malware
server or the malware from spreading further.

Step 2: Enter safe mode


If malware is set to load automatically, this will prevent the malware from loading, making
it easier to remove.
To enter safe mode:
Restart your PC.
When you see the sign-in screen, hold down the Shift key and select Power → Restart.
After your PC restarts, to the “Choose an option” screen, select Troubleshoot → Advanced
Options → Startup Settings.
On the next window, click the Restart button and wait for the next screen to appear.
A menu will appear with numbered startup options. Select number 4 or F4 to start your PC in
safe mode.
Disclaimer: Avoid logging into accounts during malware removal.
To avoid sharing your personally identifiable information, do not log into sensitive accounts
while your device is infected.

Step 3: Check your activity monitor for malicious applications


If you know you’ve installed a suspicious update or application, close the application if
it’s running.
Your activity monitor shows the processes that are running on your computer, so you can see
how they affect your computer’s activity and performance.
To check for malicious applications:
 Open Resource Monitor
 Find task
 Select “End Process”

Step 4: Run a malware scanner


Luckily, malware scanners can remove many standard infections. But remember that if you
already have an antivirus program active on your computer, you should use a different scanner
for this malware check since your current antivirus software may not detect the malware
initially.

Step 5: Fix your web browser


Malware is likely to modify your web browser’s homepage to reinfect your PC. Check your
homepage and connection settings using the steps below for common browsers.
To verify your homepage on Chrome:
 In the top right corner of your Chrome browser, click “More,” then “Settings.”
 Select the drop-down menu in the “Search engine” section.
 Verify your default homepage.
To verify your homepage on Internet Explorer:
 Select the Tools icon.
 Click Internet options.
 In the General tab, find the “Search” section and click Settings.
 Verify your default homepage.

Step 6: Clear your cache


After you’ve verified your homepage setting, it’s imperative to clear your browser’s cache.
Follow the steps below to learn how to clear your cache for Chrome and Internet Explorer.
To clear your cache on Chrome:
 Find History
 Select “Clear Browsing Data”
 Select “All Time” from Time Range drop-down menu
 Select “Clear Data”
22.program

Common Types of Web Application Vulnerabilities

1. SQL Injection
 Many applications use Structured Query Language (SQL) to manage communications
with the database. SQL vulnerabilities allow attackers to insert malicious SQL commands
to exfiltrate, modify, or delete data. Some hackers use SQL to gain root access to the
target system.
 SQL injection attacks target servers that hold critical data used by web applications or
services. They are particularly dangerous when they expose critical or sensitive data,
such as user credentials and personal information. The most common vulnerability
enabling SQL injection attacks is using unsensitized user inputs. It is important to strip
out any element in user-supplied inputs that the server could execute as SQL code.
2. Cross-Site Scripting (XSS)
 XSS attacks are similar to SQL injection attacks and involve the injection of malicious
scripts into websites or web applications. The point of difference is that the malicious
code runs in the browser only when the user visits a compromised website or app.
Attackers often carry out XSS attacks by injecting code into input fields that the target
page runs when visitors view the page (e.g., embedded JavaScript link).
3. Cross-Site Request Forgery (CSRF)
 A CSRF attack occurs when an attacker forces the victim to perform unintended actions
on the web application. The victim first logs into the web app, which has deemed the
user and browser trustworthy. Therefore, the app will execute malicious actions that the
attacker tricks the victim into forwarding a request to the web app. The motivation for
CSRF ranges from simple pranks to enabling illicit financial transactions.
4. Session Fixation
 A session fixation attack involves forcing a user’s session ID to a specified value.
Depending on the target web application’s functionality, attackers may use various
techniques to fix session ID values. Examples of session fixation techniques include
cross-site scripting exploits and reusing HTTP requests.
 First, an attacker fixes the victim’s user session ID. Then, the user logs in and
inadvertently exposes the online identity. The attacker can then hijack the victim’s user
identity using the fixed session ID value.
 Any web application that authenticates users with sessions is vulnerable to session
fixation attacks without adequate defences. Web apps that use session IDs typically use
cookies, though they can also use hidden form fields or URLs. Cookie-based user
sessions are the most popular and the easiest to compromise. Most fixation attacks
target cookie-based sessions.
5. Local File Inclusion (LFI)
 An LFI attack exploits the dynamic file inclusion mechanisms in a web application. It
may occur when a web application takes user input, such as a parameter value or URL,
and passes it to a file inclusion command. An attacker can use this mechanism to trick
the app into including a remote file containing malicious code.
6. Security Misconfigurations
 Security misconfigurations are some of the most serious web application vulnerabilities
because they provide attacks with opportunities to infiltrate the application easily.
Attackers could exploit a wide range of security configuration vulnerabilities. These
include unchanged default configurations, data stored in the cloud, ad hoc or incomplete
configurations, plaintext error messages containing sensitive information, and HTTP
header misconfigurations. Security misconfigurations may be present in any operating
system, library, framework, or application.

23.program

Share the printer on the primary PC

There are two ways to share your printer: using Settings or Control Panel.
Share your printer using Settings
 Select the Start button, then select Settings > Devices > Printers & scanners.
 Choose the printer you want to share, then select Manage.
 Select Printer Properties, then choose the Sharing tab.
 On the Sharing tab, select Share this printer.
 If you want, edit the share name of the printer. You'll use this name to connect to
the printer from a secondary PC.

Share your printer using Control Panel


 In the search box on the taskbar, type control panel and then select Control Panel.
 Under Hardware and Sound, select View devices and printers.
 Select and hold (or right-click) the printer you want to share, select Printer properties,
and then choose the Sharing tab.
 On the Sharing tab, select Share this printer.
 If you want, edit the share name of the printer. You'll use this name to connect to
the printer from a secondary PC.
24.program
mobile security apps

1.Avast Mobile Security


Avast is a great app to provide your Android phone protection against viruses coupled with
many other threats.
Avast is one of the world’s most trusted free antivirus for Android, which alerts you when
spyware, adware gets installed and violate your privacy.
The detection rate of the latest Android malware is about 99.9% and is around 100% of
malware detected in the last four weeks.
Verdict: If malware and safe browsing are your primary concern, this app is appropriate for
you.

2.Malwarebytes
Safeguard your Android devices from ransomware, malware, and other threats using the
advanced protection of Malwarebytes.
It can efficiently detect dangerous threats and remove them before your device gets
compromised. Malware bytes offers real-time shields and scans for even the sophisticated
phishing URLs while you use the Chrome browser. It also alerts you in case it detects anything
suspicious to ensure a safe browsing experience.
The application conducts periodic privacy audits by identifying access permissions of your apps
installed on your phone or tablet. You can track those apps tracking your location, costing you
hidden fees, or monitoring your calls. Malware bytes can quickly search all your files for
malware and potentially harmful programs, including adware, screen lockers, etc.
It supports Android versions 6.0 or higher and languages like English, French, Italian, Spanish,
Russian, Dutch, German, Indonesian, Polish, and Portuguese.
Want to try out?
Malware bytes offers a 30-day free trial with all the premium features. You can buy its starting
plan for $3.33/month for one device, or choose a higher plan for more devices.
3.Kaspersky Security and VPN

For good reasons, Kaspersky is a well-known name in the cybersecurity space. This free-to-
download app has excellent features to keep you safe in this ever-dangerous digital territory.
This has:
Real-time malware protection
Remote wipe & Find My Device
Anti-phishing mechanisms
Safe browsing and messaging
Password manager
Virtual private network, etc.
In addition, you get a breach alert to tell if your personally identifiable information is leaked.
Besides, it also pings you when a new device connects to your WIFI network.
Overall, it provides Kaspersky 360-degree protection in a freemium package which is definitely
worth considering.
4.Norton 360

Norton 360 mobile security covers all bases to offer complete peace of mind. It helps you fight
against online threats with its malware detection, advert blocker, WIFI analyzer, etc.
Following the trend, Norton mobile security also has a built-in VPN to encrypt all the network
traffic.
Additionally, you get powerful phishing detectors indicating risky links in text messages, emails,
and apps. Likewise, it identifies your personal information leaks over the dark web.
You can check this and more with its 14-day premium trial.
5.McAfee Security
McFee packs a capable cybersecurity suite to become the guardian of your smartphone.
It includes:
Malware shield
VPN
Wi-Fi Scan
Identity Protection
Anti-phishing, etc.
The subscriptions of McFee come in two flavours which basically differ in their identity
protection module and a few advanced features you can check in their 7-day free trial.

6.AVG Antivirus & Security

AVG is another freemium mobile security solution with a decently powerful free version. Its
paid subscription is frequently dubbed as ‘well worth’ by its enormous user base.
It offers:
 Malware scanner
 Phishing protection
 Media vault
 App lock
 VPN
Performance booster
In addition to this long list of features, you also get an app usage tracker, breach alert, junk
cleaner, etc.
You can expect similarities among Avast, Norton, and AVG mobile security, as all of these work
under the same parent company.
Overall, it promises a lot to be ignored, and its powerful free subscription makes it a must-try
security application.

7.ESET Mobile Security

ESET comes loaded with the best features to help you stay secure, and you can try its premium
package for 30 days without paying a penny.
You’ll get:
 Antivirus
 USB scanner
 Online payment protection
 Powerful Anti-theft
 Remote wipe
 App lock
 Call filtering
 Scheduled scans, etc.
Among these, ESET antivirus, real-time scanning, security report, activity log, etc., are free
features. A paid subscription is clearly more potent with the advanced protection for 5-devices
per plan.

8.Bitdefender Mobile Security

A critically acclaimed security product, Bit defender offers a free premium trial for the first 14
days.
It boasts of:
 Malware detector
 Internet security
 Breach alert
 App locker
 VPN
 Anti-theft, etc.
In addition to your Android Smartphone, Bit defender also protects Android wear devices.
Besides, its autopilot mode recommends security actions based on usage.
Overall, Bit defender has a solid premium subscription and a capable free plan anyone can take
benefit of.

9.Nox
An all-in-one security app, nox security helps you protect your device from malware and various
other threats. It’s like having a single weapon that can tackle all the nasty security concerns.
This app can:
Keep your phone away from viruses and malware
Protect and lock your apps to prevent privacy breaches
Prevent others from viewing your notifications menu
Block spam and suspicious calls
Apart from these security features, Nox Security also helps you clean junk files, stop power-
draining apps, and even protect your phone from Wifi network attacks.

10.Bouncer
There are some apps that we use only a couple of times or for only a single purpose and then
keep it as it is, so in those cases, it doesn’t make much sense to keep the permissions intact.
However, generally, there’s no option to remove the permissions, but thankfully there’s an app
for it. Bouncer allows you to keep or remove permissions on demand and even disallow certain
actions of the app that may seem inappropriate to you. It also notifies you of any apps on your
device that drains your battery fast and those that appear to sell your information to third
parties.
Install Avast Mobile Security
1. On your Android device, tap the button below to open the Avast Mobile Security product
page in Google Play Store.

2. Tap Install to download and install the app. When installation is complete, tap Open.

3. Tap Get started to confirm that you accept Avast's Agreement and Privacy Policy, then
tap Next.

4. Select one of the options below:

 Purchase: Tap Upgrade options and select your preferred plan, then follow the
on-screen instructions to complete the purchase.

 Use free version: Tap Continue with free ▸ Continue as free to start using the free
version of the app.

 Activate: If you purchased an Avast Mobile Security subscription before


installation, tap Already purchased? Then, select the relevant option to activate
your paid subscription.
Avast Mobile Security is now installed on your Android device.
25.program

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.
Objectives –
 As the Hash Function, HMAC is also aimed to be one way, i.e, easy to generate output
from input but complex the other way round.
 It aims at being less affected by collisions than the hash functions.
 HMAC reuses the algorithms like MD5 and SHA-1 and checks to replace the embedded
hash functions with more secure hash functions, in case found.
 HMAC tries to handle the Keys in a more simple manner.

HMAC algorithm –
The working of HMAC starts with taking a message M containing blocks of length b bits. An
input signature is padded to the left of the message and the whole is given as input to a hash
function which gives us a temporary message-digest MD’. MD’ again is appended to an output
signature and the whole is applied a hash function again, the result is our final message digest
MD.
Here is a simple structure of HMAC:

1. Here, H stands for Hashing function,

2. M is the original message

3. Si and So are input and output signatures respectively,

4. Yi is the ith block in original message M, where I ranges from [1, L)

5. L = the count of blocks in M

6. K is the secret key used for hashing

7. IV is an initial vector (some constant)

8. The generation of input signature and output signature Si and So respectively.

To a normal hash function, HMAC adds a compression instance to the processing. This structural
implementation holds efficiency for shorter MAC values.

26.program

HYDERABAD: Investigators looking into the Mahesh Bank hacking case have been left shocked
at how flimsy the security deployed by the bank to protect itself from hackers was.
During the investigation that stretched over two months, the cybercrime sleuths deployed over
100 personnel to different States in northern and north-eastern India, incurring an expenditure
of about Rs 58 lakh. Unfortunately, their efforts went in vain as they could not nab the kingpin
who had remotely accessed the bank using proxy IP addresses.
Cybercrime sleuths found several chinks in the cybersecurity of the bank, so much so that there
were times the sleuths clutched their heads in sheer frustration. Commissioner CV Anand, who
briefed the media about the case, said that in some instances, even basic security protocols were
not followed, putting public deposits at risk.

The Police Commissioner pointed out that the bank staff was not trained in cybersecurity and
this was the reason why two of its employees opened the phishing emails sent by the hacker,
allowing him access to the bank servers.

“The firewalls are so rudimentary, that even a beginner could have bypassed them,” said a
cybersecurity expert. The investigators found that the bank also compromised when it came to
putting in place proper network infrastructure. “Every user was given internet access,” the
expert said.

The bank did not have a virtual Local Area Network to mitigate hacking incidents and also did
not use Intrusion Detection System (IDS) mechanism and Intrusion Prevention System (IPS)
mechanism to prevent and detect vulnerability exploits.

Anand opined that the banking system is at great risk and said that the police department will
soon convene a meeting with bankers to create awareness among them.

He said that even RBI rules were not being followed to the letter, enhancing the risk to the
banks as well as customers. The investigators are now focusing on a Mumbai-based tech
company that is suspected to have sold the hacking software to the as-yet-unidentified Nigerian
hacker.

The police suspect this is the same software used in the Apex Bank hacking case as
well. Meanwhile, cybercrime sleuths are preparing the grounds to issue a Red Corner notice
against the unidentified Nigerian mastermind behind the Mahesh Bank hacking.

Cops suspect Mumbai firm sold software


The bank did not have a virtual Local Area Network to mitigate hacking incidents and also did
not use Intrusion Detection System (IDS) mechanism and Intrusion Prevention System (IPS)
mechanism to prevent and detect vulnerability exploits.

27.program

Case Study of Facebook cyber attack 2019


Introduction -

Facebook is a social media giant that runs a website and an application which allows users from
all over the globe to connect and share information of their choice with each other and the rest
of the world.

Attacks on Facebook in 2019 -

1. Incident 1 - March 2019

Facebook used to store the user's passwords in a text manner and that is accessible for the
employees working on Facebook. This was captured by Brian Kreds, an expert in
cybersecurity.

2. Incident 2 - April 2019

In the month of April, another cyber security breach was detected, where nearly 540 million
user accounts and their details appeared on an insecure public server where these accounts
are accessible easily.
3. Incident 3 - September 2019
After that In September 2019, A group of attackers accessed the nearly 419 million records of
Facebook which consists of the account details of users.

4. Incident 4 - December 2019


The most major incident of a cyber attack on the company happened in December 2019 when
over 267 million users' account details appeared on the dark web for around 2 weeks.

28. ETHICAL HACKING.

1.

2.
3.

4.

5.
6.

7.

8.
9.

10.

29.program

SSL Protocol :
 SSL Protocol stands for Secure Sockets Layer protocol, which is an encryption-based
Internet security protocol that protects confidentiality and integrity of data.
 SSL is used to ensure the privacy and authenticity of data over the internet.
 SSL is located between the application and transport layers.
 At first, SSL contained security flaws and was quickly replaced by the first version of TLS
that’s why SSL is the predecessor of the modern TLS encryption.
 TLS/SSL website has “HTTPS” in its URL rather than “HTTP”.
 SSL is divided into three sub-protocols: the Handshake Protocol, the Record Protocol,
and the Alert Protocol.
1. TLS Protocol :
 Same as SSL, TLS which stands for Transport Layer Security is widely used for the
privacy and security of data over the internet.
 TLS uses a pseudo-random algorithm to generate the master secret which is a key used
for the encryption between the protocol client and protocol server.
 TLS is basically used for encrypting communication between online servers like a web
browser loading a web page in the online server.
 TLS also has three sub-protocols the same as SSL protocol – Handshake Protocol, Record
Protocol, and Alert Protocol.
2. SHTTP :
 SHTTP stands for Secure Hypertext Transfer Protocol, which is a collection of security
measures like Establishing strong passwords, setting up a firewall, thinking of antivirus
protection, and so on designed to secure internet communication.
 SHTTP includes data entry forms that are used to input data, which has previously been
collected into a database. As well as internet-based transactions.
 SHTTP’s services are quite comparable to those of the SSL protocol.
 Secure Hypertext Transfer Protocol works at the application layer (that defines the
shared communications protocols and interface methods used by hosts in a network)
and is thus closely linked with HTTP.
 SHTTP can authenticate and encrypt HTTP traffic between the client and the server.
 SHTTP operates on a message-by-message basis. It can encrypt and sign individual
messages.

1.Set Protocol :

 Secure Electronic Transaction (SET) is a method that assures the security and integrity
of electronic transactions made using credit cards.
 SET is not a payment system; rather, it is a secure transaction protocol that is used via
the internet.
 The SET protocol provides the following services:
 It establishes a safe channel of communication between all parties engaged in an e-
commerce transaction.
 It provides confidentiality since the information is only available to the parties engaged
in a transaction when and when it is needed.
The SET protocol includes the following participants:
 Cardholder
 Merchant
 Issuer
 Acquire
 Payment Gateway
 Certification Authority
PEM Protocol :
 PEM Protocol stands for privacy-enhanced mail and is used for email security over the
internet.
 RFC 1421, RFC 1422, RFC 1423, and RFC 1424 are the four particular papers that
explain the Privacy Enhanced Mail protocol.
 It is capable of performing cryptographic operations such as encryption,
nonrepudiation, and message integrity.
 PGP Protocol:
 PGP Protocol stands for Pretty Good Privacy, and it is simple to use and free, including
its source code documentation.
 It also meets the fundamental criteria of cryptography.
 When compared to the PEM protocol, the PGP protocol has grown in popularity and use.
 The PGP protocol includes cryptographic features such as encryption, non-repudiation,
and message integrity.

30.program
If you’re responsible for maintaining the network in your home, office, or business, you know
how critical it is to track how many devices are connected to your WIFI.
The following are the two ways:
 The first is to use your router’s web interface, which, in my opinion, is the best method.
It is a simple way to allow you to see everything that is connected. Most will have a
record of previously connected devices, even if they are not currently active.
 The second method is to use a network scanning app. These apps are especially useful
for those who scan often, as they provide more tools to do it with.

With the Google WIFI app


1. Open the Google Wifiapp.
2. Tap Network Devices. The numbers next to "Devices" represent your total Internet (WAN)
traffic to and from your network. ...
3. Tap a specific device and a tab to find additional details. Usage: How much data the device
has used over the selected time frame.

31.program
Detect the number of connections
 Open a browser, type the IP address of the router and log in to your Router.
Note: Find the IP address, username, and password of the router on the back of your
router.
Logging in to the router
 The settings will depend on each router, but mostly it can be found in Status or Info of
connections. For us, we go to Device info and click on DHCP.
Note: For some users, the option will be wireless clients.
 The settings will depend on each router, but mostly it can be found in Status or Info of
connections. For us, we go to Device info and click on DHCP.
Note: For some users, the option will be wireless clients.
 Opening the DHCP option
 Here you can see the information about all the devices that are connected to the router.

Blocking unauthorized devices


1.First, enter your designated Router IP Address (such as 192.168.0.1, 192.168.1.1, etc.) in a
new tab on your web browser and enter the login credentials.
2. Next, expand Bandwidth Control in the left sidebar and review different devices
connected to your Wi-Fi connection.
3. Finally, turn off the toggle for internet access for unknown connections to disable sharing
it.
4. You can also block any connected device by adding it to your router’s blacklist which will
be displayed under the Blocked Devices section.

32.program
Decentralized Finance (DeFi) platform Grim Finance announced on the evening of December 18,
2021, that it suffered a hack resulting in over $30 million in losses. This is the third hack in the
last week and the fifth for the month of December bringing total losses to over $600 million.
Key Findings
 Over $600 million in cryptocurrency stolen in platform attacks in the first three weeks
of December from Badger DAO, Bit Mart, Ascend EX, Vulcan Forged, and Grim Finance.
 Cross-chain swaps and Tornado Cash dominated on-chain movements by attackers.
Attackers continue to target crypto platforms as 2021 comes to a close through phishing and
contract exploits.
Analysis by Grim Finance identified the platform compromise was carried out by an advanced
attacker.
“The attacker attacked using the function titled before Deposit () from our vault strategy
entering a malicious token contract. The attacker creates a malicious token contract that
executed five reentrancy loops from safe Transfer From (), where in all 5 reentrancy, the _pool
value is set to the current balance (). On the last safe Transfer From(), the reentrancy loop is
broken, and some want can be transferred to the strategy, which will increase the _amount to
put the vault in a state to mint shares. On the unwinding of the 5 reentrancy, each loop will see
that the _amount is not 0, and mint the corresponding shares, mint the same share count 5x (the
number of reentrancy loops).”

Approximately one hour prior to the malicious token contract was created, the attacker funded
both Ethereum (ETH) and Binance Smart Chain (BSC) wallets from Tornado Cash. The attacker
bridged the stolen crypto from Grim Finance from the Fantom Main net to the ETH main net for
USDC and DAI.

Key Findings
Over $600 million in cryptocurrency stolen in platform attacks in the first three weeks of
December from Badger DAO, Bit Mart, Ascend EX, Vulcan Forged, and Grim Finance.
Cross-chain swaps and Tornado Cash dominated on-chain movements by attackers.
Attackers continue to target crypto platforms as 2021 comes to a close through phishing and
contract exploits.

Decentralized Finance (DeFi) platform Grim Finance announced on the evening of December 18,
2021, that it suffered a hack resulting in over $30 million in losses. This is the third hack in the
last week and the fifth for the month of December bringing total losses to over $600 million.
Analysis by Grim Finance identified the platform compromise was carried out by an advanced
attacker.
“The attacker attacked using the function titled beforeDeposit() from our vault strategy entering
a malicious token contract. The attacker create a malicious token contract that executed five
reentrancy loops from safeTransferFrom(), where in all 5 rentrancy, the _pool value is set to the
current balance(). On the last safeTransferFrom(), the rentrancy loop is broken, and some want
can be transferred to the strategy, which will increase the _amount to put the vault in a state to
mint shares. On the unwinding of the 5 rentrancies, each loop will see that the _amount is not 0,
and mint the corresponding shares, mint the same share count 5x (the number of rentrancy
loops).”
Approximately one hour prior to the malicious token contract was created, the attacker funded
both Ethereum (ETH) and Binance Smart Chain (BSC) wallets from Tornado Cash. The attacker
bridged the stolen crypto from Grim Finance from the Fantom Mainnet to the ETH mainnet for
USDC and DAI.
33.program

Algorithm for Caesar Cipher:

Input:
 A String of lower case letters, called Text.
 An Integer between 0-25 denoting the required shift.
Procedure:
 Traverse the given text one character at a time .
 For each character, transform the given character as per the rule, depending on whether
we’re encrypting or decrypting the text.
 Return the new string generated.
 A program that receives a Text (string) and Shift value( integer) and returns the
encrypted text.

#A python program to illustrate Caesar Cipher Technique


defencrypt(text,s):
result =""

# traverse text
fori inrange(len(text)):
char =text[i]

# Encrypt uppercase characters


if(char.isupper()):
result +=chr((ord(char) +s-65) %26+65)

# Encrypt lowercase characters


else:
result +=chr((ord(char) +s -97) %26+97)

returnresult
#check the above function
text ="ATTACKATONCE"
s =4
print("Text : "+text)
print("Shift : "+str(s))
print("Cipher: "+encrypt(text,s))

Output
Text : ATTACKATONCE
Shift: 4
Cipher: EXXEGOEXSRGI

34.program

Data encryption standard (DES) has been found vulnerable to very powerful attacks and
therefore, the popularity of DES has been found slightly on the decline. DES is a block cipher and
encrypts data in blocks of size of 64 bits each, which means 64 bits of plain text go as the input
to DES, which produces 64 bits of ciphertext. The same algorithm and key are used for
encryption and decryption, with minor differences. The key length is 56 bits.
The basic idea is shown in the figure:

We have mentioned that DES uses a 56-bit key. Actually, The initial key consists of 64 bits.
However, before the DES process even starts, every 8th bit of the key is discarded to produce a
56-bit key. That is bit positions 8, 16, 24, 32, 40, 48, 56, and 64 are discarded.
Thus, the discarding of every 8th bit of the key produces a 56-bit key from the original 64-
bit key.
DES is based on the two fundamental attributes of cryptography: substitution (also called
confusion) and transposition (also called diffusion). DES consists of 16 steps, each of which is
called a round. Each round performs the steps of substitution and transposition. Let us now
discuss the broad-level steps in DES.
 In the first step, the 64-bit plain text block is handed over to an initial Permutation (IP)
function.
 The initial permutation is performed on plain text.
 Next, the initial permutation (IP) produces two halves of the permuted block; saying Left
Plain Text (LPT) and Right Plain Text (RPT).
 Now each LPT and RPT go through 16 rounds of the encryption process.
 In the end, LPT and RPT are rejoined and a Final Permutation (FP) is performed on the
combined block
 The result of this process produces 64-bit ciphertext.

Initial Permutation (IP):


As we have noted, the initial permutation (IP) happens only once and it happens before the first
round. It suggests how the transposition in IP should proceed, as shown in the figure. For
example, it says that the IP replaces the first bit of the original plain text block with the 58th bit
of the original plain text, the second bit with the 50th bit of the original plain text block, and so
on.
This is nothing but jugglery of bit positions of the original plain text block. the same rule applies
to all the other bit positions shown in the figure.

As we have noted after IP is done, the resulting 64-bit permuted text block is divided into two
half blocks. Each half-block consists of 32 bits, and each of the 16 rounds, in turn, consists of the
broad-level steps outlined in the figure.
Step-1: Key transformation:
We have noted initial 64-bit key is transformed into a 56-bit key by discarding every 8th bit of
the initial key. Thus, for each a 56-bit key is available. From this 56-bit key, a different 48-bit
Sub Key is generated during each round using a process called key transformation. For this, the
56-bit key is divided into two halves, each of 28 bits. These halves are circularly shifted left by
one or two positions, depending on the round.
For example: if the round numbers 1, 2, 9, or 16 the shift is done by only one position for other
rounds, the circular shift is done by two positions. The number of key bits shifted per round is
shown in the figure.

After an appropriate shift, 48 of the 56 bits are selected. for selecting 48 of the 56 bits the table
is shown in the figure given below. For instance, after the shift, bit number 14 moves to the first
position, bit number 17 moves to the second position, and so on. If we observe the table , we will
realize that it contains only 48-bit positions. Bit number 18 is discarded (we will not find it in
the table), like 7 others, to reduce a 56-bit key to a 48-bit key. Since the key transformation
process involves permutation as well as a selection of a 48-bit subset of the original 56-bit key it
is called Compression Permutation.
Because of this compression permutation technique, a different subset of key bits is used in each
round. That makes DES not easy to crack.
Step-2: Expansion Permutation:
Recall that after the initial permutation, we had two 32-bit plain text areas called Left Plain
Text(LPT) and Right Plain Text(RPT). During the expansion permutation, the RPT is expanded
from 32 bits to 48 bits. Bits are permuted as well hence called expansion permutation. This
happens as the 32-bit RPT is divided into 8 blocks, with each block consisting of 4 bits. Then,
each 4-bit block of the previous step is then expanded to a corresponding 6-bit block, i.e., per 4-
bit block, 2 more bits are added.

This process results in expansion as well as a permutation of the input bit while creating output.
The key transformation process compresses the 56-bit key to 48 bits. Then the expansion
permutation process expands the 32-bit RPT to 48-bits. Now the 48-bit key is XOR with 48-bit
RPT and the resulting output is given to the next step, which is the S-Box substitution.
 Javascript
 Python

# Python3 code for the above approach

# Hexadecimal to binary conversion

defhex2bin(s):

mp={'0': "0000",
'1': "0001",

'2': "0010",

'3': "0011",

'4': "0100",

'5': "0101",

'6': "0110",

'7': "0111",

'8': "1000",

'9': "1001",

'A': "1010",

'B': "1011",

'C': "1100",

'D': "1101",

'E': "1110",

'F': "1111"}

bin=""

foriinrange(len(s)):

bin=bin+mp[s[i]]

returnbin

# Binary to hexadecimal conversion

defbin2hex(s):

mp={"0000": '0',

"0001": '1',

"0010": '2',

"0011": '3',

"0100": '4',
"0101": '5',

"0110": '6',

"0111": '7',

"1000": '8',

"1001": '9',

"1010": 'A',

"1011": 'B',

"1100": 'C',

"1101": 'D',

"1110": 'E',

"1111": 'F'}

hex=""

foriinrange(0, len(s), 4):

ch=""

ch=ch+s[i]

ch=ch+s[i+1]

ch=ch+s[i+2]

ch=ch+s[i+3]

hex=hex+mp[ch]

returnhex

# Binary to decimal conversion

defbin2dec(binary):

binary1 =binary

decimal, i, n =0, 0, 0
while(binary !=0):

dec =binary %10

decimal =decimal +dec *pow(2, i)

binary =binary//10

i+=1

returndecimal

# Decimal to binary conversion

defdec2bin(num):

res =bin(num).replace("0b", "")

if(len(res) %4!=0):

div =len(res) /4

div =int(div)

counter =(4*(div +1)) -len(res)

foriinrange(0, counter):

res ='0'+res

returnres

# Permute function to rearrange the bits

defpermute(k, arr, n):

permutation =""

foriinrange(0, n):

permutation =permutation +k[arr[i] -1]

returnpermutation
# shifting the bits towards left by nth shifts

defshift_left(k, nth_shifts):

s =""

foriinrange(nth_shifts):

forj inrange(1, len(k)):

s =s +k[j]

s =s +k[0]

k =s

s =""

returnk

# calculating xow of two strings of binary number a and b

defxor(a, b):

ans=""

foriinrange(len(a)):

ifa[i] ==b[i]:

ans=ans+"0"

else:

ans=ans+"1"

returnans

# Table of Position of 64 bits at initial level: Initial Permutation Table

initial_perm=[58, 50, 42, 34, 26, 18, 10, 2,

60, 52, 44, 36, 28, 20, 12, 4,


62, 54, 46, 38, 30, 22, 14, 6,

64, 56, 48, 40, 32, 24, 16, 8,

57, 49, 41, 33, 25, 17, 9, 1,

59, 51, 43, 35, 27, 19, 11, 3,

61, 53, 45, 37, 29, 21, 13, 5,

63, 55, 47, 39, 31, 23, 15, 7]

# Expansion D-box Table

exp_d=[32, 1, 2, 3, 4, 5, 4, 5,

6, 7, 8, 9, 8, 9, 10, 11,

12, 13, 12, 13, 14, 15, 16, 17,

16, 17, 18, 19, 20, 21, 20, 21,

22, 23, 24, 25, 24, 25, 26, 27,

28, 29, 28, 29, 30, 31, 32, 1]

# Straight Permutation Table

per =[16, 7, 20, 21,

29, 12, 28, 17,

1, 15, 23, 26,

5, 18, 31, 10,

2, 8, 24, 14,

32, 27, 3, 9,

19, 13, 30, 6,

22, 11, 4, 25]

# S-box Table

sbox=[[[14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7],

[0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8],

[4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0],

[15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13]],


[[15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10],

[3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5],

[0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15],

[13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9]],

[[10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8],

[13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1],

[13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7],

[1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12]],

[[7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15],

[13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9],

[10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4],

[3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14]],

[[2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9],

[14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6],

[4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14],

[11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3]],

[[12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11],

[10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8],

[9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6],

[4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13]],

[[4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1],

[13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6],

[1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2],


[6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12]],

[[13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7],

[1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2],

[7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8],

[2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11]]]

# Final Permutation Table

final_perm=[40, 8, 48, 16, 56, 24, 64, 32,

39, 7, 47, 15, 55, 23, 63, 31,

38, 6, 46, 14, 54, 22, 62, 30,

37, 5, 45, 13, 53, 21, 61, 29,

36, 4, 44, 12, 52, 20, 60, 28,

35, 3, 43, 11, 51, 19, 59, 27,

34, 2, 42, 10, 50, 18, 58, 26,

33, 1, 41, 9, 49, 17, 57, 25]

defencrypt(pt, rkb, rk):

pt =hex2bin(pt)

# Initial Permutation

pt =permute(pt, initial_perm, 64)

print("After initial permutation", bin2hex(pt))

# Splitting

left =pt[0:32]

right =pt[32:64]

foriinrange(0, 16):
# Expansion D-box: Expanding the 32 bits data into 48 bits

right_expanded=permute(right, exp_d, 48)

# XOR RoundKey[i] and right_expanded

xor_x=xor(right_expanded, rkb[i])

# S-boxex: substituting the value from s-box table by calculating row


and column

sbox_str=""

forj inrange(0, 8):

row =bin2dec(int(xor_x[j *6] +xor_x[j *6+5]))

col =bin2dec(

int(xor_x[j *6+1] +xor_x[j *6+2] +xor_x[j *6+3] +xor_x[j


*6+4]))

val=sbox[j][row][col]

sbox_str=sbox_str+dec2bin(val)

# Straight D-box: After substituting rearranging the bits

sbox_str=permute(sbox_str, per, 32)

# XOR left and sbox_str

result =xor(left, sbox_str)

left =result

# Swapper

if(i !=15):

left, right =right, left

print("Round ", i+1, " ", bin2hex(left),

" ", bin2hex(right), " ", rk[i])


# Combination

combine =left +right

# Final permutation: final rearranging of bits to get cipher text

cipher_text=permute(combine, final_perm, 64)

returncipher_text

pt ="123456ABCD132536"

key ="AABB09182736CCDD"

# Key generation

# --hex to binary

key =hex2bin(key)

# --parity bit drop table

keyp=[57, 49, 41, 33, 25, 17, 9,

1, 58, 50, 42, 34, 26, 18,

10, 2, 59, 51, 43, 35, 27,

19, 11, 3, 60, 52, 44, 36,

63, 55, 47, 39, 31, 23, 15,

7, 62, 54, 46, 38, 30, 22,

14, 6, 61, 53, 45, 37, 29,

21, 13, 5, 28, 20, 12, 4]

# getting 56 bit key from 64 bit using the parity bits

key =permute(key, keyp, 56)

# Number of bit shifts


shift_table=[1, 1, 2, 2,

2, 2, 2, 2,

1, 2, 2, 2,

2, 2, 2, 1]

# Key- Compression Table : Compression of key from 56 bits to 48 bits

key_comp=[14, 17, 11, 24, 1, 5,

3, 28, 15, 6, 21, 10,

23, 19, 12, 4, 26, 8,

16, 7, 27, 20, 13, 2,

41, 52, 31, 37, 47, 55,

30, 40, 51, 45, 33, 48,

44, 49, 39, 56, 34, 53,

46, 42, 50, 36, 29, 32]

# Splitting

left =key[0:28] # rkb for RoundKeys in binary

right =key[28:56] # rk for RoundKeys in hexadecimal

rkb=[]

rk=[]

foriinrange(0, 16):

# Shifting the bits by nth shifts by checking from shift table

left =shift_left(left, shift_table[i])

right =shift_left(right, shift_table[i])

# Combination of left and right string

combine_str=left +right
# Compression of key from 56 to 48 bits

round_key=permute(combine_str, key_comp, 48)

rkb.append(round_key)

rk.append(bin2hex(round_key))

print("Encryption")

cipher_text=bin2hex(encrypt(pt, rkb, rk))

print("Cipher Text : ", cipher_text)

print("Decryption")

rkb_rev=rkb[::-1]

rk_rev=rk[::-1]

text =bin2hex(encrypt(cipher_text, rkb_rev, rk_rev))

print("Plain Text : ", text)

# This code is contributed by Aditya Jain

Output
...60AF7CA5
Round 12 FF3C485F 22A5963B C2C1E96A4BF3
Round 13 22A5963B 387CCDAA 99C31397C91F
Round 14 387CCDAA BD2DD2AB 251B8BC717D0
Round 15 BD2DD2AB CF26B472 3330C5D9A36D
Round 16 19BA9212 CF26B472 181C5D75C66D

Cipher Text: C0B7A8D05F3A829C

Decryption

After initial permutation: 19BA9212CF26B472


After splitting: L0=19BA9212 R0=CF26B472
Round 1 CF26B472 BD2DD2AB 181C5D75C66D
Round 2 BD2DD2AB 387CCDAA 3330C5D9A36D
Round 3 387CCDAA 22A5963B 251B8BC717D0
Round 4 22A5963B FF3C485F 99C31397C91F
Round 5 FF3C485F 6CA6CB20 C2C1E96A4BF3
Round 6 6CA6CB20 10AF9D37 6D5560AF7CA5
Round 7 10AF9D37 308BEE97 02765708B5BF
Round 8 308BEE97 A9FC20A3 84BB4473DCCC
Round 9 A9FC20A3 2E8F9C65 34F822F0C66D
Round 10 2E8F9C65 A15A4B87 708AD2DDB3C0
Round 11 A15A4B87 236779C2 C1948E87475E
Round 12 236779C2 B8089591 69A629FEC913
Round 13 B8089591 4A1210F6 DA2D032B6EE3
Round 14 4A1210F6 5A78E394 06EDA4ACF5B5
Round 15 5A78E394 18CA18AD 4568581ABCCE
Round 16 14A7D678 18CA18AD 194CD072DE8C

Plain Text: 123456ABCD132536


Output:
Encryption:

After initial permutation: 14A7D67818CA18AD


After splitting: L0=14A7D678 R0=18CA18AD

Round 1 18CA18AD 5A78E394 194CD072DE8C


Round 2 5A78E394 4A1210F6 4568581ABCCE
Round 3 4A1210F6 B8089591 06EDA4ACF5B5
Round 4 B8089591 236779C2 DA2D032B6EE3
Round 5 236779C2 A15A4B87 69A629FEC913
Round 6 A15A4B87 2E8F9C65 C1948E87475E
Round 7 2E8F9C65 A9FC20A3 708AD2DDB3C0
Round 8 A9FC20A3 308BEE97 34F822F0C66D
Round 9 308BEE97 10AF9D37 84BB4473DCCC
Round 10 10AF9D37 6CA6CB20 02765708B5BF
Round 11 6CA6CB20 FF3C485F 6D5560AF7CA5
Round 12 FF3C485F 22A5963B C2C1E96A4BF3
Round 13 22A5963B 387CCDAA 99C31397C91F
Round 14 387CCDAA BD2DD2AB 251B8BC717D0
Round 15 BD2DD2AB CF26B472 3330C5D9A36D
Round 16 19BA9212 CF26B472 181C5D75C66D

Cipher Text: C0B7A8D05F3A829C

Decryption

After initial permutation: 19BA9212CF26B472


After splitting: L0=19BA9212 R0=CF26B472

Round 1 CF26B472 BD2DD2AB 181C5D75C66D


Round 2 BD2DD2AB 387CCDAA 3330C5D9A36D
Round 3 387CCDAA 22A5963B 251B8BC717D0
Round 4 22A5963B FF3C485F 99C31397C91F
Round 5 FF3C485F 6CA6CB20 C2C1E96A4BF3
Round 6 6CA6CB20 10AF9D37 6D5560AF7CA5
Round 7 10AF9D37 308BEE97 02765708B5BF
Round 8 308BEE97 A9FC20A3 84BB4473DCCC
Round 9 A9FC20A3 2E8F9C65 34F822F0C66D
Round 10 2E8F9C65 A15A4B87 708AD2DDB3C0
Round 11 A15A4B87 236779C2 C1948E87475E
Round 12 236779C2 B8089591 69A629FEC913
Round 13 B8089591 4A1210F6 DA2D032B6EE3
Round 14 4A1210F6 5A78E394 06EDA4ACF5B5
Round 15 5A78E394 18CA18AD 4568581ABCCE
Round 16 14A7D678 18CA18AD 194CD072DE8C

Plain Text: 123456ABCD132536


35.program
Implementing the RSA algorithm in Python
In this tutorial, we will be using rsa python package. Open your terminal and use the command
below to install it:

pip install rsa


Once the package is downloaded, the first thing we need to do is to import rsa into our program:
import rsa
We will start by implementing two helper methods to generate the private and public keys. The keys
will be a tuple of public and private keys, and then write the keys into files.
To write the keys into the files, we will create a folder named Keys in our project folder.
The Keys folder will have two files for holding private and public keys; one key in each file.
We will implement this using the code below:
defgenerateKeys():
(publicKey, privateKey) =rsa.newkeys(1024)
withopen('keys/publcKey.pem', 'wb') as p:
p.write(publicKey.save_pkcs1('PEM'))
withopen('keys/privateKey.pem', 'wb') as p:
p.write(privateKey.save_pkcs1('PEM'))
Now that we have saved the keys in our files, the next thing we need to do is to load the keys.
To load the keys, we will use the code snippet below that opens the files that we created above,
and return both the private and public keys:
defloadKeys():
withopen('keys/publicKey.pem', 'rb') as p:
publicKey=rsa.PublicKey.load_pkcs1(p.read())
withopen('keys/privateKey.pem', 'rb') as p:
privateKey=rsa.PrivateKey.load_pkcs1(p.read())
returnprivateKey, publicKey
Next, create two other methods to encrypt and decrypt our message.
Start by creating the encryption method using the code below. The encrypt method will take the
message and the encryption key.
After defining the encrypt method, we need to return the encrypted message. We will encode
the message in ASCII and give it the key:
defencrypt(message, key):
returnrsa.encrypt(message.encode('ascii'), key)
Let us now create the decryption method. This method will take the ciphertext and the key to
decrypt. What we will do is to try and decrypt the message and return the decrypted message.
Since we used the ASCII encoding, we will use ASCII decoding as well.
If this fails, it means that the key was not able to decrypt the message, so what we will do is
return false. We will use the code below to implement the decryption method.
defdecrypt(ciphertext, key):
try:
returnrsa.decrypt(ciphertext, key).decode('ascii')
except:
returnFalse
Finally, we will create two methods to sign and verify our message with a key using the sha1
hash function. This method will take the message and the key so that we sign our message with
a key.
The message that we will encode will be given the key and our hashing algorithm. In this
case, SHA-1.
The sign method is implemented using the code below:
defsign(message, key):
returnrsa.sign(message.encode('ascii'), key, 'SHA-1')
For the verification of the message, we will create the verify method and pass in the message,
the signature to verify, and the key. So, what we need to do is to try to verify our message.
This verify method returns the hash algorithm used in the signature. So, what we do is to check
that this is equal to the hash algorithm, i.e; SHA-1.
If the signature is authentic, then it returns true. In case there is an exception, it will return false
which means that the verification has failed. This means either the message or the signature
were manipulated and are not authentic.
defverify(message, signature, key):
try:
returnrsa.verify(message.encode('ascii'), signature, key,)
=='SHA-1'
except:
returnFalse
Now that we have the RSA algorithm, we will create our program. We will start by generating our
keys.
We will call the generate keys method, load the public and private keys as implemented in the code
below:
generateKeys()
publicKey, privateKey=load_keys()
We will then take the message input from the user, and encrypt the message using the public
key. This represents the sender of the message:
message =input('Write your message here:')
ciphertext =encrypt(message, publicKey)
Now that we have the ciphertext, we will generate the signatures using the code below to sign
the message with our private key. This enables the sender to verify the message with the public
key and determine if the message is authentic:
signature =sign(message, privateKey)
Next, we will decrypt our encrypted message to have plain text. To implement this, we will
create a decryption method and pass it in the ciphertext and the private key as shown below:
text =decrypt(ciphertext, privateKey)
After getting our plain text, the next thing to do is to print out the ciphertext and the signature.
print(f'Cipher text: {ciphertext}')
print(f'Signature: {signature}')

We will check the plain text in the next step. If it is plain text, then we
indicate message was successfully decrypted otherwise, unable to decrypt
the message:

if text:
print(f'Message text: {text}')
else:
print(f'Unable to decrypt the message.')
We verify our signature using the code below:
ifverify(text, signature, publicKey):
print(Successfully verified signature)
else:
print('The message signature could not be verified')
With that, you can enter your message, encrypt, and then decrypt it.
36.program
1. Learn to Inspect Message Headers
Your email message headers are usually hidden by default, but you can Google ways to view the
original message headers for your specific email client. For example, if you’re using the Outlook
365 email client:
 Double-click on an email to open it in a new window.
 Go to the File menu and select Properties.
 In the Properties window, you’ll see a field at the bottom that contains email header
information.

Once you can see the headers, look for the “Received From” field that tracks the route the
message traveled across the net via servers to reach you. If you get a suspicious email, search
for the sender’s IP and do a reverse lookup to trace the message back to where it originated. You
can also check if the message fails sender policy framework (SPF) and domain keys
identification mail (DKIM) checks.

Though most mail programs have email security indications like a red question mark for
unauthenticated emails in Gmail, knowing how to examine email headers is a useful skill to
have.

2. Avoid Clicking on Links or Downloading Attachments


As most of us know, email security’s biggest weakness often boils down to human error. This
fact is continuously hammered into our brains by security experts and tech gurus. However,
getting too curious to know what an attachment is, or being too absentminded to notice that
we’ve accidentally clicked on a link are not impossible scenarios. Even the best of us can fall
prey to phishing attacks — at least, the well-crafted ones. This is why, in addition to having
spam filters and antimalware installed, we must be careful not to open any attachments or click
on links from unknown senders (or attackers pretending to be Gary from the accounts
department).

3. Update Your DMARC Records With the Domain Registrar


DMARC, aside from running checks on the messages using SPF and DKIM standards, is the only
method that informs a receiving server of the action it should take in the event that a message
fails these tests. If you’re a domain owner, besides configuring SPF and DKIM, consider setting
up DMARC records with your domain registrar. iIn case you’re unsure about the process, they
should be able to help you with it.
Neither SPF nor DKIM can prevent attackers from forging the “From” address that you see
displayed in your inbox. However, DMARC verifies that the “from” matches the return-path
checked by SPF and the domain name in the DKIM signature.

4. Test Your SMTP Server


To do this, try sending test emails to see how it responds to genuine and spam messages alike
by monitoring the SPF, DMARC records. If it’s possible to tweak the SMTP configurations,
change the default settings and update them with more secure alternatives (starting with
changing default admin usernames and passwords).
5. Make Use of SMTP SSL/TLS Ports
SMTPS traditionally has used port 465 as a way to secure SMTP at the transport layer by
running it over a TLS connection. When we refer to an SMTP SSL port (or, more accurately,
SMTP TLS port), that’s exactly what we mean — it’s a way to have a secure exchange of
messages between the email client and the email server over SSL/TLS channels.
TLS implementation can be done using two approaches – opportunistic TLS or forced TLS. With
opportunistic (explicit) TLS, we try to shift from the use of unencrypted SMTP to a secure TLS
encrypted channel utilizing the STARTTLS SMTP command. If the attempt fails, the transmission
resumes in plain text, meaning without the use of any encryption. However, with forced
(implicit) TLS, the email client and server are either able to negotiate an encryption version they
can both support, or the transmission stops and the email communication doesn’t progress. You
can make your choice depending on whether you want maximum deliverability or maximum
privacy.
The Internet Assigned Numbers Authority (IANA) had registered port 465 for SMTPS, though it
was never published as an official SMTP channel by the Internet Engineering Task Force (IETF).
A new service had been assigned to port 465 by the end of 1998. while 465 functioned as a
secure SMTP port, port 25 continues to be used as the default port for SMTP relaying. ISPs and
hosting providers have restricted the use of port 25 for SMTP connections (to send mails across
the net), and most modern email clients don’t use this port at all. Unless you’re managing a mail
server (a message transfer agent or an MTA), typically, you should see no traffic over this port.
Port 587, along with TLS encryption, should be used as the default secure SMTP port for
message submission as recommended by IETF in accordance with RFC 6409 that separates
message submission (port 587) from message relay (port 25). Because many legacy systems
continue using port 465 for SMTPS, you may still be able to find support for it from your ISP or
hosting provider, but it is not recommended to use this port. Lastly, if port 587 is blocked, port
2525 though not officially recognized, is a commonly used alternative supported by most email
service providers.

6. Deploy End-to-End Encryption for Maximum Email Security


With the note from the authors of RFC 5321 in mind, a note that indicates that SMTP mail is
inherently insecure, consider using end-to-end encryption standards like S/MIME or PGP to
encrypt messages on the sender’s device, as well as during transmission. This ensures that even
if the message falls into the hands of an attacker, all they see is garbled data that makes no
sense.
An additional benefit of using an S/MIME certificate (or email signing certificate, as it’s also
known) is that it enables you to add a digital signature. This verifies the authenticity of the
sender and validates message integrity.

7. Use TLS With IMAP and POP3


So, what’s POP3 and IMAP? The internet access message protocol (IMAP) and post office
protocol (POP3, indicating version 3) deal with retrieving the messages from the receiving
server. These are the protocols used by email clients like Outlook when getting your emails
from mail servers. While IMAP syncs messages across all of your devices, POP3 downloads the
message onto a single machine so that it’s available offline before deleting it from the server.
Encrypted POP3 connections use port 995 (also known as POP3S), and IMAPS uses port 993.

8. Maintain IP Blacklists to Block Targeted Spams


If you’re frequently the target of junk and spam messages from IP addresses that share
unsolicited marketing and sales pitches, it makes sense to block them on your email server.
To do this, you can use DNS blacklists (e.g., DNSBL, Spamhaus, etc.) or spam URI real-time block
lists (e.g., SURBL, URIBL, etc.). A quick Google search will show you a bunch of available options,
but be careful utilizing these kinds of tools — they’re not free of controversies and may
inadvertently block some legitimate emails.

9. Use Restrictive Mail Relay Options


You don’t want to be an open relay because any spammer from anywhere in the world can use
your server and resources for spamming others. The mail relay parameter specifies for which
domains or IPs your server can forward mail. Configure these options with the utmost care if
you wish to avoid getting on a blacklist.
10. Other Considerations to Improve Email Security
Some additional email security considerations that may come in handy include but are not
limited to the following:
 Limit the number of connections to your SMTP server. You can do this based upon usage
and server hardware specifications as these checks can prevent denial of service stacks.
 Define a failover configuration for MX records. Whenever possible, have a failover
configuration when listing MX records to improve availability.
 Set up reverse DNS lookup to block IPs when authentication fails. Activate reverse DNS
lookup that blocks emails if an IP mismatch occurs between the hostname and domain
name of the sender.
Final Thoughts on Email Security
With attackers taking advantage of the global health crisis, email security has emerged as a
primary concern area. Barracuda Networks reports having detected 467,825 cases of spear-
phishing attacks since the beginning of March. While the numbers are certainly alarming, the
good news is that these numbers can plummet by properly training employees on simulated
attack scenarios, especially at a time when most employees are telecommuting to work.
Hopefully, the above pointers on secure SMTP will come in handy while configuring mail
servers, or to exercise caution if you happen to receive any suspicious emails.
Top of Form
Bottom of Form

37.program

What is SQL injection (SQLi)?


SQL injection (SQLi) 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.
In some situations, an attacker can escalate a SQL injection attack to compromise the underlying
server or other back-end infrastructure, or perform a denial-of-service attack.

SQL injection examples


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 a 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.

Following are some steps for SQL injection attack:


1. The attacker looks for the webpages that allow submitting data, that is, login page,
search page, feedback, etc. The attacker also looks for the webpages that display the
HTML commands such as POST or GET by checking the site's source code.
2. To check the source code of any website, right click on the webpage and click on "view
source" ,source code is displayed in the notepad. The attacker checks the source code of
the HTML, and look for "FORM" tag in the HTML code. Everything between
the <FORM><����> and </FORM></����>have potential parameters that
might be useful to find the vulnerabilities.
3. The attacker inputs a single quote under the text box provided on the webpage to accept
the username and password. This checks whether the user-input variable is sanitized or
interpreted literally by the server. If the response is an error message such as use
"a"="a" (or something similar) then the website is found to be susceptible to an SQL
injection attack.
4. The attacker uses SQL commands such as SELECT statement command to retrieve data
from the database or INSERT statement to add information to the database.

How to detect SQL injection vulnerabilities


The majority of SQL injection vulnerabilities can be found quickly and reliably using Burp
Suite's web vulnerability scanner.
SQL injection can be detected manually by using a systematic set of tests against every entry
point in the application. This typically involves:
 Submitting the single quote character ' and looking for errors or other anomalies.
 Submitting some SQL-specific syntax that evaluates to the base (original) value of the
entry point, and to a different value, and looking for systematic differences in the
resulting application responses.
 Submitting Boolean conditions such as OR 1=1 and OR 1=2, and looking for differences
in the application's responses.
 Submitting payloads designed to trigger time delays when executed within a SQL query,
and looking for differences in the time taken to respond.
 Submitting OAST payloads designed to trigger an out-of-band network interaction when
executed within a SQL query, and monitoring for any resulting interactions.
38.program
Diffie Hellman Key Exchange Algorithm for Key Generation
The algorithm is based on Elliptic Curve Cryptography, a method of doing public-key
cryptography based on the algebra structure of elliptic curves over finite fields. The DH also
uses the trapdoor function, just like many other ways to do public-key cryptography. The simple
idea of understanding to the DH Algorithm is the following.

1. The first party picks two prime numbers, g and p and tells them to the second party.
2. The second party then picks a secret number (let’s call it a), and then it computes ga mod p
and sends the result back to the first party; let’s call the result A. Keep in mind that the secret
number is not sent to anyone, only the result is.
3. Then the first party does the same; it selects a secret number b and calculates the result B
similor to the
4. step 2. Then, this result is sent to the second party.
5. The second party takes the received number B and calculates Ba mod p
6. The first party takes the received number A and calculates Ab mod p
This is where it gets interesting; the answer in step 5 is the same as the answer in step 4. This means
both parties will get the same answer no matter the order of exponentiation.
(ga mod p)b mod p = gab mod p
(gb mod p)a mod p = gba mod p
The number we came within steps 4 and 5 will be taken as the shared secret key. This key can be
used to do any encryption of data that will be transmitted, such as blowfish, AES, etc.

Diffie Hellman Algorithm


1. key =(YA)XBmod q -> this is the same as calculated by B
2. Global Public Elements
 q: q is a prime number
 a: a < q and α is the primitive root of q
3. Key generation for user A
 Select a Private key XA Here, XA <q
Now, Calculation of Public key YA YA = aXA mod q
4. Key generation for user B
 Select a Private key XB Here, XB <q
Now, Calculation of Public key YB YB = aXb mod q
5. Calculation of Secret Key by A
 key =(YB)XA mod q
 Calculation of Secret Key by B

39.program

Algorithm

RSA Key Generation:


 Choose two large prime numbers p and q
 Calculate n=p*q
 Select public key e such that it is not a factor of (p-1)*(q-1)
 Select private key d such that the following equation is true (d*e)mod(p-1)(q-1)=1 or d
is inverse of E in modulo (p-1)*(q-1)
RSA Digital Signature Scheme: In RSA, d is private; e and n are public.
 Alice creates her digital signature using S=M^d mod n where M is the message
 Alice sends Message M and Signature S to Bob
 Bob computes M1=S^e mod n
 If M1=M then Bob accepts the data sent by Alice.
 Below is the implementation.
 Python3

# Function to find gcd

# of two numbers

defeuclid(m, n):

ifn ==0:

returnm

else:

r =m %n

returneuclid(n, r)

# Program to find

# Multiplicative inverse

defexteuclid(a, b):

r1 =a

r2 =b

s1 =int(1)

s2 =int(0)

t1 =int(0)

t2 =int(1)

whiler2 >0:
q =r1//r2

r =r1-q *r2

r1 =r2

r2 =r

s =s1-q *s2

s1 =s2

s2 =s

t =t1-q *t2

t1 =t2

t2 =t

ift1 <0:

t1 =t1 %a

return(r1, t1)

# Enter two large prime

# numbers p and q

p =823

q =953

n =p *q

Pn=(p-1)*(q-1)

# Generate encryption key

# in range 1<e<Pn

key =[]

foriinrange(2, Pn):
gcd=euclid(Pn, i)

ifgcd==1:

key.append(i)

# Select an encryption key

# from the above list

e =int(313)

# Obtain inverse of

# encryption key in Z_Pn

r, d =exteuclid(Pn, e)

ifr ==1:

d =int(d)

print("decryption key is: ", d)

else:

print("Multiplicative inverse for\

the given encryption key does not\

exist. Choose a different encryption key ")

# Enter the message to be sent

M =19070

# Signature is created by Alice

S =(M**d) %n
# Alice sends M and S both to Bob

# Bob generates message M1 using the

# signature S, Alice's public key e

# and product n.

M1 =(S**e) %n

# If M = M1 only then Bob accepts

# the message sent by Alice.

ifM ==M1:

print("As M =M1, Accept the\

message sent by Alice")

else:

print("As M notequal to M1,\

Do notaccept the message\

sent by Alice ")

Output:
decryption key is: 160009
As M = M1, Accept the message sent by Alice
40.program
Linear Congruential Generator is most common and oldest algorithm for generating pseudo-
randomized numbers. The generator is defined by the recurrence relation:
Xn+1 = (aXn + c) mod m
where X is the sequence of pseudo-random values
m, 0 <m - modulus
a, 0 < a <m - multiplier
c, 0 ≤ c <m - increment
x0, 0 ≤ x0<m - the seed or start value
We generate the next random integer using the previous random integer, the integer constants,
and the integer modulus. To get started, the algorithm requires an initial Seed, which must be
provided by some means. The appearance of randomness is provided by performing modulo
arithmetic.

#include <random>
#include <iostream>

int main() {
std::random_devicerd;
std::mt19937 mt(rd());
std::uniform_real_distribution<double>dist(1.0, 10.0);
for (int i=0; i<16; ++i)
std::cout<<dist(mt) << "\n";
}

// variation
int main(int argc, char const *argv[])
{
short newnum;
short randmax = argc> 1 ? stoi(argv[1]) : 10;;
cout<< "randmax: " <<randmax<<endl;

std::random_devicerd;
std::mt19937 mt(rd());
std::uniform_real_distribution<double>udist(0, randmax); // dist(1.0, 10.0)

for (int i = 0; i< 7; ++i)


{
newnum = udist(mt);
cout<<newnum<< "\t" <<endl;
}
}

C++11 has much more powerful random-number generation facilities. Here's an example:

#include <random>
#include <functional>

std::size_tget_seed(); // whatever is the preferred way of obtaining a seed

typedef std::mt19937 engine_type; // a Mersenne twister engine


std::uniform_int_distribution<engine_type::result_type>udist(0, 200);

engine_type engine;

int main()
{
// seed rng first:
engine_type::result_type const seedval = get_seed();
engine.seed(seedval);

// bind the engine and the distribution


auto rng = std::bind(udist, engine);

// generate a random number


auto random_number = rng();

return random number;


}

41.program
What is Cyber Law?
Cyber laws, more commonly known as internet laws, are laws that are related to legal
informatics, regulating the digital distribution of information, e-commerce, software, and
information security. It usually covers many related areas, such as usage and access to the
Internet, freedom of speech, and privacy.
Why Cybercrime Laws?
Many security and privacy issues arise with the use of the internet. Ingenious criminals have
been known to use advanced strategies to carry out unauthorized activities and potential fraud.
Therefore, the need to protect against them is substantial, and the most effective method of
doing so is to enforce a cyber security policy. These policies and laws are made to protect
individuals and businesses online by holding these criminals accountable for their malicious
actions and sentencing them to appropriate punishment as decided by the federal government.

Role of Cyber Laws in Cybersecurity


Cyber laws are integral to the use of the internet and serve a variety of purposes. Most of these
laws are there to protect users from becoming victims of cybercrimes, while others are made to
regulate the usage of the internet and computers in general. Cyber laws cover these three
primary areas:
1. Fraud: Cyber laws protect users from falling victim to online fraud. They exist to prevent
crimes such as credit card and identity theft. These laws also declare federal and state
criminal charges for anyone that attempts to commit such fraud.
2. Copyright: Cyber laws also prevent copyright infringement and enforce copyright
protection. They provide individuals and businesses with the right to protect their
creative works and to profit from them.
3. Defamation: Cyber laws are also enforced in online defamation cases, which provide
individuals and businesses protection against false allegations made online that can be
harmful to their reputations.
Cybersecurity Laws
Cybersecurity or cyber-crime law comprises directives that safeguard information
technology with the purpose of forcing companies and organizations to protect their systems
and information from cyberattacks using numerous measures. Below, we will take a quick look
at the several types of international cyber law and cybercrime regulations in India, the United
States, and the European Union.

Cyber Security Laws in India


India has four predominant laws when it comes to cybersecurity:
 Information Technology Act (2000): Enacted by the parliament of India, the information
technology act was made to safeguard the e-governance, e-banking, and e-commerce
sectors; but now, its scope has been enhanced to encompass all the latest
communication devices.
 Indian Penal Code (IPC) (1980): This cybercrime prevention act has primary relevance
to cyber frauds concerning identity theft and other sensitive information theft.
 Companies Act (2013): With the companies act enacted back in 2013, the legislature
ensured that all the regulatory compliances are covered, including e-discovery, cyber
forensics, and cybersecurity diligence. The Companies Act provides guidelines for the
responsibilities of the company directors and leaders concerning confirming
cybersecurity obligations.
 NIST Compliance: The Cybersecurity Framework (NCFS), authorized by the National
Institute of Standards and Technology (NIST), contains all the guidelines, standards, and
best practices necessary to responsibly address cybersecurity risks.
42.program
43.program

CYBER FORENSICS
1.

2.
3.

4.

5.
6.

7.

8.
9.

10.

44. CYBER SECURITY STANDARDS


1.
2.

3.

4.

5.
6.

7.

8.
9.

10.

45.
46.program
Check if email address valid or not in
Given a string, write a Python program to check if the string is a valid email address or not. An email
is a string (a subset of ASCII characters) separated into two parts by @ symbol, a “personal_info” and
a domain, that is personal_info@domain.
Examples:
Input:[email protected]: Valid Email

Input:[email protected]
Output: Valid Email

Input:ankitrai326.com
Output: Invalid Email
Method 1: Check for a valid email address using regular expression
This method either returns None (if the pattern doesn’t match) or re.MatchObject contains
information about the matching part of the string. This method stops after the first match, so this is
best suited for testing a regular expression more than extracting data.
1. Python3

importre

# Make a regular expression

# for validating an Email

regex =r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'

# Define a function for

# for validating an Email

defcheck(email):

# pass the regular expression

# and the string into the fullmatch() method

if(re.fullmatch(regex, email)):

print("Valid Email")

else:

print("Invalid Email")

# Driver Code

if__name__ =='__main__':
# Enter the email

email ="[email protected]"

# calling run function

check(email)

email ="[email protected]"

check(email)

email ="ankitrai326.com"

check(email)

Output

Valid Email
Valid Email
Invalid Email

47.program
View devices connected to your network and review data usage
You can check how many personal devices are connected to your Wi-Fi network in the Google
Home app or the Google Wifi app.
Check connected devices and data usage
With the Google Home app
The Google Home app shows how much data your devices upload and download. Devices that
used the network within the last 30 days will be displayed, including ones not currently
connected.
1.Open the Google Home app .
2.Tap Wi-Fi .
3.At the top, tap Devices.
4.Tap a specific device and a tab to find additional details.
 Speed: Real-time usage is how much data your device is currently using. Usage is how
much data the device has used over the selected time frame.
 Info: Device details, like connection status, IP address and MAC address.
With the Google WIFI app
Review network data usage
With Nest WIFI and Google WIFI you can review the total amount of data that has gone through
your network over different time frames: real-time, today, 7 days, and 30 days.
With the Google Home app
1. Open the Google Home app .
2. Tap Wi-Fi .
3. Tap Internet.
Real-time usage: How much data your network is currently uploading and downloading.
Usage: How much data the device has uploaded and downloaded over the selected time frame.
With the Google WIFI app
1.Open the Google WIFI app .
2.Tap Network Internet.
3.On the 'Usage' tab, near the top, tap the time frame and select the desired period. The default
is 'Real-time'.

48.program
49.program

Public-Private Cooperation in Cyberspace

Managing business in today's geopolitical context


In the face of a geopolitical crisis, concerns are growing about the threat of cyber-attacks to
global supply chains and private organizations, which are already in a precarious state due to
the Covid-19 pandemic. When a crisis occurs, business continuity and corporate resilience are
essential. Both require a company-wide response. In this context, geopolitical risk assessments
are integral to a secure IT environment.
With the advent of cyberspace, state and non-state actors have been willing to challenge the
political and economic order by using both conventional and unconventional means. Through
the use of unconventional methods, in particular cyber-attacks, state-sponsored actors and
hacktivists can achieve relative geopolitical and economic gains without the use of force. Data
breaches, espionage, sabotage, misinformation, supply-chain disruptions, and cyber-attacks are
some examples of unconventional means used by attackers. If cyberspace enables a new sphere
for state and non-state actors to engage, are cyber-attacks the continuation of politics with other
means?
Countering politically motivated cybercrime
Politically motivated cyber-attacks, however, are not easy to detect because the emergence of a
“grey zone” makes it difficult to distinguish between a non-intentional failure or a malfunction
from a cyber-attack. The emergence of private actors in cyberspace further complicates this
issue because it is unclear if an attack on a private entity constitutes an attack against a state. If
a mechanical failure or denial or service occurs during a period of geopolitical tension, the
possibility of escalation and conflict could arise.
In addition, politically motivated hacktivists may pose a threat to corporate reputation by using
social media to harm an organization and spread misinformation. Because of hacktivists' high
visibility, organizations must increase their efforts in crisis communication and internal
response. Although hacktivists do not have the same level of sophistication as nation-states,
they are usually less concerned about hiding their online tracks and tend to be much more
vocal.
A Shared Responsibility: Public/Private partnership in cyberspace
Given the current geopolitical climate, every organization must act with extreme urgency to
secure its information technology infrastructures. As rogue nations continue to foster an
environment for cybercriminals and ransomware attackers to thrive, organizations need to be
prepared and build a strong security foundation while encouraging public-private sector
cooperation regarding cyber threats.
To improve cybersecurity in key industries and critical infrastructure, organizations in the
private sector need to be prepared for an unprecedented level of malicious cyber activities and
work together with the public sector to protect critical assets. As we clearly saw in the solar
wind case, a breach can result in a national security crisis regardless of how small the company
is.

50.program

Determining the Source of Spam


How does SpamCop find the right ISP to complain to? It takes a close look at the spam message's
header lines. These headers contain information about the path an email took.
SpamCop follows the path until the point from which the spammer sent the email. From this
point, also know as an IP address, it can derive the spammer's ISP and send the report to this
ISP's abuse department.
Let's take a closer look at how this works.

Email Header and Body


Every email message consists of two parts, the body and the header. The header is like the email
envelope containing the sender's address, the recipient, the subject, and other information. The
body has the text and the attachments.
Some header information usually displayed by your email program includes:
 From: The sender's name and email address.
 To: The recipient's name and email address.
 Date: The date when the message was sent.
 Subject: The subject line.

Header Forging
The actual delivery of emails doesn't depend on any of these headers. They are just convenient.
Usually, the From line, for example, will be sent to the sender's address so you know who the
message is from and can reply quickly.
Spammers want to make sure you cannot reply easily, and certainly don't want you to know
who they are. That's why they insert fictitious email addresses in the From lines of their junk
messages.

Received Lines
The From line is useless in determining the real source of an email. You don't need to rely on it.
The headers of every email message also contain Received lines.
Email programs do not usually display these, but they can be beneficial in tracing spam.

Parsing Received Header Lines


Just like a postal letter will go through several post offices on its way from sender to recipient,
an email message is processed and forwarded by several mail servers.
Imagine every post office putting a unique stamp on each letter. The stamp would say exactly
when the mail was received, where it came from, and where it was forwarded to by the post
office. If you got the letter, you could determine the exact path taken by the letter.
This is precisely what happens with email.

Received Lines for Tracing


As a mail server processes a message, it adds a particular line to the message's header. The
Received line contains the server name and IP address of the machine the server received the
message from, and the name of the mail server.
The Received line is always at the top of the message header. To reconstruct an email's journey
from sender to a recipient, start at the topmost Received line and go down to the last one, which
is where the email originated.

Received Line Forging


Spammers know that people apply this procedure to uncover their whereabouts. They might
insert forged Received lines that point to somebody else sending the message to fool the
intended recipient.
Since every mail server will always put its Received line at the top, the spammers' forged
headers can only be at the bottom of the Received line chain. This is why you should start your
analysis at the top and not just derive the point where an email originated from the first
Received line (at the bottom).

How to Tell a Forged Received Header Line


The forged Received lines inserted by spammers look like all the other Received lines (unless
they make an obvious mistake). By itself, you can't tell a forged Received line from a genuine
one, which is where one distinct feature of Received lines comes into play. Every server notes
who it is and where it got the message from (in IP address form).
Compare what a server claims to be with what the server one notch up in the chain says it is. If
the two don't match, the earlier is a forged Received line.
In this case, the email's origin is what the server placed immediately after the forged Received
says.

Sender and Subject


First, look at the forged From line. The spammer wants to make it look like the message came
from a Yahoo! Mail account. With the Reply-To line, this From address aims to direct all
bouncing messages and angry replies to a non-existing Yahoo! Mail account.
Next, the Subject is a curious accumulation of random characters. It is barely legible and
designed to fool spam filters (every message gets a slightly different set of random characters).
Still, it is also quite skillfully crafted to get the message across despite this.

You might also like