Esta api sirve para usar el servicio que brindan los chicos de [Enlace externo eliminado para invitados]
PD: Adjunto el proyecto en netbeans donde incluyo las clases de JSON.


AVResult.java
/**
 *
 * @author adwind
 */
public class AVResult {
    private String malwareScanProvider;
    private String malwareScanProviderVer;
    private String malwareScanProviderResultTime;
    private String malwareScanProviderResult;

    public AVResult(String malwareScanProvider, String malwareScanProviderVer, String malwareScanProviderResultTime, String malwareScanProviderResult) {
        this.malwareScanProvider = malwareScanProvider;
        this.malwareScanProviderVer = malwareScanProviderVer;
        this.malwareScanProviderResultTime = malwareScanProviderResultTime;
        this.malwareScanProviderResult = malwareScanProviderResult;
    }

    public String getMalwareScanProvider() {
        return malwareScanProvider;
    }

    public void setMalwareScanProvider(String malwareScanProvider) {
        this.malwareScanProvider = malwareScanProvider;
    }

    public String getMalwareScanProviderVer() {
        return malwareScanProviderVer;
    }

    public void setMalwareScanProviderVer(String malwareScanProviderVer) {
        this.malwareScanProviderVer = malwareScanProviderVer;
    }

    public String getMalwareScanProviderResultTime() {
        return malwareScanProviderResultTime;
    }

    public void setMalwareScanProviderResultTime(String malwareScanProviderResultTime) {
        this.malwareScanProviderResultTime = malwareScanProviderResultTime;
    }

    public String getMalwareScanProviderResult() {
        return malwareScanProviderResult;
    }

    public void setMalwareScanProviderResult(String malwareScanProviderResult) {
        this.malwareScanProviderResult = malwareScanProviderResult;
    }

}
ByteScannerLogin.java
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONObject;

/**
 *
 * @author adwind
 */
public class ByteScannerLogin {

    private final String email;
    private final String pass;
    private final StringBuilder response;
    private boolean logged = false;
    private boolean error = false;
    private String ID;
    private long creationdate;
    private String lastlogin;
    private String cookie;

    public String getID() {
        return ID;
    }

    public long getCreationdate() {
        return creationdate;
    }

    public String getLastlogin() {
        return lastlogin;
    }

    public String getLastloginip() {
        return lastloginip;
    }

    public String getBalance() {
        return balance;
    }
    private String lastloginip;
    private String balance;

    public ByteScannerLogin(String email, String pass) {
        this.email = email;
        this.pass = pass;
        response = new StringBuilder();
        fillData();
    }

    public boolean isErrorOfConnection() {
        return error;
    }

    public boolean isLogged() {

        return logged;
    }

    private void fillData() {
        try {
            HttpURLConnection c = (HttpURLConnection) new URL("http://bytescanner.com/client2api.php").openConnection();
            c.setDoInput(true);
            c.setDoOutput(true);
            c.setRequestMethod("POST");
            OutputStream out = c.getOutputStream();
            out.write(("action=Auth&email=" + email + "&password=" + pass).getBytes());
            out.flush();
            out.close();

            BufferedReader br = new BufferedReader(new InputStreamReader(c.getInputStream()));
            while (br.ready()) {
                response.append(br.readLine());
            }
            cookie = c.getHeaderField("Set-Cookie");
            br.close();
            c.disconnect();
            parseData();
        } catch (IOException ex) {
            error = true;
        }

    }

    private void parseData() {
        if (error == false) {
            JSONObject obj = new JSONObject(response.toString());
            logged = obj.getBoolean("success");
            JSONArray tmp = obj.getJSONArray("root");
            JSONObject data = tmp.getJSONObject(0);
            ID = data.getString("id");
            balance = data.getString("balance");
            creationdate = data.getLong("created");
            lastlogin = data.getString("lastlogin");
            lastloginip = data.getString("lastloginip");
        }

    }

