Starting my 100 days of coding

I took up the 100 days of coding challenge to work on my coding skills in Python. I am pretty good with the requests module, but that is about it. I figured this was a way to work on my coding skills and help learn some additional skills that I didn’t have before. Already 7 days in I’ve managed to learn a few things I didn’t know before and also managed to build out some programs so I can update my existing stuff and add in some password randomization. I built a git repository for all of the coding projects under one single heading. Figured this way I could reference it later if needed:

 

https://github.com/undrwatr/100daysofcode

Python script to pull ip addresses from Meraki and then update Microsoft trusted locations in Azure AD

I needed a script that would automatically get all of the ip addresses for my stores and then upload them to Microsoft on a weekly basis and create a trusted location. I did this so that we wouldn’t have to use MFA for all of the stores and they would be able to log in with just their username and password. Since all of the data was sitting in Meraki I decided to pull it from there and then upload it to Microsoft. Here is the script that goes through all of the wireless devices in my Meraki org and then updates Microsoft with that data and sends an email when it’s been done successfully. I’ve posted the script for reference and anonymized the portions of the script that I didn’t put into the cred.py file.

I used the wireless devices from the Meraki cloud because they were easier to pull out and integrate into the script.

I posted the code to my GitHub repository so that others can see what I did and make recommendations for changes or other things that should be added.

 

https://github.com/undrwatr/Update_Location

 

Future changes for the script:

Keep just one database of the ip addresses and update it as needed instead of creating a new site

Additional error checking in case the script doesn’t run

Planes on parade

With the enforced solitude, I have been going back through and editing some of the plane photos that I have taken. Here are a couple that were dark and not good looking. So I went through and punched up the colors on them to make them look better. These were both taken during the 2017 Planes of Fame Airshow. Happy with how the end results have come out and what they look like.

 

2017 5 6 Chino Airshow 16422017 5 6 Chino Airshow 4487

F-117 Nighthawk Early Preview at Palm Springs Air Museum

Went to an early access preview of the F-117 Nighthawk display at the Palm Springs Air Museum. The plan had just been received and they hadn’t started restoring it yet. So it’s shown with all or the RAM(Radar Absorbing material) removed along with the engines and some other vital components. The plane was an active participant in Desert Storm and other conflicts. Due to the secrecy of the technology and the plane Lockheed Martin and the Military wouldn’t allow for it to be decommissioned with the full technology that it had in production. The plane was impressive to see up close and in person, even in the drab gray and missing some of the bumpers around it. The engineer that spoke during the presentation was also interesting and told some good stories about his experiences with developing the plane along with stories from some of the pilots that flew the plane into battle.2020 11 27 F 1170702

2020 11 27 F 1170873

2020 11 27 F 1171007

Scuba Diving in Farnsworth Banks

I went diving for the first time at Farnsworth Banks on the backside of Catalina Island. It was a different experience since this is a site that is on the ocean side of Catalina and not protected between Catalina and the West Coast of California. I had wanted to dive this site before and never had the chance to before. I went out on the Magician dive boat and did two dives on the site. I should have spent some time doing some research on the site as it was a little jarring to find out that when I descended down the anchor line I found myself at 80 feet. Also I brought the wrong camera rig for this site as I didn’t have any external illumination for my Go Pro so a lot of my shots came out rather dark and grainy as the Go Pro tried to recover and get something usable. Unfortunately most of the footage and none of the images are good enough in my opinion.

 

UntitledImage

Scripts to migrate hosts from ASA to Fortigate

For my job I am in the process of migrating from an ASA to a FortiGate firewalls. Part of this has been moving the configuration that we already have in place on the ASA and translating it too FortiGate. I needed to convert several address lists. Some of those address lists where hundreds of addresses long and I didn’t want to type those in. So I started using my python skills to build out the configuration by taking in a list of the ip addresses and then outputting the configuration needed for the FortiGate firewall.

Here is the current version of that script:

# variables needed througout:
file = input(“Name of file? “)
title = input(“Name of hosts and group? “)

addresses = open(file, “r”)

print(“config firewall address”)

incr = 1
host_entries = ‘set member’
for address in addresses:
    address = address.rstrip(‘\n’)
    print(‘edit “H_’ + title + str(incr) + ‘”’)
    host_entries = (host_entries + (‘ “H_’ + title + str(incr) + ‘”’))
    print(“set subnet ” + address + ” 255.255.255.255”)
    print(“next”)
    incr = (incr + 1)

print(‘end’)
print(“config firewall addrgrp”)
print(‘edit “G_’+ title + ‘”‘)
print(host_entries)
print(‘next’)
print(‘end’)