Parcourir la source

File Injection detected as a seperate attack with Malware type detected in the Record Fragment GUI

Shreyas Srinivasa il y a 8 ans
Parent
commit
572c77400d

+ 45 - 0
src/de/tudarmstadt/informatik/hostage/Listener.java

@@ -367,4 +367,49 @@ public class Listener implements Runnable {
                 new String[]{service.getString(R.string.broadcast_started), "PORTSCAN",
                         Integer.toString(client.getPort())});
 	}
+
+
+
+	// to notify File Injection
+
+	private void logFileInjection(Socket client, long timestamp){
+		SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(service);
+		SharedPreferences connInfo = service.getSharedPreferences(service.getString(R.string.connection_info), Context.MODE_PRIVATE);
+
+		AttackRecord attackRecord = new AttackRecord(true);
+
+		attackRecord.setProtocol("File Injection");
+		attackRecord.setExternalIP(connInfo.getString(service.getString(R.string.connection_info_external_ip), null));
+		attackRecord.setLocalIP(client.getLocalAddress().getHostAddress());
+		attackRecord.setLocalPort(0);
+		attackRecord.setRemoteIP(client.getInetAddress().getHostAddress());
+		attackRecord.setRemotePort(client.getPort());
+		attackRecord.setBssid(connInfo.getString(service.getString(R.string.connection_info_bssid), null));
+
+		NetworkRecord networkRecord = new NetworkRecord();
+		networkRecord.setBssid(connInfo.getString(service.getString(R.string.connection_info_bssid), null));
+		networkRecord.setSsid(connInfo.getString(service.getString(R.string.connection_info_ssid), null));
+		if (MyLocationManager.getNewestLocation() != null) {
+			networkRecord.setLatitude(MyLocationManager.getNewestLocation().getLatitude());
+			networkRecord.setLongitude(MyLocationManager.getNewestLocation().getLongitude());
+			networkRecord.setAccuracy(MyLocationManager.getNewestLocation().getAccuracy());
+			networkRecord.setTimestampLocation(MyLocationManager.getNewestLocation().getTime());
+		} else {
+			networkRecord.setLatitude(0.0);
+			networkRecord.setLongitude(0.0);
+			networkRecord.setAccuracy(Float.MAX_VALUE);
+			networkRecord.setTimestampLocation(0);
+		}
+		Logger.logFileInjection(Hostage.getContext(), attackRecord, networkRecord, timestamp);
+
+		// now that the record exists we can inform the ui
+		// only handler informs about attacks so its name is used here
+		service.notifyUI(Handler.class.getName(),
+				new String[]{service.getString(R.string.broadcast_started), "File Injection",
+						Integer.toString(client.getPort())});
+	}
+
+
+
+
 }

+ 17 - 11
src/de/tudarmstadt/informatik/hostage/commons/HelperUtils.java

@@ -58,38 +58,44 @@ import de.tudarmstadt.informatik.hostage.ui.activity.MainActivity;
  */
 public final class HelperUtils {
 
+
+	public static String filePath;
 	public static String getFilePath() {
 		return filePath;
 	}
-
 	public static void setFilePath(String filePath) {
 		HelperUtils.filePath = filePath;
 	}
 
-	public static String filePath;
-
 
 
+	public static String fileName;
 	public static String getFileName() {
 		return fileName;
 	}
-
 	public static void setFileName(String fileName) {
 		HelperUtils.fileName = fileName;
 	}
 
 
-	public static String fileName;
 
-	public static String getFileMD5() {
-		return fileMD5;
-	}
 
-	public static void setFileMD5(String fileMD5) {
-		HelperUtils.fileMD5 = fileMD5;
+	public static String fileSHA256;
+	public static String getFileSHA256() {
+		return fileSHA256;
+	}
+	public static void setFileSHA256(String fileSHA256) {
+		HelperUtils.fileSHA256 = fileSHA256;
 	}
 
-	public static String fileMD5;
+
+
+
+	public static boolean isFileInjected;
+	public static boolean isFileInjected() {return isFileInjected;}
+	public static void setIsFileInjected(boolean isFileInjected) {HelperUtils.isFileInjected = isFileInjected;}
+
+
 
 
 

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/deprecated/UglyDbHelper.java

@@ -987,4 +987,4 @@ public class UglyDbHelper extends SQLiteOpenHelper {
 
 		return record;
 	}
-}
+}