    public ArrayList<AVResult> scanFile(File file) {

        ByteScannerUpload upload = new ByteScannerUpload(cookie, file);
        if (upload.isSuccess()) {
            return upload.getAVS();

        }
        return null;
    }

}
ByteScannerUpload.java
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONObject;


/**
 *
 * @author adwind
 */
public class ByteScannerUpload {

    private final static String lineEnd = "\r\n";
    private final static String boundary = "------WebKitFormBoundaryuSRq3mUjCFgkz44l";
    private final static String urlString = "http://bytescanner.com/startup.php";
    private final ArrayList<AVResult> avs = new ArrayList<AVResult>();
    private final String cookie;
    private final File file;
    private boolean success = false;
    private String resultID;

    public ByteScannerUpload(String cookie, File file) {
        this.cookie = cookie;
        this.file = file;
        upload();
    }

    public boolean isSuccess() {
        return success;
    }

    private byte[] getBytes() {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            FileInputStream in = new FileInputStream(file);

            int i = 0;
            byte[] buffer = new byte[1024];
            while ((i = in.read(buffer)) > -1) {
                out.write(buffer, 0, i);
            }
            out.close();
            in.close();

        } catch (IOException ex) {

        }
        return out.toByteArray();
    }

    private void upload() {


        try {
            OutputStream dos;
            URL url = new URL(urlString);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoInput(true);
            conn.setDoOutput(true);
            conn.setUseCaches(true);
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Host", "bytescanner.com");
            conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0");
            conn.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
            conn.setRequestProperty("Referer", "http://bytescanner.com/");
            conn.setRequestProperty("Connection", "Keep-alive");
            conn.setRequestProperty("Cookie", cookie);
            conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
            dos = conn.getOutputStream();
            ByteArrayOutputStream POSTDATA = new ByteArrayOutputStream();
            POSTDATA.write(("--" + boundary + lineEnd + ""
                    + "Content-Disposition: form-data; name=\"action\"" + lineEnd
                    + lineEnd
                    + "BinaryFileTransfer" + lineEnd
                    + "--" + boundary + lineEnd
                    + "Content-Disposition: form-data; name=\"binaryFile\"; filename=\"" + file.getName() + "\"" + lineEnd
                    + "Content-Type: text/plain" + lineEnd
                    + lineEnd).getBytes());
            POSTDATA.write(getBytes());
            POSTDATA.write((lineEnd + "--" + boundary + "--" + lineEnd + lineEnd).getBytes());
            POSTDATA.close();
            dos.write(POSTDATA.toByteArray());
            dos.flush();
            dos.close();

            BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            StringBuilder response = new StringBuilder();
            while (br.ready()) {
                response.append(br.readLine());
            }
            br.close();
            conn.disconnect();
            JSONObject obj = new JSONObject(response.toString());
            resultID = obj.get("root") + "";
            success = true;
        } catch (MalformedURLException ex) {
        } catch (IOException ioe) {
        }

    }

    public ArrayList<AVResult> getAVS() {
        StringBuilder b = new StringBuilder();
        try {
            HttpURLConnection c = (HttpURLConnection) new URL("http://bytescanner.com/api2client.php?action=scanResult&ResultID=" + resultID).openConnection();

            BufferedReader br = new BufferedReader(new InputStreamReader(c.getInputStream()));
            while (br.ready()) {
                b.append(br.readLine());

            }
            br.close();
            c.disconnect();
            JSONObject obj = new JSONObject(b.toString());
            JSONArray tmp = obj.getJSONArray("root");

            for (int i = 0; i < tmp.length(); i++) {
                JSONObject datos = tmp.getJSONObject(i);
                String p1 = datos.getString("malwareScanProvider");
                String p2 = datos.getString("malwareScanProviderVer");
                String p3 = datos.getString("malwareScanProviderResultTime");
                String p4 = datos.getString("malwareScanProviderResult");

                avs.add(new AVResult(p1, p2, p3, p4));
            }
        } catch (IOException ex) {
           
        }
        return avs;
    }



}


