Giving up my 100 days of code

So I am 20 days into my 100 days of code and I am going to stop going through the class I was taking on Udemy. I have finally gotten to a point where a lot of the modules they are trying to have me use aren’t working and I am spending more time troubleshooting their stuff than I am actually learning. So now I am going to start my own exercises and continue my learning on my own. I am going to try and cherry pick some of the courses in the class that still work, but will end up refining my code with what I have already learned and trying to put some the practices into place to improve my code. I will also work on automating more of the functions that need to be automated in my environment. In all I am frustrated by the fact that I could complete the Udemy course, but thankful for the few things that I have learned.

Script to update Address entries in Fortigate

With our VPN being over utilized I had to implement split tunneling on our vpn. However there are some web services that require a known IP address to access. Unfortunately these services are on AWS which the IP address changes often. I built this script to lookup the addresses and then update the Fortigate firewalls VPN Routing list to make sure that the traffic goes over the vpn tunnel and through our known IP address to access the service.

 

#!/usr/bin/python3
#Update Epsilon on the Fortigate Firewall VPNs

from nslookup import Nslookup
from netmiko import ConnectHandler
import cred

device1 = {
    “host”: cred.hostname,
    “username”: cred.rancid_username,
    “password”: cred.rancid_password,
    “device_type”: “fortinet”,
    “secret”: cred.rancid_password,
}

#Connect to the Fortinet
net_connect = ConnectHandler(**device1)

#Listing of the domains to query
DOMAIN_FILE = open(“domains.txt”, “r”)
#DNS Server to query
DNS_SERVER = [‘x.x.x.x’]

def LOOKUP_DOMAIN():
    #queries the specified dns server to get the info for the urls and writes the data to a config file
    dns_query = Nslookup(dns_servers=(DNS_SERVER))
    ips_record = dns_query.dns_lookup(line)
    ORDERNUMBER = 1
        for x in ips_record.answer:
            FILE_CONFIG.write(“edit ” + line + “_” + str(ORDERNUMBER) + ‘\n’)
            FILE_CONFIG.write(“set subnet ” + x + ” 255.255.255.255″ +’\n’)
            FILE_CONFIG.write(“next” +’\n’)
            ORDERNUMBER = (ORDERNUMBER + 1)

 

FILE_CONFIG = open(‘config.txt’,’w’)
FILE_CONFIG.write(“config firewall address” +’\n’)

for line in DOMAIN_FILE:
line = line.rstrip(‘\n’)
LOOKUP_DOMAIN()

FILE_CONFIG.write(“end” +’\n’)

FILE_CONFIG.close()

# write to the Fortigate
output2 = net_connect.send_config_from_file(config_file=”config.txt”)

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