@@ -0,0 +1,2560 @@
+#!/usr/bin/env python%0A%0AVIRUSTOTAL_APIKEY = None%0A%0Afrom contextlib import closing%0Afrom argparse import ArgumentParser%0Afrom colorama import init, Fore%0Afrom os.path import join%0Afrom config import *%0Afrom time import time%0Afrom vt import VirusTotal%0Aimport sqlite3%0Aimport signal%0A%0Ainit(autoreset=True)%0A%0Acreate = ('CREATE TABLE IF NOT EXISTS virus (pkg PRIMARY KEY, id, uploaded, detected)')%0Aselect1 = 'SELECT pkg, path FROM download WHERE pkg NOT IN (SELECT pkg FROM virus) LIMIT 1'%0Aselect2 = 'SELECT pkg, id FROM virus WHERE detected = -1 AND uploaded %3C ? LIMIT 1'%0Ainsert = 'INSERT INTO virus VALUES (?, ?, ?, -1)'%0Aupdate = 'UPDATE virus SET detected = ? WHERE pkg = ?'%0A%0Adef exit():%0A    raise SystemExit%0A%0Aclass Checker():%0A%0A    def __init__(self, basepath):%0A        self.api = VirusTotal(VIRUSTOTAL_APIKEY)%0A        self.basepath = basepath%0A%0A    def scan(self, db):%0A        with closing(db.cursor()) as cursor:%0A            selected = cursor.execute(select1).fetchall()%0A            for pkg, path in selected:%0A                print Fore.BLUE + 'Uploading %25s for scan ...' %25 pkg%0A                id = self.api.scan(join(self.basepath, path))%0A                cursor.execute(insert, (pkg, id, time()))%0A                db.commit()%0A        return len(selected)%0A%0A    def result(self, db):%0A        with closing(db.cursor()) as cursor:%0A            selected = cursor.execute(select2, %5Btime() - 3600%5D).fetchall()%0A            for pkg, id in selected:%0A                detected = self.api.get_percent_detected(id)%0A                cursor.execute(update, (detected, pkg))%0A                print '%7B%7D %5B%7B%7D --%3E %7B:.0%25%7D virus%5D'.format(Fore.GREEN%0A                    if not detected else Fore.YELLOW, pkg, detected)%0A        return len(selected)%0A%0A    def createtable(self, db):%0A        with closing(db.cursor()) as cursor:%0A            cursor.execute(create)%0A            db.commit()%0A%0A    def checkall(self, dbname):%0A        with sqlite3.connect(dbname, timeout=10) as db:%0A            self.createtable(db)%0A            while True:%0A                scanned = self.scan(db)%0A                resulted = self.result(db)%0A                if not scanned and not resulted:%0A                    print 'Everything done for now'%0A                    break%0A        exit()%0A%0Aif __name__ == '__main__':%0A    parser = ArgumentParser(description='Check apks with VirusTotal')%0A    parser.add_argument('DB', help='sqlite3 apps db')%0A    parser.add_argument('-b', '--basedir', default='.', help='base apk dir')%0A    args = parser.parse_args()%0A    signal.signal(signal.SIGINT, exit)%0A    Checker(args.basedir).checkall(args.DB)%0A%0A

Add checker.py to virustotal (what does the heavy lifting)