Manera de usarlo
public static void main(String[] args) {
        ByteScannerLogin login=new ByteScannerLogin("email", "pass");
        if(!login.isErrorOfConnection()){
            System.out.println("Try to loggin...");
            if(login.isLogged()){
                System.out.println("#############################################");
                System.out.println("Logged...");
                System.out.println("ID: "+login.getID());
                System.out.println("Last Login: "+login.getLastlogin());
                System.out.println("Last IP: "+login.getLastloginip());
                System.out.println("Creation Date: "+new Date(login.getCreationdate()));
                System.out.println("##############################################");
              ArrayList<AVResult> avs=  login.scanFile(new File("C:\\Users\\Alienware\\Desktop\\as.txt"));
                for (AVResult aVResult : avs) {
                    System.out.println(aVResult.getMalwareScanProvider());
                    System.out.println(aVResult.getMalwareScanProviderResult());
                    System.out.println(aVResult.getMalwareScanProviderResultTime());
                    System.out.println(aVResult.getMalwareScanProviderVer());
                    System.out.println("\n");
                }
            }else{
                System.out.println("Error logging..."); 
            }
        }else{
            System.out.println("Network error!");
        }
    }

Ejemplo de salida:

Código: Seleccionar todo


Try to loggin...
#############################################
Logged...
ID: 155
Last Login: 2013 September 29 Sunday
Last IP: *.*.*.*
Creation Date: Fri Jan 16 17:06:49 CST 1970
##############################################
ClamAV Antivirus
Nothing Found!
0.000 Second!
9/29/2013 8:17:10 AM


DrWeb Antivirus
Nothing Found!
0.040 Second!
2013/08/21 20:11


Avast Antivirus
Nothing Found!
0.140 Second!
130928-0, 09/28/13


F-Prot Antivirus
Nothing Found!
0.400 Second!
201111251712


Norman Antivirus
Nothing Found!
1.052 Second!
9/28/2013 1:12:54 PM;;0


Panda Antivirus
Nothing Found!
1.092 Second!
24/09/2013


Kaspersky Antivirus
Nothing Found!
0.270 Second!
9/29/2013


AVG Antivirus
Nothing Found!
1.372 Second!
Version 3222/6708 2013-09-29


VBA32 Antivirus
Nothing Found!
1.532 Second!
3.12.24.0 / 2013.09.06 08:04 (Vba32.W)


Emsisoft Anti Malware
Nothing Found!
1.612 Second!
8/30/2013 11:48:31 PM


Ikarus Antivirus
Nothing Found!
2.073 Second!
30.08.2013 16:04:03 (Build: 85060)


Eset Nod32 Antivirus
Nothing Found!
3.124 Second!
(20130929), build 15297


Avira Antivirus
Nothing Found!
3.966 Second!
9/28/2013 8:17:14 AM


PCTools Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Rising Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Sophos Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


SUPERAntiSpyware Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


VIPRE Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


ViRobot Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


TotalDefense Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


TrendMicro Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Agnitum Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


AhnLab-V3 Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Antiy-AVL Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Baidu-International Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


BitDefender Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Commtouch Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Fortinet Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


GData Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Jiangmin Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


K7AntiVirus Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Symantec Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


TheHacker Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


TrendMicro-HouseCall Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


K7GW Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Comodo Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


F-Secure Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Microsoft Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


MicroWorld-eScan Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


NANO-Antivirus Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Kingsoft Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


Malwarebytes Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


McAfee Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


ByteHero Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


CAT-QuickHeal Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM


nProtect Antivirus
Beta Version
Beta Version
9/28/2013 7:51:05 AM

No tiene los permisos requeridos para ver los archivos adjuntos a este mensaje.
Responder

Volver a “Fuentes”