Best Projects

Bug Trackingsystem,Books online shopping,college management system,HR management system,Internet banking,Online chat room ,Online exam,Telephone billing system,Banking application,ATM database,airways reservation system,virtual network computing ,calculator,SMTP(simple mail transfer protocol)

SMTP

//SolBean
package Bean;

import java.io.*;
import java.net.*;
import java.sql.*;
import java.util.*;

public class SolBean
{
Connection con;
Statement stat;
ResultSet rset;
String mailid,key;
String tmid,tkey;
String sql;

public boolean checkAuth(String rmailid, String rkey)
{
int flag=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:smtpdsn");
stat = con.createStatement();
sql = "Select * from smtpkey where mailid='"+rmailid+"' and authkey='"+rkey+"'";
rset = stat.executeQuery(sql);
while(rset.next())
flag = 1;
if(flag != 1)
return false;
else
return true;
}catch(SQLException se)
{
System.out.println(se);
}
catch(ClassNotFoundException ce)
{
System.out.println(ce);
}
return false;
}
public boolean checkVerify(String rmailid)
{
int flag=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:smtpdsn");
stat = con.createStatement();
sql = "Select * from smtpkey where mailid='"+rmailid+"'";
rset = stat.executeQuery(sql);
while(rset.next())
flag = 1;
if(flag == 0)
return false;
else
return true;
}catch(SQLException se)
{
System.out.println(se);
}
catch(ClassNotFoundException ce)
{
System.out.println(ce);
}
return false;
}

