This file contains hidden or 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
import boto3 | |
def main(): | |
organizations_client = boto3.client("organizations") | |
list_accounts_object = organizations_client.list_accounts() | |
all_accounts = [] | |
accounts = list_accounts_object["Accounts"] | |
while "NextToken" in list_accounts_object: |
This file contains hidden or 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
#!/usr/bin/python | |
import os, socket, sys, time | |
socket.setdefaulttimeout(10) | |
start = time.time() | |
subnets = ['140.107.42','140.107.43','140.107.88','140.107.89','140.107.134',\ | |
'140.107.135','140.107.52','140.107.53','140.107.152','140.107.153',\ | |
'140.107.170','140.107.171'] | |
scanips = []; hosts = []; vhosts = []; free = []; vfree = []; reclaim = []; squatters = [] |
This file contains hidden or 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
#!/usr/bin/env python3 | |
""" | |
Alternate account naming rules | |
Rule 1: firstname + lastname is less 18 or less characters long total | |
== firstname + "." + lastname (john.doe) | |
if conflict, check if rule 2 format (below) is available. If so use it | |
== firstname_initial + "." + lastname (j.doe) | |
if not, append an integer (starting with 2) to the end of the username | |
=== firstname + "." + lastname + int (john.doe2) |
This file contains hidden or 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
#!/usr/bin/env python3 | |
""" | |
Account naming rules | |
Rule 1: firstname + lastname is less 18 or less characters long total | |
== firstname + "." + lastname (john.doe) | |
if conflict append an integer (starting with 2) to the end of the username | |
=== firstname + "." + lastname + int (john.doe2) | |
Rule 2: firstname + lastname is greater than 18 characters long total *and* |
This file contains hidden or 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
from PIL import Image | |
def main(): | |
images = [[] for p in range(num_people)] | |
im = Image.open(image) | |
im = im.convert("RGB") | |
size = im.size | |
data = list(im.getdata()) | |
for _ in range(int(len(data)/num_people)): |
This file contains hidden or 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
from math import sqrt | |
from PIL import Image | |
def main(): | |
img = Image.open("contact-tracing.png") | |
infected = get_color_coords(img, Ic) | |
healthy = get_color_coords(img, Hc) | |
contact = [] | |
for i in infected: |
This file contains hidden or 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
import BaseHTTPServer | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import sys | |
import base64 | |
key = "" | |
class AuthHandler(SimpleHTTPRequestHandler): | |
''' Main class to present webpages and authentication. ''' | |
def do_HEAD(self): |
This file contains hidden or 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
def find_image(region): | |
""" | |
Finds the latest Windows 2012R2 offical Amazon AMI and returns the ID | |
""" | |
sys.stdout.write("\nFinding latest Windows 2012R2 image...") | |
ec2 = boto3.resource('ec2', region_name = "{0}".format(region)) | |
images = ec2.images.filter( | |
Owners=['amazon'], | |
Filters=[ | |
{'Name': 'name','Values': ['Windows_Server-2012-R2_RTM-English-64Bit-Base-*']}, |
NewerOlder