Virus Scanner
//*************************************** $PANKAJ VIRUS BLOCKER$ *****************************************************************************
//
// Author-Pankaj Maurya
//********************************************************************************************************************************
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.applet.AppletContext.*;
import java.util.*;
import javax.swing.event.*;
import java.lang.reflect.*;
import javax.swing.border.*;
import javax.swing.plaf.basic.*;
import java.awt.image.ImageConsumer ;
import java.awt.image.ImageObserver;
import java.applet.AudioClip;
import javax.swing.filechooser.FileView;
import java.net.*;
class Scanner
{
BufferedReader br=null;
int ans=0,point=0;
String database[]=new String[1000];
int total=0,infected=0;
String strRoot2="";
FileWriter logFile;
Date dd;
long start=-1,stop=-1;
Scanner()
{
try{
logFile=new FileWriter("Scan.log");
logFile.write("*************************** $PANKAJ VIRUS BLOCKER$ ****************************************"+"\r\n");
logFile.write(" Author- Pankaj Maurya"+"\r\n");
logFile.write("*********************************************************************************"+"\r\n");
logFile.write("User Computer File's And Folder's System"+"\r\n\n\n");
}catch(Exception gt){}
while(true)
{
total=0;
infected=0;
br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("\n\n\n**************** $Welcome to EScan Security$ ************");
System.out.println(" Author- Pankaj Maurya");
dd=new Date();
int hh=dd.getMinutes();
System.out.println("1. Scan All Drive's ");
System.out.println("2. Scan System. Drive");
System.out.println("3. Scan User Difined Drive");
System.out.println("4. Scan Folder"+ "< Not Implemented >");
System.out.println("5. Scan File" + "< Not Implemented >");
System.out.println("6. View Virus Valut");
System.out.println("7. Help");
System.out.println("8. About Us");
System.out.println("9. Exit");
try{
System.out.println("\n\nEnter Choice");
ans=Integer.parseInt(br.readLine());
}
catch(Exception f){}
//Scan All Drives
if(ans==1)
{
try{
start=System.currentTimeMillis();
FileReader rd=new FileReader("virus_database/point.dat") ;
JTextField jt=new JTextField();
jt.read(rd,null);
point=Integer.parseInt(jt.getText());
rd.close();
System.out.print("Please wait Loading Database");
for(int z=0;z<point;z++)
{
FileReader r=new FileReader("virus_database/malware"+z+".res");
JTextField jt2=new JTextField();
jt2.read(r,null);
database[z]=jt2.getText();
r.close();
int per=(z*100)/point;
//System.out.println(database[z]+" "+"["+per +"%]");
}
for(int x=0;x<4;x++)
{
for(int y=0;y<3;y++)
System.out.print(". ");
try{Thread.sleep(500);}catch(Exception gta){}
}
System.out.println("Database Load Sucessfully!");
File f=new File("c:/'.'");
File strRoot[]=f.listRoots();
System.out.println("System Drive...");
for(int k=0;k<strRoot.length;k++)
{
System.out.println(" |_"+strRoot[k]);
}
System.out.println("Start Scan...");
logFile.write("Start Scan:"+new Date()+"\r\n");
for(int iq=0;iq<strRoot.length;iq++)
{
System.out.println("\n\n\n"+strRoot[iq]+" Drive");
logFile.write("\n\n\n"+strRoot[iq]+" Drive"+"\r\n");
File ff2=new File(strRoot[iq]+"/*.*");
String ff1=ff2.getParent();
File ff=new File(ff1);
String str22[]=ff.list();
int len=str22.length;
for(int i=0;i<len;i++)
{
File fg=new File(strRoot[iq]+"/"+str22[i]);
System.out.println(" |_ "+str22[i]);
logFile.write(" |_ "+str22[i]+"\r\n");
try{Thread.sleep(100);}catch(Exception hy){}
total=total+1;
for(int io=0;io<point;io++)
{ //System.out.println("List "+database[io]);
if( database[io].equals( str22[i] ) )
{
virus v=new virus(strRoot[iq]+str22[i]);
infected=infected+1;
}
}
int iz = str22[i].lastIndexOf('.');
if( fg.isHidden() && str22[i].substring(iz+1).toLowerCase().equals("exe") || str22[i].substring(iz+1).toLowerCase().equals("msi") || str22[i].substring(iz+1).toLowerCase().equals("pif") )
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot[iq]+str22[i]);
}
String dir=fg.getParent();
File fy=new File(dir);
String name=fy.getName();
if(str22[i].equals(name+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot[iq]+str22[i]);
infected=infected+1;
}
if( fg.isDirectory() )
{
try{
File ff21=new File(strRoot[iq]+str22[i]+"/*.*");
String ff11=ff21.getParent();
//System.out.println("Directory Name:"+ff11);
File ff1a=new File(ff11);
String str221[]=ff1a.list();
int len1=str221.length;
for(int i1=0;i1<len1;i1++)
{
System.out.println(" | |_ "+str221[i1]);
logFile.write(" | |_ "+str221[i1]+"\r\n");
try{Thread.sleep(100);}catch(Exception hy){}
total=total+1;
for(int io=0;io<point;io++)
{
if( database[io].equals( str221[i1] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]);
System.out.println("2."+strRoot[iq]+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
}
File fh=new File(strRoot[iq]+str22[i]+"/"+str221[i1]);
//System.out.println("File="+strRoot[iq]+str22[i]+"/"+str221[i1]);
int iz1 = str221[i1].lastIndexOf('.');
if( fh.isHidden() && str221[i1].substring(iz1+1).toLowerCase().equals("exe") || str221[i1].substring(iz1+1).toLowerCase().equals("msi") || str221[i1].substring(iz1+1).toLowerCase().equals("pif") )
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]);
}
String dir1=fh.getParent();
File fy1=new File(dir1);
String name1=fy1.getName();
if(str221[i1].equals(name1+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
if( fh.isDirectory() )
{
File ff21a=new File(strRoot[iq]+str22[i]+"/"+str221[i1]+"/*.*");
//System.out.println("Checking File"+(String)ff21a.getName());
String ff11a=ff21a.getParent();
//System.out.println("Directory Name:"+ff11);
File ff1az=new File(ff11a);
String str221a[]=ff1az.list();
int len1a=str221a.length;
for(int i1a=0;i1a<len1a;i1a++)
{
System.out.println(" | | |_"+str221a[i1a]);
logFile.write(" | | |_"+str221a[i1a]+"\r\n");try{Thread.sleep(50);}catch(Exception hy){}
total=total+1;
for(int ioa=0;ioa<point;ioa++)
{
if( database[ioa].equals( str221a[i1a] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
//System.out.println("3."+strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
infected=infected+1;
}
}
File ffg=new File(strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
int iz11 = str221a[i1a].lastIndexOf('.');
if( ffg.isHidden() && str221a[i1a].substring(iz11+1).toLowerCase().equals("exe") || str221a[i1a].substring(iz11+1).toLowerCase().equals("msi") || str221a[i1a].substring(iz11+1).toLowerCase().equals("pif") )
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot[iq]+str22[i]);
}
String dir2=ffg.getParent();
File fy2=new File(dir2);
String name2=fy2.getName();
if(str221a[i1a].equals(name2+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
infected=infected+1;
}
if( ffg.isDirectory() )
{
File ff21a1=new File(strRoot[iq]+str22[i]+"/"+str221[i1]+"/*.*");
//System.out.println("Checking File"+(String)ff21a1.getName());
String f11=ff21a1.getParent();
System.out.println("Directory Name:"+f11);
File f111=new File(f11);
String str1z[]=f111.list();
int l1=str1z.length;
for(int z=0;z<l1;z++)
{
System.out.println(" | | | |_"+str1z[z]);try{Thread.sleep(50);}catch(Exception hy){}
logFile.write(" | | | |_"+str1z[z]+"\r\n");
total=total+1;
for(int za=0;za<point;za++)
{
if( database[za].equals( str1z[z] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]+"/"+str1z[z]);
System.out.println("3."+strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]+"/"+str1z[z] );
infected=infected+1;
}
}
}
}
}
}
}
}catch(Exception h){System.out.println(h);}
}
}
}
}catch(Exception gt){ System.out.println(gt);}
}
//Start
if(ans==2)
{
try{
start=System.currentTimeMillis();
FileReader rd=new FileReader("virus_database/point.dat") ;
JTextField jt=new JTextField();
jt.read(rd,null);
point=Integer.parseInt(jt.getText());
rd.close();
System.out.print("Please wait Loading Database");
for(int z=0;z<point;z++)
{
FileReader r=new FileReader("virus_database/malware"+z+".res");
JTextField jt2=new JTextField();
jt2.read(r,null);
database[z]=jt2.getText();
r.close();
int per=(z*100)/point;
//System.out.println(database[z]+" "+"["+per +"%]");
}
for(int x=0;x<4;x++)
{
for(int y=0;y<3;y++)
System.out.print(". ");
try{Thread.sleep(500);}catch(Exception gta){}
}
System.out.println("Database Load Sucessfully!");
File f=new File("c:/'.'");
String strRoot[]={"C:/"};
System.out.println("C: Drive...");
for(int k=0;k<1;k++)
{
System.out.println(" |_ C: Drive");
}
System.out.println("Start Scan...");
logFile.write("Start Scan:"+new Date()+"\r\n");
for(int iq=0;iq<1;iq++)
{
System.out.println("C:/ Drive");
logFile.write("\n\n\n"+"C:/"+" Drive"+"\r\n");
File ff2=new File("C:/"+"*.*");
String ff1=ff2.getParent();
File ff=new File(ff1);
String str22[]=ff.list();
int len=str22.length;
for(int i=0;i<len;i++)
{
File fg=new File("C:"+"/"+str22[i]);
System.out.println(" |_ "+str22[i]);
logFile.write(" |_ "+str22[i]+"\r\n");try{Thread.sleep(50);}catch(Exception hy){}
total=total+1;
for(int io=0;io<point;io++)
{ //System.out.println("List "+database[io]);
if( database[io].equals( str22[i] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus("C:/"+str22[i]);
infected=infected+1;
}
}
int iz = str22[i].lastIndexOf('.');
if( fg.isHidden() && str22[i].substring(iz+1).toLowerCase().equals("exe") || str22[i].substring(iz+1).toLowerCase().equals("msi") || str22[i].substring(iz+1).toLowerCase().equals("pif") || str22[i].substring(iz+1).toLowerCase().equals("int"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus("C:/"+str22[i]);
}
String dir=fg.getParent();
File fy=new File(dir);
String name=fy.getName();
if(str22[i].equals(name+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus("C:/"+str22[i]);
infected=infected+1;
}
if( fg.isDirectory() )
{
try{
File ff21=new File("C:/"+str22[i]+"/*.*");
String ff11=ff21.getParent();
System.out.println("Directory Name:"+ff11);
File ff1a=new File(ff11);
String str221[]=ff1a.list();
int len1=str221.length;
for(int i1=0;i1<len1;i1++)
{
System.out.println(" | |_ "+str221[i1]);try{Thread.sleep(50);}catch(Exception hy){}
logFile.write(" | |_ "+str221[i1]+"\r\n");
total=total+1;
for(int io=0;io<point;io++)
{
if( database[io].equals( str221[i1] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]);
System.out.println("2."+strRoot[iq]+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
}
File fh=new File("C:/"+str22[i]+"/"+str221[i1]);
int iz1 = str221[i1].lastIndexOf('.');
if( fh.isHidden() && str221[i1].substring(iz1+1).toLowerCase().equals("exe") || str221[i1].substring(iz1+1).toLowerCase().equals("msi") || str221[i1].substring(iz1+1).toLowerCase().equals("pif") || str221[i1].substring(iz1+1).toLowerCase().equals("ini"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]);
}
System.out.println("File="+strRoot[iq]+str22[i]+"/"+str221[i1]);
String dir1=fh.getParent();
File fy1=new File(dir1);
String name1=fy1.getName();
System.out.println("Check "+name1+" with "+str221[i1] );
if(str221[i1].equals(name1+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
if( fh.isDirectory() )
{
File ff21a=new File("C:/"+str22[i]+"/"+str221[i1]+"/*.*");
System.out.println("Checking File"+"C:/"+str22[i]+"/"+str221[i1]+"/*.*");
String ff11a=ff21a.getParent();
System.out.println("Directory Name:"+ff11a);
File ff1az=new File(ff11a);
String str221a[]=ff1az.list();
int len13=str221a.length;
for(int i1a=0;i1a<len13;i1a++)
{
System.out.println(" | | |_"+str221a[i1a]);
logFile.write(" | | |_"+str221a[i1a]+"\r\n");try{Thread.sleep(50);}catch(Exception hy){}
total=total+1;
for(int ioa=0;ioa<point;ioa++)
{
if( database[ioa].equals( str221a[i1a] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
//System.out.println("3."+strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
infected=infected+1;
}
}
File ffg=new File("C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
int iz11 = str221a[i1a].lastIndexOf('.');
if( ffg.isHidden() && str221a[i1a].substring(iz11+1).toLowerCase().equals("exe") || str221a[i1a].substring(iz11+1).toLowerCase().equals("msi") || str221a[i1a].substring(iz11+1).toLowerCase().equals("pif") || str221a[i1a].substring(iz11+1).toLowerCase().equals("ini"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
}
String dir2=ffg.getParent();
File fy2=new File(dir2);
String name2=fy2.getName();
if(str221a[i1a].equals(name2+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
infected=infected+1;
}
if( ffg.isDirectory() )
{
File ff21a1=new File("c:/"+str22[i]+"/"+str221[i1]+"/*.*");
//System.out.println("Checking File"+(String)ff21a1.getName());
String f11=ff21a1.getParent();
System.out.println("Directory Name:"+f11);
File f111=new File(f11);
String str1z[]=f111.list();
int l1=str1z.length;
for(int z=0;z<l1;z++)
{
System.out.println(" | | | |_"+str1z[z]);
logFile.write(" | | | |_"+str1z[z]+"\r\n");
total=total+1;
for(int za=0;za<point;za++)
{
if( database[za].equals( str1z[z] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]+"/"+str1z[z]);
System.out.println("3."+strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]+"/"+str1z[z] );
infected=infected+1;
}
}
}
}
}
}
}
}catch(Exception h){ System.out.println(h); }
}
}
}
logFile.close();
}catch(Exception gt){ System.out.println(gt);}
}
//End
if(ans==8)
{
try{
System.out.println("\n\n\n\n\n");
System.out.println("Software Name: Pankaj Virus Blocker");
try{Thread.sleep(2000);}catch(Exception hy){}
System.out.println("Version Info: 1.0.0.1");
Thread.sleep(2000);
System.out.println("Author: Pankaj Maurya");
Thread.sleep(2000);
System.out.println("Tester: Pankaj Maurya");
Thread.sleep(2000);
System.out.println("Beta Version Tester: Pankaj Maurya");
Thread.sleep(2000);
System.out.println("DFD Concept: Pankaj Maurya");
Thread.sleep(2000);
System.out.println("Database By: PANKAJ ");
Thread.sleep(2000);
System.out.println("Realising Date: ");
Thread.sleep(2000);
System.out.println("Test Start: ");
Thread.sleep(2000);
System.out.println("Test Complete: ");
Thread.sleep(2000);
System.out.println("Requirement: JDK 1.6");
Thread.sleep(2000);
System.out.println("Feedback on:");
System.out.println(" 1.pnkjmr857@gmail.com");
System.out.println(" 2.www.pankajsoftwareworld.tk ");
Thread.sleep(4000);
}catch(Exception e){}
}
if(ans==9)
{
System.exit(0);
}
if(ans==6)
{
System.out.println("\n\nVirus vault");
File ff2=new File("Virus Vault/*.*");
String ff1=ff2.getParent();
File ff=new File(ff1);
String str22[]=ff.list();
int len=str22.length;
if(len==0)
{
System.out.println(" |_ Virus vault is empty");
}
else{
for(int y=0;y<len;y++)
System.out.println(" |_"+str22[y]);
}
System.out.println("\n"+len+" File Found");
}
if(ans==3)
{
//System.out.println("Entered Two");
try{
br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the drive name to be scan (eg. D:) :");
strRoot2=br.readLine();
start=System.currentTimeMillis();
FileReader rd=new FileReader("virus_database/point.dat") ;
JTextField jt=new JTextField();
jt.read(rd,null);
point=Integer.parseInt(jt.getText());
rd.close();
System.out.print("Please wait Loading Database");
for(int z=0;z<point;z++)
{
FileReader r=new FileReader("virus_database/malware"+z+".res");
JTextField jt2=new JTextField();
jt2.read(r,null);
database[z]=jt2.getText();
r.close();
int per=(z*100)/point;
//System.out.println(database[z]+" "+"["+per +"%]");
}
for(int x=0;x<4;x++)
{
for(int y=0;y<3;y++)
System.out.print(". ");
try{Thread.sleep(500);}catch(Exception gta){}
}
System.out.println("Database Load Sucessfully!");
File f=new File(strRoot2+"/'.'");
logFile.write(strRoot2+"\r\n");
File strRoot[]=f.listRoots();
System.out.println("System Drive...");
for(int k=0;k<1;k++)
{
System.out.println(" |_"+strRoot[k]);
logFile.write(" |_"+strRoot[k]+"\r\n");try{Thread.sleep(100);}catch(Exception hy){}
}
System.out.println("Start Scan...");
for(int iq=0;iq<1;iq++)
{
System.out.println("\n\n\n"+"System "+" Drive");
File ff2=new File(strRoot2+"/*.*");
String ff1=ff2.getParent();
File ff=new File(ff1);
String str22[]=ff.list();
int len=str22.length;
for(int i=0;i<len;i++)
{
File fg=new File(strRoot2+"/"+str22[i]);
System.out.println(" |_ "+str22[i]);
logFile.write(" |_ "+str22[i]+"\r\n");
total=total+1;
for(int io=0;io<point;io++)
{ //System.out.println("List "+database[io]);
if( database[io].equals( str22[i] ) )
{
virus v=new virus(strRoot2+"/"+str22[i]);
infected=infected+1;
}
}
int iz = str22[i].lastIndexOf('.');
if( fg.isHidden() && str22[i].substring(iz+1).toLowerCase().equals("exe") || str22[i].substring(iz+1).toLowerCase().equals("msi") || str22[i].substring(iz+1).toLowerCase().equals("pif") || str22[i].substring(iz+1).toLowerCase().equals("inf"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot2+"/"+str22[i]);
}
String dirg=fg.getParent(); String dir=fg.getParent();
File fy=new File(dirg);
String name=fy.getName();
//System.out.println("Check "+name+" with "+str22[i] );
if(str22[i].equals(name+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot2+"/"+str22[i]);
infected=infected+1;
}
if( fg.isDirectory() )
{
try{
File ff21=new File(strRoot2+"/"+str22[i]+"/*.*");
String ff11=ff21.getParent();
//System.out.println("Directory Name:"+ff11);
File ff1a=new File(ff11);
String str221[]=ff1a.list();
int len1=str221.length;
for(int i1=0;i1<len1;i1++)
{
System.out.println(" | |_ "+str221[i1]);try{Thread.sleep(100);}catch(Exception hy){}
logFile.write(" | |_ "+str221[i1]+"\r\n");
total=total+1;
for(int io=0;io<point;io++)
{
if( database[io].equals( str221[i1] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]);
System.out.println("2."+strRoot2+"/"+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
}
File fh=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]);
//System.out.println("File="+strRoot2+"/"+str22[i]+"/"+str221[i1]);
int iz2 = str221[i1].lastIndexOf('.');
if( fh.isHidden() && str221[i1].substring(iz2+1).toLowerCase().equals("exe") || str221[i1].substring(iz2+1).toLowerCase().equals("msi") || str221[i1].substring(iz2+1).toLowerCase().equals("pif") || str221[i1].substring(iz2+1).toLowerCase().equals("ini"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]);
}
String dir11=fh.getParent();
File fy1=new File(dir11);
String name1=fy1.getName();
//System.out.println("Check "+name1+" with "+str221[i1] );
if(str221[i1].equals(name1+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
if( fh.isDirectory() )
{
File ff21a=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/*.*");
//System.out.println("Checking File"+(String)ff21a.getName());
String ff11a=ff21a.getParent();
System.out.println("Directory Name:"+ff11a);
File ff1az=new File(ff11a);
String str221a[]=ff1az.list();
int l2=str221a.length;
for(int i2=0;i2<l2;i2++)
{
System.out.println(" | | |_"+str221a[i2]);
logFile.write(" | | |_"+str221a[i2]+"\r\n");try{Thread.sleep(100);}catch(Exception hy){}
total=total+1;
for(int ioa=0;ioa<point;ioa++)
{
if( database[ioa].equals( str221a[i2] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
System.out.println("3."+strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
infected=infected+1;
}
}
File ffg=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
int iz1 = str221[i2].lastIndexOf('.');
if( ffg.isHidden() && str221[i2].substring(iz1+1).toLowerCase().equals("exe") || str221[i2].substring(iz1+1).toLowerCase().equals("msi") || str221[i2].substring(iz1+1).toLowerCase().equals("pif") || str221[i2].substring(iz1+1).toLowerCase().equals("inh"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
}
String dir12v=ffg.getParent();
File fy12=new File(dir12v);
String name12=fy12.getName();
//System.out.println("Check "+name12+" with "+str221a[i2] );
if(str221a[i2].equals(name12+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
infected=infected+1;
}
if( ffg.isDirectory() )
{
File ff21a1=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/*.*");
//System.out.println("Checking File"+(String)ff21a.getName());
String f11=ff21a1.getParent();
//System.out.println("Directory Name:"+f11);
try{Thread.sleep(100);}catch(Exception h){}
File f111=new File(f11);
String str1c[]=f111.list();
int l1=str1c.length;
for(int z=0;z<l1;z++)
{
System.out.println(" | | | |_"+str1c[z]);
logFile.write(" | | | |_"+str1c[z]+"\r\n");try{Thread.sleep(100);}catch(Exception hy){}
total=total+1;
for(int za=0;za<point;za++)
{
if( database[za].equals( str1c[z] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/"+str1c[z]);
System.out.println("3."+strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/"+str1c[z] );
infected=infected+1;
}
}
}
}
}
}
}
}catch(Exception fgq){}
}
// Start
if( fg.isDirectory() )
{
try{
File ff21=new File(strRoot2+"/"+str22[i]+"/*.*");
String ff11=ff21.getParent();
//System.out.println("Directory Name:"+ff11);
File ff1a=new File(ff11);
String str221[]=ff1a.list();
int len1=str221.length;
for(int i1=0;i1<len1;i1++)
{
System.out.println(" | |_ "+str221[i1]);
logFile.write(" | |_ "+str221[i1]+"\r\n");
total=total+1;
for(int io=0;io<point;io++)
{
if( database[io].equals( str221[i1] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]);
System.out.println("2."+strRoot2+"/"+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
}
File fh=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]);
//System.out.println("File="+"C:/"+str22[i]+"/"+str221[i1]);
int izz = str221[i1].lastIndexOf('.');
if( fh.isHidden() && str221[i1].substring(izz+1).toLowerCase().equals("exe") || str221[i1].substring(izz+1).toLowerCase().equals("msi") || str221[i1].substring(izz+1).toLowerCase().equals("pif") || str221[i1].substring(izz+1).toLowerCase().equals("int"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]);
}
if( fh.isDirectory() )
{
File ff21a=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/*.*");
//System.out.println("Checking File"+(String)ff21a.getName());
String ff11a=ff21a.getParent();
System.out.println("Directory Name:"+ff11a);
File ff1az=new File(ff11a);
String str221a[]=ff1az.list();
int l2=str221a.length;
for(int i2=0;i2<l2;i2++)
{
System.out.println(" | | |_"+str221a[i2]);
logFile.write(" | | |_"+str221a[i2]+"\r\n");
total=total+1;
for(int ioa=0;ioa<point;ioa++)
{
if( database[ioa].equals( str221a[i2] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
System.out.println("3."+"C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
infected=infected+1;
}
}
File ffg=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
int iz11a = str221a[i2].lastIndexOf('.');
if( fh.isHidden() && str221a[i2].substring(iz11a+1).toLowerCase().equals("exe") || str221a[i2].substring(iz11a+1).toLowerCase().equals("msi") || str221a[i2].substring(iz11a+1).toLowerCase().equals("pif") )
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
}
if( ffg.isDirectory() )
{
File ff21a1=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/*.*");
System.out.println("Checking File"+(String)ff21a.getName());
String f11=ff21a1.getParent();
System.out.println("Directory Name:"+f11);
try{Thread.sleep(100);}catch(Exception h){}
File f111=new File(f11);
String str1c[]=f111.list();
int l1=str1c.length;
for(int z=0;z<l1;z++)
{
System.out.println(" | | | |_"+str1c[z]);
total=total+1;
logFile.write(" | | | |_"+str1c[z]+"\r\n");
for(int za=0;za<point;za++)
{
if( database[za].equals( str1c[z] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/"+str1c[z]);
System.out.println("3."+"C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/"+str1c[z] );
infected=infected+1;
}
}
}
}
}
}
}
}catch(Exception fgq){}
}
// End
}
}
}catch(Exception fg){}
}
//End
if(ans==1)
{
File fw=new File("c:/'.'");
stop = System.currentTimeMillis() - start;
long lg = stop/1000;
long sec=lg;
File strRoot1[]=fw.listRoots();
System.out.print("\n\n\nScan Drives :");
for(int p=0;p<strRoot1.length;p++)
{
System.out.print(strRoot1[p]+" ");
}
System.out.println("\nTotal Files="+ total+" File's");
System.out.println("Total Scan Files="+ total+" File's");
System.out.println("Total Infected Files="+ infected+" File's");
System.out.println("Time Taken For Scan: "+sec+" Sec");
}
if(ans==2)
{
System.out.print("\n\n\nC: Drives :");
stop = System.currentTimeMillis() - start;
long lg = stop/1000;
long sec=lg;
System.out.println("\nTotal Files="+ total+" File's");
System.out.println("Total Scan Files="+ total+" File's");
System.out.println("Total Infected Files="+ infected+" File's");
System.out.println("Time Taken For Scan: "+sec+" Sec");
}
if(ans==3)
{
stop = System.currentTimeMillis() - start;
long lg = stop/1000;
long sec=lg;
System.out.print("\n\n\n"+strRoot2+" Drives :");
System.out.println("\nTotal Files="+ total+" File's");
System.out.println("Total Scan Files="+ total+" File's");
System.out.println("Total Infected Files="+ infected+" File's");
System.out.println("Time Taken For Scan: "+sec+" Sec");
}
try{
FileWriter w=new FileWriter("Total_Files.log");
w.write("************************* $PANKAJ$ **********************"+"\r\n");
w.write(" Pankaj"+"\r\n");
w.write("*************************************************************"+"\r\n");
w.write("Total Files="+ total+" File's"+"\r\n");
w.write("Total Scan Files="+ total+" File's"+"\r\n");
w.write("Virus Infected Files="+ infected +" File's"+"\r\n");
w.write("*************************************************************"+"\r\n");
w.write("Date :"+new Date());
w.close();
}catch(Exception gt){}
// End
}
}
public static void main(String args[])
{
System.out.println("************** $ PANKAJ $ ***************\n\n");
System.out.println(new Date());
System.out.println("\n\n*********************************************");
Scanner s=new Scanner();
}
}
class virus{
BufferedReader br=null;
public String fname="";
int count=0;
int ans=0;
int flag=0;
virus(String str)
{
fname=str;
br=new BufferedReader(new InputStreamReader(System.in));
File f=new File(fname);
System.out.println("Virus File Found => "+fname+"\n\n");
while(f.exists())
{
if(flag==1)
{
System.out.println("\n\n\nUnable to Acess File!!!");
System.out.println("Enter Different Choice !!");
}
System.out.println("1. Delete");
System.out.println("2. Delete All");
System.out.println("3. Move to");
System.out.println("4. All Move to");
System.out.println("5. Move to virus valut");
System.out.println("6. All Move to virus valut");
System.out.println("7. Rename");
System.out.println("8. Ignore");
try{
File ff=new File(fname);
System.out.print("\n\nUser Choice:");
ans=Integer.parseInt(br.readLine());
if(ans==1)
{
f.delete();
flag=1;
}
if(ans==2)
{
f.delete();
flag=1;
}
if(ans==3)
{
flag=1;
JFrame jf=new JFrame();
FileDialog n=new FileDialog(jf,"Move Virus To");
n.setMode(FileDialog.SAVE);
n.setVisible(true);
String dir=n.getDirectory();
String file=n.getName();
File fft=new File(fname);
File rr=new File(dir+file);
fft.renameTo(rr);
}
if(ans==4)
{
JFrame jf=new JFrame();
FileDialog n=new FileDialog(jf,"Move Virus To");
n.setMode(FileDialog.SAVE);
n.setVisible(true);
String dir=n.getDirectory();
String file=n.getName();
File fft=new File(fname);
File rr=new File(dir+file);
fft.renameTo(rr);
}
if(ans==5)
{
flag=1;
File ff1=new File(fname);
File fg=new File("Virus Vault");
if(!fg.exists())
{
fg.mkdir();
}
ff1.renameTo(fg);
}
if(ans==6)
{
flag=1;
File ff1=new File(fname);
File fg=new File("Virus Vault");
if(!fg.exists())
{
fg.mkdir();
}
ff1.renameTo(fg);
}
if(ans==7)
{
try{
br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the name :");
String name=br.readLine();
File ff1=new File(fname);
ff1.renameTo(new File(name));
}catch(Exception e){}
}
if(ans==8)
{
System.out.println("File was Ignored.");
break;
}
}catch(Exception ft){}
}
}
}
//
// Author-Pankaj Maurya
//********************************************************************************************************************************
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.applet.AppletContext.*;
import java.util.*;
import javax.swing.event.*;
import java.lang.reflect.*;
import javax.swing.border.*;
import javax.swing.plaf.basic.*;
import java.awt.image.ImageConsumer ;
import java.awt.image.ImageObserver;
import java.applet.AudioClip;
import javax.swing.filechooser.FileView;
import java.net.*;
class Scanner
{
BufferedReader br=null;
int ans=0,point=0;
String database[]=new String[1000];
int total=0,infected=0;
String strRoot2="";
FileWriter logFile;
Date dd;
long start=-1,stop=-1;
Scanner()
{
try{
logFile=new FileWriter("Scan.log");
logFile.write("*************************** $PANKAJ VIRUS BLOCKER$ ****************************************"+"\r\n");
logFile.write(" Author- Pankaj Maurya"+"\r\n");
logFile.write("*********************************************************************************"+"\r\n");
logFile.write("User Computer File's And Folder's System"+"\r\n\n\n");
}catch(Exception gt){}
while(true)
{
total=0;
infected=0;
br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("\n\n\n**************** $Welcome to EScan Security$ ************");
System.out.println(" Author- Pankaj Maurya");
dd=new Date();
int hh=dd.getMinutes();
System.out.println("1. Scan All Drive's ");
System.out.println("2. Scan System. Drive");
System.out.println("3. Scan User Difined Drive");
System.out.println("4. Scan Folder"+ "< Not Implemented >");
System.out.println("5. Scan File" + "< Not Implemented >");
System.out.println("6. View Virus Valut");
System.out.println("7. Help");
System.out.println("8. About Us");
System.out.println("9. Exit");
try{
System.out.println("\n\nEnter Choice");
ans=Integer.parseInt(br.readLine());
}
catch(Exception f){}
//Scan All Drives
if(ans==1)
{
try{
start=System.currentTimeMillis();
FileReader rd=new FileReader("virus_database/point.dat") ;
JTextField jt=new JTextField();
jt.read(rd,null);
point=Integer.parseInt(jt.getText());
rd.close();
System.out.print("Please wait Loading Database");
for(int z=0;z<point;z++)
{
FileReader r=new FileReader("virus_database/malware"+z+".res");
JTextField jt2=new JTextField();
jt2.read(r,null);
database[z]=jt2.getText();
r.close();
int per=(z*100)/point;
//System.out.println(database[z]+" "+"["+per +"%]");
}
for(int x=0;x<4;x++)
{
for(int y=0;y<3;y++)
System.out.print(". ");
try{Thread.sleep(500);}catch(Exception gta){}
}
System.out.println("Database Load Sucessfully!");
File f=new File("c:/'.'");
File strRoot[]=f.listRoots();
System.out.println("System Drive...");
for(int k=0;k<strRoot.length;k++)
{
System.out.println(" |_"+strRoot[k]);
}
System.out.println("Start Scan...");
logFile.write("Start Scan:"+new Date()+"\r\n");
for(int iq=0;iq<strRoot.length;iq++)
{
System.out.println("\n\n\n"+strRoot[iq]+" Drive");
logFile.write("\n\n\n"+strRoot[iq]+" Drive"+"\r\n");
File ff2=new File(strRoot[iq]+"/*.*");
String ff1=ff2.getParent();
File ff=new File(ff1);
String str22[]=ff.list();
int len=str22.length;
for(int i=0;i<len;i++)
{
File fg=new File(strRoot[iq]+"/"+str22[i]);
System.out.println(" |_ "+str22[i]);
logFile.write(" |_ "+str22[i]+"\r\n");
try{Thread.sleep(100);}catch(Exception hy){}
total=total+1;
for(int io=0;io<point;io++)
{ //System.out.println("List "+database[io]);
if( database[io].equals( str22[i] ) )
{
virus v=new virus(strRoot[iq]+str22[i]);
infected=infected+1;
}
}
int iz = str22[i].lastIndexOf('.');
if( fg.isHidden() && str22[i].substring(iz+1).toLowerCase().equals("exe") || str22[i].substring(iz+1).toLowerCase().equals("msi") || str22[i].substring(iz+1).toLowerCase().equals("pif") )
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot[iq]+str22[i]);
}
String dir=fg.getParent();
File fy=new File(dir);
String name=fy.getName();
if(str22[i].equals(name+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot[iq]+str22[i]);
infected=infected+1;
}
if( fg.isDirectory() )
{
try{
File ff21=new File(strRoot[iq]+str22[i]+"/*.*");
String ff11=ff21.getParent();
//System.out.println("Directory Name:"+ff11);
File ff1a=new File(ff11);
String str221[]=ff1a.list();
int len1=str221.length;
for(int i1=0;i1<len1;i1++)
{
System.out.println(" | |_ "+str221[i1]);
logFile.write(" | |_ "+str221[i1]+"\r\n");
try{Thread.sleep(100);}catch(Exception hy){}
total=total+1;
for(int io=0;io<point;io++)
{
if( database[io].equals( str221[i1] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]);
System.out.println("2."+strRoot[iq]+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
}
File fh=new File(strRoot[iq]+str22[i]+"/"+str221[i1]);
//System.out.println("File="+strRoot[iq]+str22[i]+"/"+str221[i1]);
int iz1 = str221[i1].lastIndexOf('.');
if( fh.isHidden() && str221[i1].substring(iz1+1).toLowerCase().equals("exe") || str221[i1].substring(iz1+1).toLowerCase().equals("msi") || str221[i1].substring(iz1+1).toLowerCase().equals("pif") )
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]);
}
String dir1=fh.getParent();
File fy1=new File(dir1);
String name1=fy1.getName();
if(str221[i1].equals(name1+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
if( fh.isDirectory() )
{
File ff21a=new File(strRoot[iq]+str22[i]+"/"+str221[i1]+"/*.*");
//System.out.println("Checking File"+(String)ff21a.getName());
String ff11a=ff21a.getParent();
//System.out.println("Directory Name:"+ff11);
File ff1az=new File(ff11a);
String str221a[]=ff1az.list();
int len1a=str221a.length;
for(int i1a=0;i1a<len1a;i1a++)
{
System.out.println(" | | |_"+str221a[i1a]);
logFile.write(" | | |_"+str221a[i1a]+"\r\n");try{Thread.sleep(50);}catch(Exception hy){}
total=total+1;
for(int ioa=0;ioa<point;ioa++)
{
if( database[ioa].equals( str221a[i1a] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
//System.out.println("3."+strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
infected=infected+1;
}
}
File ffg=new File(strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
int iz11 = str221a[i1a].lastIndexOf('.');
if( ffg.isHidden() && str221a[i1a].substring(iz11+1).toLowerCase().equals("exe") || str221a[i1a].substring(iz11+1).toLowerCase().equals("msi") || str221a[i1a].substring(iz11+1).toLowerCase().equals("pif") )
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot[iq]+str22[i]);
}
String dir2=ffg.getParent();
File fy2=new File(dir2);
String name2=fy2.getName();
if(str221a[i1a].equals(name2+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
infected=infected+1;
}
if( ffg.isDirectory() )
{
File ff21a1=new File(strRoot[iq]+str22[i]+"/"+str221[i1]+"/*.*");
//System.out.println("Checking File"+(String)ff21a1.getName());
String f11=ff21a1.getParent();
System.out.println("Directory Name:"+f11);
File f111=new File(f11);
String str1z[]=f111.list();
int l1=str1z.length;
for(int z=0;z<l1;z++)
{
System.out.println(" | | | |_"+str1z[z]);try{Thread.sleep(50);}catch(Exception hy){}
logFile.write(" | | | |_"+str1z[z]+"\r\n");
total=total+1;
for(int za=0;za<point;za++)
{
if( database[za].equals( str1z[z] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]+"/"+str1z[z]);
System.out.println("3."+strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]+"/"+str1z[z] );
infected=infected+1;
}
}
}
}
}
}
}
}catch(Exception h){System.out.println(h);}
}
}
}
}catch(Exception gt){ System.out.println(gt);}
}
//Start
if(ans==2)
{
try{
start=System.currentTimeMillis();
FileReader rd=new FileReader("virus_database/point.dat") ;
JTextField jt=new JTextField();
jt.read(rd,null);
point=Integer.parseInt(jt.getText());
rd.close();
System.out.print("Please wait Loading Database");
for(int z=0;z<point;z++)
{
FileReader r=new FileReader("virus_database/malware"+z+".res");
JTextField jt2=new JTextField();
jt2.read(r,null);
database[z]=jt2.getText();
r.close();
int per=(z*100)/point;
//System.out.println(database[z]+" "+"["+per +"%]");
}
for(int x=0;x<4;x++)
{
for(int y=0;y<3;y++)
System.out.print(". ");
try{Thread.sleep(500);}catch(Exception gta){}
}
System.out.println("Database Load Sucessfully!");
File f=new File("c:/'.'");
String strRoot[]={"C:/"};
System.out.println("C: Drive...");
for(int k=0;k<1;k++)
{
System.out.println(" |_ C: Drive");
}
System.out.println("Start Scan...");
logFile.write("Start Scan:"+new Date()+"\r\n");
for(int iq=0;iq<1;iq++)
{
System.out.println("C:/ Drive");
logFile.write("\n\n\n"+"C:/"+" Drive"+"\r\n");
File ff2=new File("C:/"+"*.*");
String ff1=ff2.getParent();
File ff=new File(ff1);
String str22[]=ff.list();
int len=str22.length;
for(int i=0;i<len;i++)
{
File fg=new File("C:"+"/"+str22[i]);
System.out.println(" |_ "+str22[i]);
logFile.write(" |_ "+str22[i]+"\r\n");try{Thread.sleep(50);}catch(Exception hy){}
total=total+1;
for(int io=0;io<point;io++)
{ //System.out.println("List "+database[io]);
if( database[io].equals( str22[i] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus("C:/"+str22[i]);
infected=infected+1;
}
}
int iz = str22[i].lastIndexOf('.');
if( fg.isHidden() && str22[i].substring(iz+1).toLowerCase().equals("exe") || str22[i].substring(iz+1).toLowerCase().equals("msi") || str22[i].substring(iz+1).toLowerCase().equals("pif") || str22[i].substring(iz+1).toLowerCase().equals("int"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus("C:/"+str22[i]);
}
String dir=fg.getParent();
File fy=new File(dir);
String name=fy.getName();
if(str22[i].equals(name+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus("C:/"+str22[i]);
infected=infected+1;
}
if( fg.isDirectory() )
{
try{
File ff21=new File("C:/"+str22[i]+"/*.*");
String ff11=ff21.getParent();
System.out.println("Directory Name:"+ff11);
File ff1a=new File(ff11);
String str221[]=ff1a.list();
int len1=str221.length;
for(int i1=0;i1<len1;i1++)
{
System.out.println(" | |_ "+str221[i1]);try{Thread.sleep(50);}catch(Exception hy){}
logFile.write(" | |_ "+str221[i1]+"\r\n");
total=total+1;
for(int io=0;io<point;io++)
{
if( database[io].equals( str221[i1] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]);
System.out.println("2."+strRoot[iq]+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
}
File fh=new File("C:/"+str22[i]+"/"+str221[i1]);
int iz1 = str221[i1].lastIndexOf('.');
if( fh.isHidden() && str221[i1].substring(iz1+1).toLowerCase().equals("exe") || str221[i1].substring(iz1+1).toLowerCase().equals("msi") || str221[i1].substring(iz1+1).toLowerCase().equals("pif") || str221[i1].substring(iz1+1).toLowerCase().equals("ini"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]);
}
System.out.println("File="+strRoot[iq]+str22[i]+"/"+str221[i1]);
String dir1=fh.getParent();
File fy1=new File(dir1);
String name1=fy1.getName();
System.out.println("Check "+name1+" with "+str221[i1] );
if(str221[i1].equals(name1+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
if( fh.isDirectory() )
{
File ff21a=new File("C:/"+str22[i]+"/"+str221[i1]+"/*.*");
System.out.println("Checking File"+"C:/"+str22[i]+"/"+str221[i1]+"/*.*");
String ff11a=ff21a.getParent();
System.out.println("Directory Name:"+ff11a);
File ff1az=new File(ff11a);
String str221a[]=ff1az.list();
int len13=str221a.length;
for(int i1a=0;i1a<len13;i1a++)
{
System.out.println(" | | |_"+str221a[i1a]);
logFile.write(" | | |_"+str221a[i1a]+"\r\n");try{Thread.sleep(50);}catch(Exception hy){}
total=total+1;
for(int ioa=0;ioa<point;ioa++)
{
if( database[ioa].equals( str221a[i1a] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
//System.out.println("3."+strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
infected=infected+1;
}
}
File ffg=new File("C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
int iz11 = str221a[i1a].lastIndexOf('.');
if( ffg.isHidden() && str221a[i1a].substring(iz11+1).toLowerCase().equals("exe") || str221a[i1a].substring(iz11+1).toLowerCase().equals("msi") || str221a[i1a].substring(iz11+1).toLowerCase().equals("pif") || str221a[i1a].substring(iz11+1).toLowerCase().equals("ini"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
}
String dir2=ffg.getParent();
File fy2=new File(dir2);
String name2=fy2.getName();
if(str221a[i1a].equals(name2+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]);
infected=infected+1;
}
if( ffg.isDirectory() )
{
File ff21a1=new File("c:/"+str22[i]+"/"+str221[i1]+"/*.*");
//System.out.println("Checking File"+(String)ff21a1.getName());
String f11=ff21a1.getParent();
System.out.println("Directory Name:"+f11);
File f111=new File(f11);
String str1z[]=f111.list();
int l1=str1z.length;
for(int z=0;z<l1;z++)
{
System.out.println(" | | | |_"+str1z[z]);
logFile.write(" | | | |_"+str1z[z]+"\r\n");
total=total+1;
for(int za=0;za<point;za++)
{
if( database[za].equals( str1z[z] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus("C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]+"/"+str1z[z]);
System.out.println("3."+strRoot[iq]+str22[i]+"/"+str221[i1]+"/"+str221a[i1a]+"/"+str1z[z] );
infected=infected+1;
}
}
}
}
}
}
}
}catch(Exception h){ System.out.println(h); }
}
}
}
logFile.close();
}catch(Exception gt){ System.out.println(gt);}
}
//End
if(ans==8)
{
try{
System.out.println("\n\n\n\n\n");
System.out.println("Software Name: Pankaj Virus Blocker");
try{Thread.sleep(2000);}catch(Exception hy){}
System.out.println("Version Info: 1.0.0.1");
Thread.sleep(2000);
System.out.println("Author: Pankaj Maurya");
Thread.sleep(2000);
System.out.println("Tester: Pankaj Maurya");
Thread.sleep(2000);
System.out.println("Beta Version Tester: Pankaj Maurya");
Thread.sleep(2000);
System.out.println("DFD Concept: Pankaj Maurya");
Thread.sleep(2000);
System.out.println("Database By: PANKAJ ");
Thread.sleep(2000);
System.out.println("Realising Date: ");
Thread.sleep(2000);
System.out.println("Test Start: ");
Thread.sleep(2000);
System.out.println("Test Complete: ");
Thread.sleep(2000);
System.out.println("Requirement: JDK 1.6");
Thread.sleep(2000);
System.out.println("Feedback on:");
System.out.println(" 1.pnkjmr857@gmail.com");
System.out.println(" 2.www.pankajsoftwareworld.tk ");
Thread.sleep(4000);
}catch(Exception e){}
}
if(ans==9)
{
System.exit(0);
}
if(ans==6)
{
System.out.println("\n\nVirus vault");
File ff2=new File("Virus Vault/*.*");
String ff1=ff2.getParent();
File ff=new File(ff1);
String str22[]=ff.list();
int len=str22.length;
if(len==0)
{
System.out.println(" |_ Virus vault is empty");
}
else{
for(int y=0;y<len;y++)
System.out.println(" |_"+str22[y]);
}
System.out.println("\n"+len+" File Found");
}
if(ans==3)
{
//System.out.println("Entered Two");
try{
br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the drive name to be scan (eg. D:) :");
strRoot2=br.readLine();
start=System.currentTimeMillis();
FileReader rd=new FileReader("virus_database/point.dat") ;
JTextField jt=new JTextField();
jt.read(rd,null);
point=Integer.parseInt(jt.getText());
rd.close();
System.out.print("Please wait Loading Database");
for(int z=0;z<point;z++)
{
FileReader r=new FileReader("virus_database/malware"+z+".res");
JTextField jt2=new JTextField();
jt2.read(r,null);
database[z]=jt2.getText();
r.close();
int per=(z*100)/point;
//System.out.println(database[z]+" "+"["+per +"%]");
}
for(int x=0;x<4;x++)
{
for(int y=0;y<3;y++)
System.out.print(". ");
try{Thread.sleep(500);}catch(Exception gta){}
}
System.out.println("Database Load Sucessfully!");
File f=new File(strRoot2+"/'.'");
logFile.write(strRoot2+"\r\n");
File strRoot[]=f.listRoots();
System.out.println("System Drive...");
for(int k=0;k<1;k++)
{
System.out.println(" |_"+strRoot[k]);
logFile.write(" |_"+strRoot[k]+"\r\n");try{Thread.sleep(100);}catch(Exception hy){}
}
System.out.println("Start Scan...");
for(int iq=0;iq<1;iq++)
{
System.out.println("\n\n\n"+"System "+" Drive");
File ff2=new File(strRoot2+"/*.*");
String ff1=ff2.getParent();
File ff=new File(ff1);
String str22[]=ff.list();
int len=str22.length;
for(int i=0;i<len;i++)
{
File fg=new File(strRoot2+"/"+str22[i]);
System.out.println(" |_ "+str22[i]);
logFile.write(" |_ "+str22[i]+"\r\n");
total=total+1;
for(int io=0;io<point;io++)
{ //System.out.println("List "+database[io]);
if( database[io].equals( str22[i] ) )
{
virus v=new virus(strRoot2+"/"+str22[i]);
infected=infected+1;
}
}
int iz = str22[i].lastIndexOf('.');
if( fg.isHidden() && str22[i].substring(iz+1).toLowerCase().equals("exe") || str22[i].substring(iz+1).toLowerCase().equals("msi") || str22[i].substring(iz+1).toLowerCase().equals("pif") || str22[i].substring(iz+1).toLowerCase().equals("inf"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot2+"/"+str22[i]);
}
String dirg=fg.getParent(); String dir=fg.getParent();
File fy=new File(dirg);
String name=fy.getName();
//System.out.println("Check "+name+" with "+str22[i] );
if(str22[i].equals(name+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot2+"/"+str22[i]);
infected=infected+1;
}
if( fg.isDirectory() )
{
try{
File ff21=new File(strRoot2+"/"+str22[i]+"/*.*");
String ff11=ff21.getParent();
//System.out.println("Directory Name:"+ff11);
File ff1a=new File(ff11);
String str221[]=ff1a.list();
int len1=str221.length;
for(int i1=0;i1<len1;i1++)
{
System.out.println(" | |_ "+str221[i1]);try{Thread.sleep(100);}catch(Exception hy){}
logFile.write(" | |_ "+str221[i1]+"\r\n");
total=total+1;
for(int io=0;io<point;io++)
{
if( database[io].equals( str221[i1] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]);
System.out.println("2."+strRoot2+"/"+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
}
File fh=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]);
//System.out.println("File="+strRoot2+"/"+str22[i]+"/"+str221[i1]);
int iz2 = str221[i1].lastIndexOf('.');
if( fh.isHidden() && str221[i1].substring(iz2+1).toLowerCase().equals("exe") || str221[i1].substring(iz2+1).toLowerCase().equals("msi") || str221[i1].substring(iz2+1).toLowerCase().equals("pif") || str221[i1].substring(iz2+1).toLowerCase().equals("ini"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]);
}
String dir11=fh.getParent();
File fy1=new File(dir11);
String name1=fy1.getName();
//System.out.println("Check "+name1+" with "+str221[i1] );
if(str221[i1].equals(name1+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
if( fh.isDirectory() )
{
File ff21a=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/*.*");
//System.out.println("Checking File"+(String)ff21a.getName());
String ff11a=ff21a.getParent();
System.out.println("Directory Name:"+ff11a);
File ff1az=new File(ff11a);
String str221a[]=ff1az.list();
int l2=str221a.length;
for(int i2=0;i2<l2;i2++)
{
System.out.println(" | | |_"+str221a[i2]);
logFile.write(" | | |_"+str221a[i2]+"\r\n");try{Thread.sleep(100);}catch(Exception hy){}
total=total+1;
for(int ioa=0;ioa<point;ioa++)
{
if( database[ioa].equals( str221a[i2] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
System.out.println("3."+strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
infected=infected+1;
}
}
File ffg=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
int iz1 = str221[i2].lastIndexOf('.');
if( ffg.isHidden() && str221[i2].substring(iz1+1).toLowerCase().equals("exe") || str221[i2].substring(iz1+1).toLowerCase().equals("msi") || str221[i2].substring(iz1+1).toLowerCase().equals("pif") || str221[i2].substring(iz1+1).toLowerCase().equals("inh"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
}
String dir12v=ffg.getParent();
File fy12=new File(dir12v);
String name12=fy12.getName();
//System.out.println("Check "+name12+" with "+str221a[i2] );
if(str221a[i2].equals(name12+".exe"))
{
System.out.println("\n\n****************** $Virus Found$ ****************");
System.out.println(" Virus Name: Win32-Sality[Troj]");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
infected=infected+1;
}
if( ffg.isDirectory() )
{
File ff21a1=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/*.*");
//System.out.println("Checking File"+(String)ff21a.getName());
String f11=ff21a1.getParent();
//System.out.println("Directory Name:"+f11);
try{Thread.sleep(100);}catch(Exception h){}
File f111=new File(f11);
String str1c[]=f111.list();
int l1=str1c.length;
for(int z=0;z<l1;z++)
{
System.out.println(" | | | |_"+str1c[z]);
logFile.write(" | | | |_"+str1c[z]+"\r\n");try{Thread.sleep(100);}catch(Exception hy){}
total=total+1;
for(int za=0;za<point;za++)
{
if( database[za].equals( str1c[z] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/"+str1c[z]);
System.out.println("3."+strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/"+str1c[z] );
infected=infected+1;
}
}
}
}
}
}
}
}catch(Exception fgq){}
}
// Start
if( fg.isDirectory() )
{
try{
File ff21=new File(strRoot2+"/"+str22[i]+"/*.*");
String ff11=ff21.getParent();
//System.out.println("Directory Name:"+ff11);
File ff1a=new File(ff11);
String str221[]=ff1a.list();
int len1=str221.length;
for(int i1=0;i1<len1;i1++)
{
System.out.println(" | |_ "+str221[i1]);
logFile.write(" | |_ "+str221[i1]+"\r\n");
total=total+1;
for(int io=0;io<point;io++)
{
if( database[io].equals( str221[i1] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]);
System.out.println("2."+strRoot2+"/"+str22[i]+"/"+str221[i1]);
infected=infected+1;
}
}
File fh=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]);
//System.out.println("File="+"C:/"+str22[i]+"/"+str221[i1]);
int izz = str221[i1].lastIndexOf('.');
if( fh.isHidden() && str221[i1].substring(izz+1).toLowerCase().equals("exe") || str221[i1].substring(izz+1).toLowerCase().equals("msi") || str221[i1].substring(izz+1).toLowerCase().equals("pif") || str221[i1].substring(izz+1).toLowerCase().equals("int"))
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]);
}
if( fh.isDirectory() )
{
File ff21a=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/*.*");
//System.out.println("Checking File"+(String)ff21a.getName());
String ff11a=ff21a.getParent();
System.out.println("Directory Name:"+ff11a);
File ff1az=new File(ff11a);
String str221a[]=ff1az.list();
int l2=str221a.length;
for(int i2=0;i2<l2;i2++)
{
System.out.println(" | | |_"+str221a[i2]);
logFile.write(" | | |_"+str221a[i2]+"\r\n");
total=total+1;
for(int ioa=0;ioa<point;ioa++)
{
if( database[ioa].equals( str221a[i2] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
System.out.println("3."+"C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
infected=infected+1;
}
}
File ffg=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
int iz11a = str221a[i2].lastIndexOf('.');
if( fh.isHidden() && str221a[i2].substring(iz11a+1).toLowerCase().equals("exe") || str221a[i2].substring(iz11a+1).toLowerCase().equals("msi") || str221a[i2].substring(iz11a+1).toLowerCase().equals("pif") )
{
System.out.println("\n\n************* $Virus Found$ ***********");
System.out.println("Possibility a new Virus");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]);
}
if( ffg.isDirectory() )
{
File ff21a1=new File(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/*.*");
System.out.println("Checking File"+(String)ff21a.getName());
String f11=ff21a1.getParent();
System.out.println("Directory Name:"+f11);
try{Thread.sleep(100);}catch(Exception h){}
File f111=new File(f11);
String str1c[]=f111.list();
int l1=str1c.length;
for(int z=0;z<l1;z++)
{
System.out.println(" | | | |_"+str1c[z]);
total=total+1;
logFile.write(" | | | |_"+str1c[z]+"\r\n");
for(int za=0;za<point;za++)
{
if( database[za].equals( str1c[z] ) )
{
System.out.println("\n\n************* $Virus Found$ ***********");
virus v=new virus(strRoot2+"/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/"+str1c[z]);
System.out.println("3."+"C:/"+str22[i]+"/"+str221[i1]+"/"+str221a[i2]+"/"+str1c[z] );
infected=infected+1;
}
}
}
}
}
}
}
}catch(Exception fgq){}
}
// End
}
}
}catch(Exception fg){}
}
//End
if(ans==1)
{
File fw=new File("c:/'.'");
stop = System.currentTimeMillis() - start;
long lg = stop/1000;
long sec=lg;
File strRoot1[]=fw.listRoots();
System.out.print("\n\n\nScan Drives :");
for(int p=0;p<strRoot1.length;p++)
{
System.out.print(strRoot1[p]+" ");
}
System.out.println("\nTotal Files="+ total+" File's");
System.out.println("Total Scan Files="+ total+" File's");
System.out.println("Total Infected Files="+ infected+" File's");
System.out.println("Time Taken For Scan: "+sec+" Sec");
}
if(ans==2)
{
System.out.print("\n\n\nC: Drives :");
stop = System.currentTimeMillis() - start;
long lg = stop/1000;
long sec=lg;
System.out.println("\nTotal Files="+ total+" File's");
System.out.println("Total Scan Files="+ total+" File's");
System.out.println("Total Infected Files="+ infected+" File's");
System.out.println("Time Taken For Scan: "+sec+" Sec");
}
if(ans==3)
{
stop = System.currentTimeMillis() - start;
long lg = stop/1000;
long sec=lg;
System.out.print("\n\n\n"+strRoot2+" Drives :");
System.out.println("\nTotal Files="+ total+" File's");
System.out.println("Total Scan Files="+ total+" File's");
System.out.println("Total Infected Files="+ infected+" File's");
System.out.println("Time Taken For Scan: "+sec+" Sec");
}
try{
FileWriter w=new FileWriter("Total_Files.log");
w.write("************************* $PANKAJ$ **********************"+"\r\n");
w.write(" Pankaj"+"\r\n");
w.write("*************************************************************"+"\r\n");
w.write("Total Files="+ total+" File's"+"\r\n");
w.write("Total Scan Files="+ total+" File's"+"\r\n");
w.write("Virus Infected Files="+ infected +" File's"+"\r\n");
w.write("*************************************************************"+"\r\n");
w.write("Date :"+new Date());
w.close();
}catch(Exception gt){}
// End
}
}
public static void main(String args[])
{
System.out.println("************** $ PANKAJ $ ***************\n\n");
System.out.println(new Date());
System.out.println("\n\n*********************************************");
Scanner s=new Scanner();
}
}
class virus{
BufferedReader br=null;
public String fname="";
int count=0;
int ans=0;
int flag=0;
virus(String str)
{
fname=str;
br=new BufferedReader(new InputStreamReader(System.in));
File f=new File(fname);
System.out.println("Virus File Found => "+fname+"\n\n");
while(f.exists())
{
if(flag==1)
{
System.out.println("\n\n\nUnable to Acess File!!!");
System.out.println("Enter Different Choice !!");
}
System.out.println("1. Delete");
System.out.println("2. Delete All");
System.out.println("3. Move to");
System.out.println("4. All Move to");
System.out.println("5. Move to virus valut");
System.out.println("6. All Move to virus valut");
System.out.println("7. Rename");
System.out.println("8. Ignore");
try{
File ff=new File(fname);
System.out.print("\n\nUser Choice:");
ans=Integer.parseInt(br.readLine());
if(ans==1)
{
f.delete();
flag=1;
}
if(ans==2)
{
f.delete();
flag=1;
}
if(ans==3)
{
flag=1;
JFrame jf=new JFrame();
FileDialog n=new FileDialog(jf,"Move Virus To");
n.setMode(FileDialog.SAVE);
n.setVisible(true);
String dir=n.getDirectory();
String file=n.getName();
File fft=new File(fname);
File rr=new File(dir+file);
fft.renameTo(rr);
}
if(ans==4)
{
JFrame jf=new JFrame();
FileDialog n=new FileDialog(jf,"Move Virus To");
n.setMode(FileDialog.SAVE);
n.setVisible(true);
String dir=n.getDirectory();
String file=n.getName();
File fft=new File(fname);
File rr=new File(dir+file);
fft.renameTo(rr);
}
if(ans==5)
{
flag=1;
File ff1=new File(fname);
File fg=new File("Virus Vault");
if(!fg.exists())
{
fg.mkdir();
}
ff1.renameTo(fg);
}
if(ans==6)
{
flag=1;
File ff1=new File(fname);
File fg=new File("Virus Vault");
if(!fg.exists())
{
fg.mkdir();
}
ff1.renameTo(fg);
}
if(ans==7)
{
try{
br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the name :");
String name=br.readLine();
File ff1=new File(fname);
ff1.renameTo(new File(name));
}catch(Exception e){}
}
if(ans==8)
{
System.out.println("File was Ignored.");
break;
}
}catch(Exception ft){}
}
}
}
Labels
JAVA Project
Post A Comment
No comments :
Be The first to comment! among your friends