# uploadto_androidobservatory = False
+# If you want to upload the release apk file to virustotal.com
+# You have to enter your profile apikey to enable the upload.
+#
+# virustotal_apikey = "virustotal_apikey"
+
+
# The build logs can be posted to a mediawiki instance, like on f-droid.org.
# wiki_protocol = "http"
# wiki_server = "server"
logging.info(message)
+def upload_to_virustotal(repo_section, vt_apikey):
+ import requests
+
+ if repo_section == 'repo':
+ for f in glob.glob(os.path.join(repo_section, '*.apk')):
+ fpath = f
+ fname = os.path.basename(f)
+ logging.info('Uploading ' + fname + ' to virustotal.com')
+
+ # upload the file with a post request
+ params = {'apikey': vt_apikey}
+ files = {'file': (fname, open(fpath, 'rb'))}
+ r = requests.post('https://www.virustotal.com/vtapi/v2/file/scan', files=files, params=params)
+ response = r.json()
+
+ logging.info(response['verbose_msg'] + " " + response['permalink'])
+
+
def main():
global config, options
and not config.get('serverwebroot') \
and not config.get('servergitmirrors') \
and not config.get('uploadto_androidobservatory') \
+ and not config.get('virustotal_apikey') \
and local_copy_dir is None:
- logging.warn('No serverwebroot, servergitmirrors, local_copy_dir, awsbucket, or uploadto_androidobservatory set! '
- + 'Edit your config.py to set at least one.')
+ logging.warn('No option set! Edit your config.py to set at least one among:\n'
+ + 'serverwebroot, servergitmirrors, local_copy_dir, awsbucket, virustotal_apikey or uploadto_androidobservatory')
sys.exit(1)
repo_sections = ['repo']
update_awsbucket(repo_section)
if config.get('uploadto_androidobservatory'):
upload_to_android_observatory(repo_section)
+ if config.get('virustotal_apikey'):
+ upload_to_virustotal(repo_section, config.get('virustotal_apikey'))
sys.exit(0)