public int checkProcess(Vector cmdlist)
{
int i;
String temp;
String tstr=null;
Vector finalcmdlist = new Vector();
Vector finalrlist = new Vector();
String acmdlist[];
acmdlist = new String[cmdlist.size()];
cmdlist.copyInto(acmdlist);

for(i=0;i {
if(acmdlist[i].length() <= 4)
continue;
tstr = acmdlist[i].substring(0,4).trim();
tmid = acmdlist[i].substring(5).trim();
System.out.println("Cmd:"+tstr+" id:"+tmid);
if(tstr.equals("VRFY"))
{
System.out.println("inside vrfy");
boolean result = checkVerify(tmid);
System.out.println("Result : 1 "+result);
if(result == true)
{
System.out.println("ID OK");
tstr = acmdlist[++i].substring(0,4).trim();
tkey = acmdlist[i].substring(5).trim();
System.out.println("Cmd :"+tstr);
System.out.println("key:"+tkey);
if(tstr.equals("AUTH"))
{
if(checkAuth(tmid,tkey))
System.out.println("Authentication key Correct");
else
{
System.out.println("Authentication key Not Correct");
return 3; // auth key incorrect
}
}
else
{
System.out.println("Authentication key not available");
return 2; // auth key not submitted
}
}
else
return 1; // verify failure
}
}
finalrlist = rcptFilter(cmdlist);
finalcmdlist = makeCmdlist(cmdlist,finalrlist);
System.out.println("Final command list");
for(i=0;i {
temp = (String) finalcmdlist.get(i);
System.out.println(i+"->"+temp);
}
sendMail(finalcmdlist);
return 0;
}
public Vector makeCmdlist(Vector cmdlist,Vector finalrlist)
{
int i,j;
String tstr=null,str=null;
Vector finalcmdlist = new Vector();
String acmdlist[] = new String[cmdlist.size()];
cmdlist.copyInto(acmdlist);

finalcmdlist.addElement(acmdlist[0]);
finalcmdlist.addElement(acmdlist[1]);
for(i=0;i {
tstr = (String) finalrlist.get(i);
finalcmdlist.addElement(tstr);
}
System.out.println("loop 1 : "+finalcmdlist.size());
for(i=2;i {
str = acmdlist[i];
if(str.equals("DATA"))
break;
}
System.out.println("loop 2 : "+finalcmdlist.size());
finalcmdlist.addElement(str);
for(;i finalcmdlist.addElement(acmdlist[i]);
System.out.println("loop 3 : "+finalcmdlist.size());
return finalcmdlist;
}

public Vector rcptFilter(Vector cmdlist)
{
int i,j;
String temp,prv;
String tstr=null,str=null;
String srlist[];
Vector rlist = new Vector();
Vector finalrlist = new Vector();
String acmdlist[] = new String[cmdlist.size()];
cmdlist.copyInto(acmdlist);

for(i=0;i {
str = acmdlist[i];
if(acmdlist[i].length() <= 4)
continue;
tstr = acmdlist[i].substring(0,4).trim();
if(tstr.equals("RCPT"))
rlist.addElement(str);
}
srlist = new String[rlist.size()];
rlist.copyInto(srlist);
for(i=0;i for(j=i+1;j if(srlist[i].compareToIgnoreCase(srlist[j]) > 0)
{
temp = srlist[i];
srlist[i] = srlist[j];
srlist[j] = temp;
}
// System.out.println("Sorted Mail List");
// for(i=0;i// System.out.println(i+"->"+srlist[i]);
prv = "";
for(i=0;i {
if(!prv.equalsIgnoreCase(srlist[i]))
{
prv = srlist[i];
finalrlist.addElement(prv);
}
}
if(!prv.equalsIgnoreCase(srlist[i]))
finalrlist.addElement(srlist[i]);

/* System.out.println("Final Mail List");
for(i=0;i {
temp = (String) finalrlist.get(i);
System.out.println(i+"->"+temp);
}*/
return (finalrlist);
}
public void sendMail(Vector finalcmdlist)
{
String cmd=null;
int i;

Socket sock;
try
{
sock = new Socket("127.0.0.1",25);
System.out.println("Conn");
BufferedReader br =
new BufferedReader(new InputStreamReader(sock.getInputStream()));
PrintStream ps = new PrintStream(sock.getOutputStream());
for(i=0;i {
cmd = (String) finalcmdlist.get(i);
ps.println(cmd);
// System.out.println("ms : "+cmd);
}

ps.close();
sock.close();
}catch(Exception e)
{
System.out.println("Error : "+e);
}
}
}




//FMsend








OnLoad='init();'
>

Fake Mail Sending



















From:
To:
Subject:
CC:
BCC:
Message
OnClick='checkEntry();'>








//Gateway









link='lightgrey' onload='document.f1.ipaddress.focus();'>




SMTP Gateway














IP Address
Server Name














//Gatewayone









link='lightgrey' onload='document.f1.ipaddress.focus();'>




SMTP Gateway


Invalid IP Address












IP Address
Server Name















//Hack






















onmouseover="document.images['im1'].src='fm2.gif'"
onmouseout="document.images['im1'].src='fm1.gif' ">


onmouseover="document.images['im2'].src='mi2.gif'"
onmouseout="document.images['im2'].src='mi1.gif' ">


onmouseover="document.images['im3'].src='mb2.gif'"
onmouseout="document.images['im3'].src='mb1.gif' ">


onmouseover="document.images['im4'].src='ms2.gif'"
onmouseout="document.images['im4'].src='ms1.gif' ">

onmouseover="document.images['im5'].src='set2.gif'"
onmouseout="document.images['im5'].src='set1.gif' ">
onmouseover="document.images['im6'].src='sol2.gif'"
onmouseout="document.images['im6'].src='sol1.gif' ">






//key mode







Authentication Key Modification
OnLoad = 'f.mailid.focus();'
>





Authentication Key Modification










Mail ID
Old Key
New Key
Confirm Key








//key Reg







Authentication Key Registration
OnLoad = 'f.mailid.focus();'
>





Authentication Key Registration









Mail ID
Key
Confirm Key








//Mail bomb attack









OnLoad = 'f.from.focus();'
>

Mail Bomb Attack















From:
To:
Subject:
No.of Copies:
Message









//misuse of email id









OnLoad = 'init();'
>

Misuse of Mail Id

















From:
To:
Subject:
BCC:
CC:
Message











Setting







   Authentication key Registration




   Authentication key Modification





//Soloution









OnLoad='init();'
>

Send Mail






















From:
To:
Subject:
CC:
BCC:
Key:
Message
OnClick='checkEntry();'>








No comments: