Probably what you're looking for
[a]
Alternate (alternate version of the game, usually trying a different output method)[p]
Pirate
def check_if_ipv4(ip): | |
quad = ip.split(".") | |
quadinteger = [] | |
try: | |
quadinteger = [int(num) for num in quad] | |
except ValueError: | |
#print('ERROR: Must be an ipv4 address') | |
return | |
while len(quadinteger) != 4: | |
#print('ERROR: Must be four octects') |
More recent resolution: | |
1. cd ~/../../etc (go to etc folder in WSL). | |
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line). | |
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line). | |
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian). | |
5. cd ~/../../etc (go to etc folder in WSL). | |
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file). | |
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and | |
secondary. |
#!/usr/bin/python3 | |
import sys, re | |
f = open(sys.argv[1],'r') | |
text = f.read() | |
ips = [] | |
regex = re.findall(r'\b(?:\d{1,3}\.){3}\d{1,3}\b',text) | |
if regex is not None: | |
for match in regex: | |
if match not in ips: |
<!-- Google+ API was shutdown on 3/7/2019. New OAuthFlow (listed below) uses the updated Google sign-in. --> | |
<!--You just need to update this in login.html page for Udacity's Full Stack nanodegree --> | |
<!-- Below is the Google link I used for reference --> | |
<!-- https://developers.google.com/identity/sign-in/web/server-side-flow --> | |
**login.html Page** | |
(1) Include the following in <head>..</head> tag: |
#!/usr/bin/env python3 | |
#This script assumes there is a network object-group on all Cisco ASAs called 'grp..blacklist', and that the group is attached to the correct ACL/interface | |
#import all the modules we need | |
import sys | |
import os | |
import netmiko | |
from netmiko import ConnectHandler | |
print('imported modules') |
def netmask_to_cidr(m_netmask): | |
return(sum([ bin(int(bits)).count("1") for bits in m_netmask.split(".") ])) |
import json | |
import unittest | |
import xmltodict | |
class XmlDiff(object): | |
def __init__(self, xml1, xml2): | |
self.dict1 = json.loads(json.dumps((xmltodict.parse(xml1)))) | |
self.dict2 = json.loads(json.dumps((xmltodict.parse(xml2)))) |
#!/usr/bin/env python | |
# python subnet.py 200.100.33.65/26 | |
import sys | |
# Get address string and CIDR string from command line | |
(addrString, cidrString) = sys.argv[1].split('/') | |
# Split address into octets and turn CIDR into int | |
addr = addrString.split('.') |