Last active
August 23, 2021 21:32
-
-
Save pedramamini/c4434f58787203b000167be10de113b1 to your computer and use it in GitHub Desktop.
InQuest Labs: Trystero Project - Google vs Microsoft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
""" | |
Leverage the open API from labs.inquest.net to query the Trystero project data and compare which vendor, between | |
Google and Microsoft "won" the most days from the given YYYY-MM-DD to now. Example: | |
β― python google_vs_microsoft.py 2021-06-01 | |
since=2021-06-01 day=2021-08-16 (64) google=21 πmicrosoft=39 | |
google π days: 21 | |
microsoft π days: 39 | |
total days: 64 | |
WINNER since 2021-06-01 π₯π₯π₯ | |
πΎ Microsoft! | |
This script requires the installation of: | |
https://github.com/inquest/python-inquestlabs | |
Demo: | |
https://go.inquest.net/google_vs_microsoft-20210601-20210817.gif | |
Overall Microsoft w/ATP (pay for service) beats Google, but there are weeks that Google beats Microsoft and if you | |
look at the MIME distribution among the bypasses, they are better at blocking different things. | |
""" | |
import inquestlabs | |
import sys | |
labs = inquestlabs.inquestlabs_api() | |
google = 0 | |
microsoft = 0 | |
since = "2021-01-01" | |
days = 0 | |
arg = sys.argv.pop() | |
debug = True | |
if arg.startswith("202") and len(arg) == 10: | |
since = arg | |
for day in labs.trystero_list_days(): | |
if day == "first_record": | |
continue | |
if day < since: | |
continue | |
days += 1 | |
# bypasses on this day per provider. | |
g = 0 | |
m = 0 | |
for sample in labs.trystero_list_samples(day): | |
if "," in sample['bypasses']: | |
continue | |
elif "google" in sample['bypasses']: | |
g += 1 | |
elif "microsoft" in sample['bypasses']: | |
m += 1 | |
# if google was bypassed more, microsoft wins the day. | |
if g > m: | |
microsoft += 1 | |
# if microsoft was bypassed more, google wins the day. | |
elif m > g: | |
google += 1 | |
if debug: | |
fvars = since, day, days, google, microsoft | |
if google > microsoft: | |
sys.stdout.write("since=%s day=%s (%d) | π google=%d vs microsoft=%d\r" % fvars) | |
elif microsoft > google: | |
sys.stdout.write("since=%s day=%s (%d) | google=%d vs microsoft=%d π\r" % fvars) | |
else: | |
sys.stdout.write("since=%s day=%s (%d) | google=%d vs microsoft=%d\r" % fvars) | |
print() | |
print("google π days: %d" % google) | |
print("microsoft π days: %d" % microsoft) | |
print("total days: %d" % days) | |
print("WINNER since %s π₯π₯π₯" % since) | |
if microsoft > google: | |
print("πΎ Microsoft!") | |
elif google > microsoft: | |
print("πΎ Google!") | |
else: | |
print("π₯ TIE?!?") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment