CSCL Lab Final
CSCL Lab Final
CSCL Lab Final
Sankhamul, Lalitpur
c. Detection Criteria
g. Conclusion
Lab-2
Write a program to demonstrate Ceaser Cipher.
package cscl;
import java.util.*;
public class CSCL {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Ceaser_Cipher cipher = new Ceaser_Cipher();
System.out.print("Enter plaintext : ");
String ip = sc.next();
System.out.print("Enter key : ");
int key = sc.nextInt();
cipher.encrypt(ip,key);
cipher.decrypt(key);
}
}
class Ceaser_Cipher{
String total_character = "abcdefghijklmnopqrstuvwxyz",ciphertext="";
char encrypt = 0;
int encrypt_pos;
void encrypt(String plaintext,int key){
plaintext = plaintext.toLowerCase();
for(char encryption_text : plaintext.toCharArray()){
int pos= total_character.indexOf(encryption_text);
encrypt_pos = (pos + key) %26;
encrypt = total_character.charAt(encrypt_pos);
ciphertext +=encrypt;
}
System.out.println("Cipher Text : "+ciphertext);
}
void decrypt(int key){
char decrypt = 0;
String plaintext ="";
int decrypt_pos,pos=0;
for(char decryption_text : ciphertext.toCharArray()){
pos = total_character.indexOf(decryption_text);
decrypt_pos = (pos +26 - key) %26;
decrypt = total_character.charAt(decrypt_pos);
plaintext+=decrypt;
}
System.out.println("Plain Text : "+plaintext);
}
}
Output:-
Lab-3
Write a program to demonstrate Rail Fence Cipher
package cscl;
import java.util.*;
public class Deonstrate_rail_fence_cipher {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter plaintext : ");
String ip = sc.next();
System.out.print("Enter key : ");
int key = sc.nextInt();
Rail_fench rail = new Rail_fench();
rail.encryption(ip, key);
}
}
class Rail_fench{
void encryption(String text, int key){
String encrypted_text = "";
boolean check = false;
int j=0,row=key,col = text.length();
char [][] a = new char[row][col];
for(int i=0; i< col; i++){
if(j==0 || j==key-1){
check =!check;
}
a[j][i] = text.charAt(i);
if(check){
j++;
} else{
j--;
}
}
for(int i=0; i<row; i++){
for(int k=0; k<col; k++){
System.out.print(Character.toUpperCase(a[i][k])+" ");
}
System.out.println("");
}
}
}
Output:-
Lab-4
Write a program to demonstrate Message Digest Example
package cscl;
import java.security.*;
import java.util.*;
class Message_Digest {
void display(String data) throws NoSuchAlgorithmException{
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(data.getBytes());
byte[] digest = md.digest();
StringBuffer sb = new StringBuffer();
for(byte b: digest){
sb.append(String.format("%02x",b & 0xff));
}
System.out.println("SHA-256 Hash : "+sb.toString());
}
}
Output:-
The Melissa Virus, 1999
Analysis of problem:
The Melissa virus was distributed as an email attachment that, when
opened, disabled a number of safeguards in Word 97 and Word 2000. The Melissa virus,
emerging in the late 1990s, posed a significant cyber security threat through its clever
combination of social engineering and software exploitation. It spread primarily via email
attachments, capitalizing on users' curiosity and trust by masquerading as a valuable
document containing passwords. Upon opening, it took advantage of vulnerabilities in
Microsoft Word 97 and 2000, executing a malicious Visual Basic script embedded within the
document. Melissa's rapid email-spreading capabilities allowed it to automatically send itself
to the first 50 contacts in the victim's Microsoft Outlook address book, using deceptive
subject lines and body text to appear legitimate. Moreover, the virus went beyond replication;
it also disabled vital safeguards and antivirus software, rendering infected systems vulnerable
to other malware threats. Despite its destructive potential, Melissa did not target data theft or
confidentiality breaches. Instead, it focused on disruption and system instability, underlining
the critical role of user education and technical defenses in modern cyber security. In addition,
if the user had the Microsoft Outlook email program, the virus sent itself to the first 50 people
in the infected user's address book. It arrived with the subject line, "Important Message from
[the sender's username]," and body text that read: "Here is that document you asked for ...
don't show anyone else." The attachment was often named List.Doc.
The attached file itself was supposed to contain a list of passwords for various websites that
required memberships, but instead, it contained a Visual Basic script. That script copied the
infected file into a template file used by Word for custom settings and default macros. Its
rapid spread and replication could lead to system instability and performance issues. The
Melissa virus, which emerged in 1999, was primarily a mass-mailing worm that infected
computers through email attachments. It did not specifically target or cause a loss of
confidentiality.
If the recipient opened the attachment, the infecting file was read to computer storage. The
virus then created an Outlook object using the Visual Basic code, read the first 50 names in
each Outlook Global Address Book, and sent out the same infected document and email.
Detection criteria:
Effective detection criteria for the Melissa virus encompass a multi-
layered approach involving antivirus software, email filters, and security solutions. These
measures work in concert to identify the virus based on signature patterns, email distribution
behavior, and any interference with antivirus software, ultimately bolstering an organization's
ability to detect and respond to email-based threats like Melissa. Antivirus software scans
incoming email attachments and examines the content for any suspicious or malicious
macros. If a document contains macros that match the signature or behavior patterns
associated with the Melissa virus, it raises an alert or quarantines the file. Email filters and
security solutions monitor outgoing email traffic for signs of mass distribution or unusual
email behavior. If an email is detected to be spreading rapidly to a large number of recipients,
it may indicate the presence of the Melissa virus or a similar email-borne threat. Melissa had
the capability to disable certain antivirus software installed on infected systems. If the
antivirus software detects any unauthorized modifications, unusual behaviors, or sudden
termination, it may trigger an alert indicating a potential infection or tampering by a virus like
Melissa.
Recommendation for solving problem:
• Verify the authenticity of email senders before opening attachments, especially if the email
requests
sensitive information or financial transactions.
• Avoid opening executable files included as attachments.
• Set up separate servers or network segments for external-facing resources and internal
organizational
resources.
• Scan an email message's attachments for malware.
• Use desktop and network firewalls.
• Implement intrusion detection and prevention systems (IDPS) to monitor network traffic for
suspicious activities.
• Regularly monitor network activity and evaluate the effectiveness of security policies and
controls.
• Continuously update and improve security measures based on findings and emerging
threats.
• Develop and maintain an incident response plan outlining steps to take in case of a security
incident.
• Ensure that employees know how to report security incidents promptly.
Conclusion:
The Melissa Virus incident of 1999 stands as a stark reminder of the ever-present cyber
security threats in our digital age. Beyond its technical impact, it underscores the potency of
social engineering tactics, exploiting human curiosity and trust to infiltrate systems. This
event highlights the necessity for continuous user education in recognizing and thwarting
such tactics. Moreover, the virus's rapid propagation through email systems, causing
widespread disruptions, emphasizes the critical importance of robust email filtering and
security measures for prompt threat detection and mitigation. The exploitation of software
vulnerabilities in Microsoft Word and Outlook serves as a compelling case for the timely
application of software updates and patches, underlining the shared responsibility of
individuals and organizations in maintaining proactive security.
Reference
1. Gillis, A. S. (2021, December 13). Melissa virus. Retrieved from TechTarget Network:
https://www.techtarget.com/searchsecurity/definition/Melissa-virus
2. Gillis, A. S. (2021, December 13). Melissa virus. Retrieved from TechTarget Network:
https://www.techtarget.com/searchsecurity/definition/Melissa-virus
3. Officer, U. S. (1999, april 15). The Melissa Computer. Retrieved from GOA:
https://www.govinfo.gov/content/pkg/GAOREPORTS-T-AIMD-99-146/pdf/GAOREPORTS-T-
AIMD-99-146