Professional Documents
Culture Documents
Network & Cyber Security (639402)
Network & Cyber Security (639402)
Playfair Cipher:-
RSA Algorithm:-
AES Algorithm:-
DES Algorithm:-
}
else if(ch >= 'A' && ch <= 'Z')
{
ch = ch - key;
if(ch < 'A')
ch = ch + 'Z' - 'A' + 1;
text[i] = ch;
}
}
printf("Decrypted text: %s", text);
}
int main()
{
int choice;
printf("\n##### MENU #####\n");
printf("Enter 1 To Encryption of Caesar Cipher \n");
printf("Enter 2 To Decryption of Caesar Cipher \n");
printf("Enter 0 To Exit\n");
while(1)
{
printf("\n\nEnter The Choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\nEnter a text to Encryption : ");
scanf("%s", text);
printf("Enter key : ");
scanf("%d", &key);
encryptionCaesarCipher();
break;
case 2:
printf("\nEnter a text to Decryption : ");
scanf("%s", text);
printf("Enter key : ");
scanf("%d", &key);
decryptionCaesarCipher();
break;
case 0:
return 0;
default:
printf("Please Enter Valid Choice\n");
break;
}
}
return 0;
}
Output:-
// Function to remove all spaces in a string int removeSpaces(char* plain, int ps)
{
int i, count = 0;
for (i = 0; i < ps; i++)
if (plain[i] != ' ')
plain[count++] = plain[i]; plain[count] = '\0';
return count;
}
// a 26 character hashmap
// to store count of the alphabet dicty = (int*)calloc(26, sizeof(int)); for (i = 0; i < ks; i++) {
if (key[i] != 'j')
dicty[key[i] - 97] = 2;
}
dicty['j' - 97] = 1;
i = 0;
j = 0;
for (k = 0; k < ks; k++) {
if (dicty[key[k] - 97] == 2) {
dicty[key[k] - 97] -= 1;
keyT[i][j] = key[k]; j++;
if (j == 5) {
i++; j = 0;
}
}
}
if (a == 'j')
a = 'i'; else if (b == 'j')
b = 'i';
if (keyT[i][j] == a) {
arr[0] = i;
arr[1] = j;
}
else if (keyT[i][j] == b) { arr[2] = i;
arr[3] = j;
}
}
}
}
// Function to make the plain text length to be even int prepare(char str[], int ptrs)
{
if (ptrs % 2 != 0) {
str[ptrs++] = 'z';
str[ptrs] = '\0';
}
return ptrs;
}
}
else {
}
}
}
str[i] = keyT[a[0]][a[3]];
str[i + 1] = keyT[a[2]][a[1]];
// Key
ks = strlen(key);
ks = removeSpaces(key, ks); toLowerCase(key, ks);
// Plaintext
ps = strlen(str); toLowerCase(str, ps);
// a 26 character hashmap
// to store count of the alphabet dicty = (int*)calloc(26, sizeof(int));
i = 0;
j = 0;
for (k = 0; k < ks; k++) {
if (dicty[key[k] - 97] == 2) {
dicty[key[k] - 97] -= 1;
keyT[i][j] = key[k]; j++;
if (j == 5) {
i++; j = 0;
}
}
}
for (k = 0; k < 26; k++) { if (dicty[k] == 0) {
keyT[i][j] = (char)(k + 97); j++;
if (j == 5) {
i++; j = 0;
}
}
}
if (a == 'j')
a = 'i'; else if (b == 'j')
b = 'i';
// Function to decrypt
void decrypt(char str[], char keyT[5][5], int ps)
{
int i, a[4];
for (i = 0; i < ps; i += 2) {
search(keyT, str[i], str[i + 1], a); if (a[0] == a[2]) {
str[i] = keyT[a[0]][mod5(a[1] - 1)];
str[i + 1] = keyT[a[0]][mod5(a[3] - 1)];
}
else if (a[1] == a[3]) {
str[i] = keyT[mod5(a[0] - 1)][a[1]];
str[i + 1] = keyT[mod5(a[2] - 1)][a[1]];
}
else {
str[i] = keyT[a[0]][a[3]];
str[i + 1] = keyT[a[2]][a[1]];
}
// Function to call decrypt
void decryptByPlayfairCipher(char str[], char key[])
{
char ps, ks, keyT[5][5];
// Key
ks = strlen(key);
ks = removeSpaces(key, ks); toLowerCase(key, ks);
// ciphertext
ps = strlen(str); toLowerCase(str, ps);
ps = removeSpaces(str, ps); generateKeyTable(key, ks, keyT);
decrypt(str, keyT, ps);
}
// Driver code int main()
char str[SIZE], key[SIZE]; clrscr();
// Key to be encrypted
printf("\n key text: ");
gets(key);
// Ciphertext to be decrypted
printf("\n Cipher text: %s", str);
// encrypt using Playfair Cipher decryptByPlayfairCipher(str, key);
printf("\n Deciphered text: %s", str);
return 0;
}
Output:
WHOIS:-
WHOIS allows you to look up the name and contact information of whoever operates any
website's generic domain name. As part of the registration process, you must provide your
registrar with accurate and reliable contact details and promptly correct and update these
details as necessary.
IPConfig:-
The ipconfig command is used to display information about your network configuration and
refresh DHCP and DNS Settings. By default, the ipconfig command displays your IP Address,
Subnet Mask, and default gateway. But with correct parameters, you can get a lot more
information out of it
NsLookup:-
nslookup is a network administration command-line tool available for many computer
operating systems. Find the IP address of a host. Find the domain name of an IP address.
Find mail servers for a domain. It is used for querying the Domain Name System (DNS) to
obtain domain name or IP address mapping information The main use of nslookup is for
troubleshooting DNS related problems. Nslookup can be use in interactive and non-
interactive mode. To use in interactive mode type nslookup at the command line and hit
return.
Ping:-
The ping command sends packets of data to a specific IP address on a network, and then
lets you know how long it took to transmit that data and get a response. It’s a handy tool
that you can use to quickly test various points of your network. ping is the primary TCP/IP
command used to troubleshoot connectivity, reachability, and name resolution. Used
without parameters, this command displays Help content. You can also use this command to
test both the computer name and the IP address of the computer
Here, some are the option which we can use with ping
1. -h:-
2. -c:-We can define the number of packets to send to the server/host by using -c option.
3. -t:-
Traceroute:-
The UNIX/Linux traceroute command (tracert on a Windows computer) identifies the route
a packet takes between your computer and the destination computer specified in the
command. By default, traceroute sends three packets of data to test each 'hop' (when a
packet is passed between routers it is called a 'hop'). The Windows Tracert tool determines
the route to a destination by sendingICMP packets to the destination.
TCP:-
Practical:9.2.To Study & analyse the captured packets for different protocols
& search queries using Wireshark.
UDP:-
Melissa Virus
A few decades ago, computer viruses—and public awareness of the tricks used to unleash them—
were still relatively new notions to many Americans.
In late March 1999, a programmer named David Lee Smith hijacked an America Online (AOL)
account and used it to post a file on an Internet newsgroup named “alt.sex.” The posting promised
dozens of free passwords to fee-based websites with adult content. When users took the bait,
downloading the document and then opening it with Microsoft Word, a virus was unleashed on their
computers.
The Melissa virus, reportedly named by Smith for a stripper in Florida, started by taking over victims’
Microsoft Word program. It then used a macro to hijack their Microsoft Outlook email system and
send messages to the first 50 addresses in their mailing lists. Those messages, in turn, tempted
recipients to open a virus-laden attachment by giving it such names as “sexxxy.jpg” or “naked wife”
or by deceitfully asserting, “Here is the document you requested ... don’t show anyone else ;-).”
With the help of some devious social engineering, the virus operated like a sinister, automated chain
letter.
The virus was not intended to steal money or information, but it wreaked plenty of havoc
nonetheless. Email servers at more than 300 corporations and government agencies worldwide
became overloaded, and some had to be shut down entirely, including at Microsoft. Approximately
one million email accounts were disrupted, and Internet traffic in some locations slowed to a crawl.
Within a few days, cybersecurity experts had mostly contained the spread of the virus and restored
the functionality of their networks, although it took some time to remove the infections entirely.
Along with its investigative role, the FBI sent out warnings about the virus and its effects, helping to
alert the public and reduce the destructive impacts of the attack. Still, the collective damage was
enormous: an estimated $80 million for the cleanup and repair of affected computer systems.
Finding the culprit didn’t take long, thanks to a tip from a representative of AOL and nearly seamless
cooperation between the FBI, New Jersey law enforcement, and other partners. Authorities traced
the electronic fingerprints of the virus to Smith, who was arrested in northeastern New Jersey on
April 1, 1999. Smith pleaded guilty in December 1999, and in May 2002, he was sentenced to 20
months in federal prison and fined $5,000. He also agreed to cooperate with federal and state
authorities.
The Melissa virus, considered the fastest spreading infection at the time, was a rude awakening to
the dark side of the web for many Americans. Awareness of the danger of opening unsolicited email
attachments began to grow, along with the reality of online viruses and the damage they can do.
Like the Morris worm just over a decade earlier, the Melissa virus was a double-edged sword,
leading to enhancements in online security while serving as inspiration for a wave of even more
costly and potent cyberattacks to come.
For the FBI and its colleagues, the virus was a warning sign of a major germinating threat and of the
need to quickly ramp up its cyber capabilities and partnerships.
Fittingly, a few months after Smith was sentenced, the Bureau put in place its new national Cyber
Division focused exclusively on online crimes, with resources and programs devoted to protecting
America’s electronic networks from harm. Today, with nearly everything in our society connected to
the Internet, that cyber mission is more crucial than ever.