Skip to content

Instantly share code, notes, and snippets.

@pedramamini
Last active August 23, 2021 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedramamini/c4434f58787203b000167be10de113b1 to your computer and use it in GitHub Desktop.
Save pedramamini/c4434f58787203b000167be10de113b1 to your computer and use it in GitHub Desktop.
InQuest Labs: Trystero Project - Google vs Microsoft
#!/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