Hi, I am having trouble with this particular problem. It is finals week , and ti
ID: 3575098 • Letter: H
Question
Hi, I am having trouble with this particular problem. It is finals week , and time is limited. I was wondering if there is someone out ther willing to help me with the solution of this problem.( JAVA )
Thank you
Problem (Phishing Scanner) Phishing is a form of identity theft in which, in an e-ma a sender posing as a trustworthy source attempts to acquire private information, such as your user names, passwords, credit-card numbers and social security number. Phishing e-mails claiming to be from popular banks, credit-card companies, auction sites, social networks and online payment services may look quite legitimate. These fraudulent messages often provide links to spoofed (fake) websites where you're asked to enter sensitive information. Search online for phishing scams. Also check out the Anti-Phishing Working Group (www antiphishing-org), and the FBI's Cyber Investigations website wwww.fbi.gov/about-us/ nvestigate/cyber/cyber), where you'll find information about the latest scams and how to protect yourself. Create a list of 30 words, phrases and company names commonly found in phishing messages. Assign a point value to each based on your estimate of its likeliness to be in a phishing message (e.g., one point if it's somewhat likely, two points if moderately likely, or three points if highly likely). Write an application that scans a file of text for these terms and phrases. For each occurrence of a keyword or phrase within the text file, add the assigned point value to the total points for that word or phrase. For each keyword or phrase found, output one line with the word or phrase, the number of occurrences and the point total. Then show the point total for the entire message. Does your program assign a high point total to some actual phishing e mails you've received? Does it assign a high point total to some legitimate e-mails you've received?
Explanation / Answer
/*
Following C++ program reads a line from input file and calculates each word number of occurences and its value based on list of word which commonly found in phishing messages maintained in input.txt file.
And input text in stored in in.txt file.
*/
/* input.txt file contains
avaya 2
nokia 1
nvidia 3
microsoft 3
google 1
codenation 2
citrix 3
thoughtworks 1
ittiam 2
amura 1
praxify 2
amazon 1
flipkart 1
facebook 1
linkedin 2
sap 3
capgemini 2
wipro 3
infosys 2
persistent 1
cybage 2
tcs 2
accenture 1
sophos 1
inautix 2
mastercard 1
visa 1
rupay 3
veritas 2
symantec 2
*/
/* in.txt file contains
avaya microsoft google google avaya thoughtworks
*/
// Program
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main ()
{
string line;
map<string,int> tm;
ifstream myfile ("input.txt");
if (myfile.is_open())
{
while ( getline (myfile,line) )
{
string arr[2];
int i = 0;
stringstream ssin(line);
string a;
string b;
while (ssin.good() && i < 31)
{
if(i%2==0)
ssin >> a;
else
{
ssin >> b;
int t=0;
if(b=="1") t=1;
if(b=="3") t=3;
if(b=="2") t=2;
tm.insert ( std::pair<string,int>(a,t) );
}
++i;
}
}
myfile.close();
}
map<string,int> m;
string input;
ifstream in("in.txt");
if(in.is_open())
{
while(getline(in,input))
{
string arr[30];
int i = 0;
stringstream ssin(input);
while (ssin.good() && i < 30)
{
ssin >> arr[i];
std::map<string,int>::iterator it2;
// it2=tm.find(arr[i]);
// int value=it2->second;
it2=m.find(arr[i]);
if (it2 != m.end())
it2->second+=1 ;
else
m.insert ( std::pair<string,int>(arr[i],1) );
++i;
}
int total=0;
map<string,int>::iterator it = m.begin();
cout<<"Word Occurrences Value ";
for (it=m.begin(); it!=m.end(); ++it)
{
std::map<string,int>::iterator it2;
it2=tm.find(it->first);
int value=it2->second;
//cout<<value;
int n=it->second;
n=n*value;
cout << it->first << " == " << it->second <<" == " <<n<< ' ';
total+=n;
}
cout<<"Total :"<<total<<" ";
}
}
else cout << "Unable to open file";
return 0;
}
/* Output :
Word Occurrences Value
avaya == 2 == 4
google == 2 == 2
microsoft == 1 == 3
thoughtworks == 1 == 1
Total :10
*/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.