+ 21 - 0
src/de/tudarmstadt/informatik/hostage/logging/Logger.java

@@ -67,6 +67,22 @@ public class Logger extends IntentService {
 	 * @param timestamp Timestamp of the port scan
 	 */
 	public static void logPortscan(Context context, AttackRecord attackRecord, NetworkRecord netRecord, long timestamp){
+		Intent intent = new Intent(context, Logger.class);
+		intent.setAction(ACTION_LOG_PORTSCAN);
+		intent.putExtra(EXTRA_RECORD, (Parcelable)attackRecord);
+		intent.putExtra(EXTRA_RECORD2, (Parcelable) netRecord);
+		intent.putExtra(EXTRA_TIMESTAMP, timestamp);
+		context.startService(intent);
+	}
+
+	/**
+	 * Adds a File Injection entry to the database
+	 * @param context
+	 * @param attackRecord
+	 * @param netRecord
+	 * @param timestamp
+	 */
+	public static void logFileInjection(Context context, AttackRecord attackRecord, NetworkRecord netRecord, long timestamp){
 		Intent intent = new Intent(context, Logger.class);
 		intent.setAction(ACTION_LOG_PORTSCAN);
 		intent.putExtra(EXTRA_RECORD, (Parcelable)attackRecord);
@@ -75,6 +91,11 @@ public class Logger extends IntentService {
 		context.startService(intent);
 	}
 
+
+
+
+
+
 	private HostageDBOpenHelper mDbHelper;
 
 	public Logger() {

+ 13 - 1
src/de/tudarmstadt/informatik/hostage/protocol/SMB.java

@@ -29,6 +29,7 @@ import de.tudarmstadt.informatik.hostage.logging.MessageRecord;
 import de.tudarmstadt.informatik.hostage.logging.NetworkRecord;
 import de.tudarmstadt.informatik.hostage.logging.SyncDevice;
 import de.tudarmstadt.informatik.hostage.protocol.cifs.CifsServer;
+import de.tudarmstadt.informatik.hostage.protocol.cifs.FileInject;
 import de.tudarmstadt.informatik.hostage.ui.activity.MainActivity;
 import de.tudarmstadt.informatik.hostage.wrapper.Packet;
 
@@ -57,15 +58,24 @@ public class SMB implements Protocol {
 
     private boolean logged;
 
+
+    public boolean fileInjected = HelperUtils.isFileInjected;
+
     public Listener getListener(){
         return mListener;
     }
 
     public void initialize(Listener mListener) {
         this.mListener = mListener;
+        FileInject fileInject = new FileInject();
+
+        fileInject.startListner(mListener);
+
+
 
         Hostage service = mListener.getService();
         pref = PreferenceManager.getDefaultSharedPreferences(service);
+
         getAndIncrementAttackID(pref);
         SharedPreferences connInfo = service.getSharedPreferences(service.getString(R.string.connection_info), Context.MODE_PRIVATE);
         BSSID = connInfo.getString(service.getString(R.string.connection_info_bssid), null);
@@ -81,7 +91,7 @@ public class SMB implements Protocol {
 
         try {
             smbConfig.loadConfiguration(new InputStreamReader(MainActivity.context.getResources().openRawResource(R.raw.jlan_config)));
-            mCifsServer = new CifsServer(smbConfig, this);
+            mCifsServer = new CifsServer(smbConfig, this, fileInject);
             mCifsServer.run();
         } catch (IOException e) {
             e.printStackTrace();
@@ -126,6 +136,8 @@ public class SMB implements Protocol {
         record.setSync_id(attack_id);
         record.setDevice(SyncDevice.currentDevice().getDeviceID());
 
+
+
         record.setProtocol(this.toString());
         record.setExternalIP(externalIP);
         record.setLocalIP(CifsServer.intToInetAddress(getLocalIp()).getHostAddress());

+ 4 - 3
src/de/tudarmstadt/informatik/hostage/protocol/cifs/CifsServer.java

@@ -3,7 +3,6 @@ package de.tudarmstadt.informatik.hostage.protocol.cifs;
 import android.content.Context;
 import android.net.DhcpInfo;
 import android.net.wifi.WifiManager;
-import android.widget.Toast;
 
 import org.alfresco.jlan.app.JLANCifsServer;
 import org.alfresco.jlan.app.XMLServerConfiguration;
@@ -45,12 +44,14 @@ public class CifsServer extends JLANCifsServer {
 
     private final XMLServerConfiguration serverConfiguration;
     protected final SMB SMB;
+    protected final FileInject fileInject;
 
-    public CifsServer(XMLServerConfiguration serverConfiguration, SMB SMB){
+    public CifsServer(XMLServerConfiguration serverConfiguration, SMB SMB, FileInject fileInject){
         super();
 
         this.SMB = SMB;
         this.serverConfiguration = serverConfiguration;
+        this.fileInject = fileInject;
     }
 
     public void run() throws Exception {
@@ -97,7 +98,7 @@ public class CifsServer extends JLANCifsServer {
         temp.mkdir();
 
         // SHARES
-        DiskInterface diskInterface = new PseudoJavaFileDiskDriver(SMB);
+        DiskInterface diskInterface = new PseudoJavaFileDiskDriver(SMB, fileInject);
         final GenericConfigElement driverConfig = new GenericConfigElement("driver");
         final GenericConfigElement localPathConfig = new GenericConfigElement("LocalPath");
         localPathConfig.setValue(jlanFolder.getAbsolutePath());

+ 144 - 0
src/de/tudarmstadt/informatik/hostage/protocol/cifs/FileInject.java

@@ -0,0 +1,144 @@
+package de.tudarmstadt.informatik.hostage.protocol.cifs;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.net.DhcpInfo;
+import android.net.wifi.WifiManager;
+import android.preference.PreferenceManager;
+
+import java.net.InetAddress;
+
+import de.tudarmstadt.informatik.hostage.Hostage;
+import de.tudarmstadt.informatik.hostage.Listener;
+import de.tudarmstadt.informatik.hostage.R;
+import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
+import de.tudarmstadt.informatik.hostage.location.MyLocationManager;
+import de.tudarmstadt.informatik.hostage.logging.AttackRecord;
+import de.tudarmstadt.informatik.hostage.logging.Logger;
+import de.tudarmstadt.informatik.hostage.logging.MessageRecord;
+import de.tudarmstadt.informatik.hostage.logging.NetworkRecord;
+import de.tudarmstadt.informatik.hostage.logging.SyncDevice;
+import de.tudarmstadt.informatik.hostage.ui.activity.MainActivity;
+
+/**
+ * Created by root on 05.08.15.
+ */
+public class FileInject {
+
+
+    private Listener fListener;
+    SharedPreferences fpref;
+    private int attack_id;
+    private String externalIP;
+    private String BSSID;
+    private String SSID;
+
+    private int subnetMask;
+    private int internalIPAddress;
+
+    private boolean logged;
+    public boolean fileInjected = false;
+
+
+    public Listener getListener() {
+        return fListener;
+    }
+
+    public void startListner(Listener fListener) {
+
+
+        this.fListener = fListener;
+        Hostage service = fListener.getService();
+        fpref = PreferenceManager.getDefaultSharedPreferences(service);
+        getAndIncrementAttackID(fpref);
+
+
+        SharedPreferences connInfo = service.getSharedPreferences(service.getString(R.string.connection_info), Context.MODE_PRIVATE);
+        BSSID = connInfo.getString(service.getString(R.string.connection_info_bssid), null);
+        SSID = connInfo.getString(service.getString(R.string.connection_info_ssid), null);
+        externalIP = connInfo.getString(service.getString(R.string.connection_info_external_ip), null);
+
+        // we need this info to find out whether the attack was internal
+        subnetMask = connInfo.getInt(service.getString(R.string.connection_info_subnet_mask), 0);
+        internalIPAddress = connInfo.getInt(service.getString(R.string.connection_info_internal_ip), 0);
+        logged = false;
+
+
+    }
+
+    public int getLocalIp() {
+        WifiManager wifi = (WifiManager) MainActivity.context.getSystemService(Context.WIFI_SERVICE);
+        DhcpInfo dhcp = wifi.getDhcpInfo();
+
+        return dhcp.ipAddress;
+    }
+
+
+    private synchronized void getAndIncrementAttackID(SharedPreferences pref) {
+        SharedPreferences.Editor editor = pref.edit();
+        attack_id = pref.getInt("ATTACK_ID_COUNTER", 0);
+        editor.putInt("ATTACK_ID_COUNTER", attack_id + 1);
+        editor.commit();
+    }
+
+
+    public MessageRecord createMessageRecord(MessageRecord.TYPE type, String packet) {
+        MessageRecord record = new MessageRecord(true);
+        //record.setId(message_id++); // autoincrement
+        record.setAttack_id(attack_id);
+        record.setType(type);
+        record.setTimestamp(System.currentTimeMillis());
+        record.setPacket(packet);
+        return record;
+    }
+
+    public AttackRecord createAttackRecord(int localPort, InetAddress remoteIP, int remotePort) {
+        AttackRecord record = new AttackRecord();
+        record.setAttack_id(attack_id);
+        record.setSync_id(attack_id);
+        record.setDevice(SyncDevice.currentDevice().getDeviceID());
+
+
+        record.setProtocol("FILE INJECTION");
+        record.setExternalIP(externalIP);
+        record.setLocalIP(CifsServer.intToInetAddress(getLocalIp()).getHostAddress());
+        record.setLocalPort(localPort);
+        record.setWasInternalAttack((HelperUtils.packInetAddress(remoteIP.getAddress()) & subnetMask) == (internalIPAddress & subnetMask));
+        record.setRemoteIP(remoteIP.getHostAddress());
+        record.setRemotePort(remotePort);
+        record.setBssid(BSSID);
+        return record;
+    }
+
+    public NetworkRecord createNetworkRecord() {
+        NetworkRecord record = new NetworkRecord();
+        record.setBssid(BSSID);
+        record.setSsid(SSID);
+        if (MyLocationManager.getNewestLocation() != null) {
+            record.setLatitude(MyLocationManager.getNewestLocation().getLatitude());
+            record.setLongitude(MyLocationManager.getNewestLocation().getLongitude());
+            record.setAccuracy(MyLocationManager.getNewestLocation().getAccuracy());
+            record.setTimestampLocation(MyLocationManager.getNewestLocation().getTime());
+        } else {
+            record.setLatitude(0.0);
+            record.setLongitude(0.0);
+            record.setAccuracy(Float.MAX_VALUE);
+            record.setTimestampLocation(0);
+        }
+        return record;
+    }
+
+    public void log(MessageRecord.TYPE type, String packet, int localPort, InetAddress remoteIP, int remotePort) {
+        if (!logged) {
+            Logger.log(Hostage.getContext(), createNetworkRecord());
+            Logger.log(Hostage.getContext(), createAttackRecord(localPort, remoteIP, remotePort));
+            logged = true;
+        }
+        if (packet != null && packet.length() > 0) { // prevent logging empty packets
+            Logger.log(Hostage.getContext(), createMessageRecord(type, packet));
+        }
+
+
+    }
+
+}

+ 45 - 8
src/de/tudarmstadt/informatik/hostage/protocol/cifs/PseudoJavaFileDiskDriver.java

@@ -20,12 +20,15 @@ import java.io.FileWriter;
 import java.math.BigInteger;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
+import java.util.Set;
 
 import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
 import de.tudarmstadt.informatik.hostage.logging.MessageRecord;
 import de.tudarmstadt.informatik.hostage.protocol.SMB;
 import de.tudarmstadt.informatik.hostage.ui.activity.MainActivity;
 import de.tudarmstadt.informatik.hostage.ui.fragment.FileAlertDialogFragment;
+import virustotalapi.ReportScan;
+import virustotalapi.VirusTotal;
 
 /**
  * HostageV3
@@ -39,15 +42,20 @@ import de.tudarmstadt.informatik.hostage.ui.fragment.FileAlertDialogFragment;
  */
 public class PseudoJavaFileDiskDriver extends JavaFileDiskDriver {
 
+
+
+
     private static class PseudoJavaNetworkFile extends JavaNetworkFile {
         protected final SMB SMB;
         private final SrvSession sess;
         boolean wasWrittenTo = false;
+        private  final FileInject fileInject;
 
-        public PseudoJavaNetworkFile(File file, String netPath, SMB SMB, SrvSession sess) {
+        public PseudoJavaNetworkFile(File file, String netPath, SMB SMB, SrvSession sess, FileInject fileInject) {
             super(file, netPath);
             this.SMB = SMB;
             this.sess = sess;
+            this.fileInject = fileInject;
         }
 
         Context context = null;
@@ -60,6 +68,7 @@ public class PseudoJavaFileDiskDriver extends JavaFileDiskDriver {
         public void closeFile() throws java.io.IOException {
             super.closeFile();
             if(wasWrittenTo){
+                HelperUtils.setIsFileInjected(true);
                 try {
                     MessageDigest digest = MessageDigest.getInstance("SHA256");
                     FileInputStream fis = new FileInputStream(m_file);
@@ -73,16 +82,38 @@ public class PseudoJavaFileDiskDriver extends JavaFileDiskDriver {
                     byte[] hash = digest.digest();
                     String checksum = new BigInteger(1, hash).toString(16);
 
-                    String message = "File received: " + m_file.getName() + "\n\nCHECKSUM:\n" + checksum;
+                    StringBuilder sb = new StringBuilder();
+
+                    VirusTotal VT = new VirusTotal("111c226204f5de7228563bbca91c5860e4965fbe936307dffa8f2f2d575ff292"); // Your Virus Total API Key
+
+                    Set<ReportScan> Report = VT.ReportScan(checksum); //The SHA256 file
+
+                    for (ReportScan report : Report) {
+
+                        if (report.getDetected().contentEquals("true")){
+
+                            if (report.getVendor().contentEquals("McAfee")||report.getVendor().contentEquals("Microsoft"))
+
+                            {
+                                sb.append("\n\nVendor: " + report.getVendor() + " \nDetected: " + report.getDetected() + " \nMalware Name: " + report.getMalwarename());
+                            }
+                        }
+
+                    }
+                    String message = "File received: " + m_file.getName() + "\n\nCHECKSUM:\n" + checksum+sb.toString();
+                    fileInject.log(MessageRecord.TYPE.RECEIVE, message, 445, sess.getRemoteAddress(), 445);
 
                     HelperUtils.setFileName(m_file.getName());
                     HelperUtils.setFilePath(m_file.getPath());
-                    HelperUtils.setFileMD5(checksum);
+                    HelperUtils.setFileSHA256(checksum);
+
+
+                   // System.out.print(m_file.getName());
+                   // displayAlert();
+
+                   // SMB.log(MessageRecord.TYPE.RECEIVE, message, 445, sess.getRemoteAddress(), 445);
 
-                    System.out.print(m_file.getName());
-                    displayAlert();
 
-                    SMB.log(MessageRecord.TYPE.RECEIVE, message, 445, sess.getRemoteAddress(), 445);
                 } catch (NoSuchAlgorithmException e) {
                     e.printStackTrace();
                 }
@@ -106,9 +137,11 @@ public class PseudoJavaFileDiskDriver extends JavaFileDiskDriver {
     }
 
     private final SMB SMB;
+    private final FileInject fileInject;
 
-    public PseudoJavaFileDiskDriver(SMB SMB) {
+    public PseudoJavaFileDiskDriver(SMB SMB, FileInject fileInject) {
         this.SMB = SMB;
+        this.fileInject = fileInject;
     }
 
     public NetworkFile createFile(SrvSession sess, TreeConnection tree, FileOpenParams params)
@@ -133,7 +166,7 @@ public class PseudoJavaFileDiskDriver extends JavaFileDiskDriver {
 
         //  Create a Java network file
         file = new File(fname);
-        PseudoJavaNetworkFile netFile = new PseudoJavaNetworkFile(file, params.getPath(), SMB, sess);
+        PseudoJavaNetworkFile netFile = new PseudoJavaNetworkFile(file, params.getPath(), SMB, sess, fileInject);
         netFile.setGrantedAccess(NetworkFile.READWRITE);
         netFile.setFullName(params.getPath());
 
@@ -156,4 +189,8 @@ public class PseudoJavaFileDiskDriver extends JavaFileDiskDriver {
     }
 
 
+
+
+
+
 }

+ 2 - 2
src/de/tudarmstadt/informatik/hostage/ui/fragment/FileAlertDialogFragment.java

@@ -53,7 +53,7 @@ public class FileAlertDialogFragment extends DialogFragment {
 
         // assign values in layout
         if (view != null) {
-            ((TextView)view.findViewById(R.id.FileAlertText)).setText(HelperUtils.fileMD5);
+            ((TextView)view.findViewById(R.id.FileAlertText)).setText(HelperUtils.fileSHA256);
 
         }
 
@@ -65,7 +65,7 @@ public class FileAlertDialogFragment extends DialogFragment {
         AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_DARK);
         //  builder.setView(view);
         builder.setTitle("File Injection Alert");
-        builder.setMessage("File Injected:" + fname + "\nPath" + HelperUtils.getFilePath() + "\nSHA256:" + HelperUtils.fileMD5);
+        builder.setMessage("File Injected:" + fname + "\nPath" + HelperUtils.getFilePath() + "\nSHA256:" + HelperUtils.fileSHA256);
         builder.setIcon(android.R.drawable.ic_dialog_info);
 
         builder.setPositiveButton("SCAN", new DialogInterface.OnClickListener() {

+ 1 - 0
src/de/tudarmstadt/informatik/hostage/ui/fragment/RecordOverviewFragment.java

@@ -1212,6 +1212,7 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
 		}
 
 		titles.add("PORTSCAN");
+        titles.add("FILE INJECTION");
 		return titles;
 	}
     /**Return a boolean array of the selected / filtered protocols. If the filter object has

+ 6 - 118
src/de/tudarmstadt/informatik/hostage/ui/fragment/ScanFileFragment.java

@@ -83,130 +83,18 @@ public class ScanFileFragment extends Fragment {
 
         VirusTotal VT = new VirusTotal("111c226204f5de7228563bbca91c5860e4965fbe936307dffa8f2f2d575ff292"); // Your Virus Total API Key
 
-        Set<ReportScan> Report = VT.ReportScan(HelperUtils.fileMD5); //The SHA256 file
+        Set<ReportScan> Report = VT.ReportScan(HelperUtils.fileSHA256); //The SHA256 file
 
         for (ReportScan report : Report) {
 
-            sb.append("\nAV: " + report.getVendor() + " Detected: " + report.getDetected() + " Update: " + report.getUpdate() + " Malware Name: " + report.getMalwarename());
+            if (report.getDetected().contentEquals("true"))
 
-        }
-        return sb.toString();
-    }
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    /*public String scanfile(String path){
-
-        String result ="";
-
-        try {
-            VirusTotalConfig.getConfigInstance().setVirusTotalAPIKey("111c226204f5de7228563bbca91c5860e4965fbe936307dffa8f2f2d575ff292");
-            VirustotalPublicV2 virusTotalRef = new VirustotalPublicV2Impl();
-
-            ScanInfo scanInformation = virusTotalRef.scanFile(new File(HelperUtils.filePath));
-
-            System.out.println("___SCAN INFORMATION___");
-            System.out.println("MD5 :\t" + scanInformation.getMd5());
-            System.out.println("Perma Link :\t" + scanInformation.getPermalink());
-            System.out.println("Resource :\t" + scanInformation.getResource());
-            System.out.println("Scan Date :\t" + scanInformation.getScanDate());
-            System.out.println("Scan Id :\t" + scanInformation.getScanId());
-            System.out.println("SHA1 :\t" + scanInformation.getSha1());
-            System.out.println("SHA256 :\t" + scanInformation.getSha256());
-            System.out.println("Verbose Msg :\t" + scanInformation.getVerboseMessage());
-            System.out.println("Response Code :\t" + scanInformation.getResponseCode());
-            result = String.valueOf(scanInformation.getResponseCode());
-
-            System.out.println("done.");
-
-        } catch (APIKeyNotFoundException ex) {
-            System.err.println("API Key not found! " + ex.getMessage());
-        } catch (UnsupportedEncodingException ex) {
-            System.err.println("Unsupported Encoding Format!" + ex.getMessage());
-        } catch (UnauthorizedAccessException ex) {
-            System.err.println("Invalid API Key " + ex.getMessage());
-        } catch (Exception ex) {
-            System.err.println("Something Bad Happened! " + ex.getMessage());
-        }
-        return result;
-
-    }
-
-
-
-    public String getFileScanReport() {
-        try {
-            VirusTotalConfig.getConfigInstance().setVirusTotalAPIKey("111c226204f5de7228563bbca91c5860e4965fbe936307dffa8f2f2d575ff292");
-            VirustotalPublicV2 virusTotalRef = new VirustotalPublicV2Impl();
-
-            String resource=(HelperUtils.fileMD5);
-            FileScanReport report = virusTotalRef.getScanReport(resource);
-
-            System.out.println("MD5 :\t" + report.getMd5());
-            System.out.println("Perma link :\t" + report.getPermalink());
-            System.out.println("Resourve :\t" + report.getResource());
-            System.out.println("Scan Date :\t" + report.getScanDate());
-            System.out.println("Scan Id :\t" + report.getScanId());
-            System.out.println("SHA1 :\t" + report.getSha1());
-            System.out.println("SHA256 :\t" + report.getSha256());
-            System.out.println("Verbose Msg :\t" + report.getVerboseMessage());
-            System.out.println("Response Code :\t" + report.getResponseCode());
-            System.out.println("Positives :\t" + report.getPositives());
-            System.out.println("Total :\t" + report.getTotal());
-
-            HashMap<String, VirusScanInfo> scans = (HashMap<String, VirusScanInfo>) report.getScans();
-            for (String key : scans.keySet()) {
-                VirusScanInfo virusInfo = scans.get(key);
-                System.out.println("Scanner : " + key);
-                System.out.println("\t\t Result : " + virusInfo.getResult());
-                System.out.println("\t\t Update : " + virusInfo.getUpdate());
-                System.out.println("\t\t Version :" + virusInfo.getVersion());
-                result = report.getPermalink();
-                scanner = key;
+            {
+                sb.append("\nAV: " + report.getVendor() + " Detected: " + report.getDetected() + " Update: " + report.getUpdate() + " Malware Name: " + report.getMalwarename());
             }
 
-        } catch (APIKeyNotFoundException ex) {
-            System.err.println("API Key not found! " + ex.getMessage());
-        } catch (UnsupportedEncodingException ex) {
-            System.err.println("Unsupported Encoding Format!" + ex.getMessage());
-        } catch (UnauthorizedAccessException ex) {
-            System.err.println("Invalid API Key " + ex.getMessage());
-        } catch (Exception ex) {
-            System.err.println("Something Bad Happened! " + ex.getMessage());
         }
-        return result;
+        return sb.toString();
     }
-*/
-
-
-
 
+}