Click here to Skip to main content
15,917,875 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Morning

I was trying to use this repo for my Android project based on Java: GitHub - tushroy/virus-total: A Java API for VirusTotal[^]

The problem is that this repo is updated to 2013, and the provided link (inside Virustotal.Java) returns error 404, so VirusTotal link is outdated.

Would you please help me to make this repo working again? I'm not the owner of it, so I am trying to make it work inside my Android project, and not to edit it in GitHub.

Thanks in advance,


What I have tried:

I have tried to adapt it for an Android project, so inside MainActivity.class it is:


   private void getAllFilesOfDir(File directory) throws IOException {
        Log.d("get files", "Directory: " + directory.getAbsolutePath() + "\n");

        final File[] files = directory.listFiles();

        if ( files != null ) {
            for ( File file : files ) {
                if ( file != null ) {
                    if ( file.isDirectory() ) {  // it is a folder...
                    else {  // it is a file...
                        Log.d("files", "File: " + file.getAbsolutePath() + "\n");

                        System.out.println("[*] Scanning file: " + file);

                        byte[] data = FileUtils.readFileToByteArray(file);

                        String sha256Hex = DigestUtils.sha256Hex(data);

                        //The VirusTotal class allows you to search for results using various hashes
                        //and details as supported on the VirusTotal search functionality.
                        Set<Report> reports = VirusTotal.scan(sha256Hex);

                        //Output the details of each scan result from a vendor
                        for (Report report : reports) {
                            System.out.println(report.getVendor() + " - " + report.getMalwarename());
                            Log.e("report virus",report.getVendor() + " - " + report.getMalwarename());

Updated 31-Aug-20 6:38am
Richard MacCutchan 31-Aug-20 11:29am    
What is the problem?
Just_F 31-Aug-20 11:33am    
Hi, thanks for the help
The problem is that in this class if you check the website you get a 404 error, so when you implement it in the app, you don't get results
Richard MacCutchan 31-Aug-20 11:37am    
You need to use a string formatter to replace the %s with some real data that VirusTotal can use.
Just_F 31-Aug-20 12:45pm    
Already done: String VT_URL = String.format(URL_VIRUS_TOTAL, keyword);
Richard MacCutchan 31-Aug-20 12:51pm    
What is the actual value of the URL that you are sending?

1 solution

Share this answer
Just_F 31-Aug-20 12:37pm    
I've updated the app, but the problem is that it looks as if it doesn't connect to the net.
What I've tried: instead of I've updated to but I don't get results: I don't retrieve errors or results. Updated code in main post. I don't get logs for "report virus" but not even for generic errors. It looks as if it cannot connect to the website, even if I have the permission to do that (via manifest)
Richard MacCutchan 31-Aug-20 12:49pm    
That URL is not valid, you must replace the %s with a value that leads to an actual page on the VirusTotal website. This is not a coding or permissions issue. You need to go to the VirusTotal website and learn how to use their service.
Just_F 31-Aug-20 12:52pm    
As written above, there's already: String VT_URL = String.format(URL_VIRUS_TOTAL, keyword); where keyword is the actual SHA256 needed. Just see an example:
Richard MacCutchan 31-Aug-20 14:23pm    
Well that works fine, so what is the issue?
Just_F 3-Sep-20 10:23am    
The issue is that the app with this integration (as shown in GitHub, but with the updated link) receives neither data nor errors, even if I set all the permissions correctly

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900