This file contains 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 python | |
import requests | |
import warnings | |
import fixssl | |
import time | |
warnings.filterwarnings("ignore") | |
urls = [ |
This file contains 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 python | |
# PowerOn machines based on uuid | |
from pyVim import connect | |
from tools import cli | |
from tools import tasks | |
from pyVmomi import vim | |
import ssl |
This file contains 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 pyVim import connect | |
from pyVmomi import vim | |
import ssl | |
import tools.cli as cli | |
# Monkey patch for SSL :-) | |
ssl._create_default_https_context = ssl._create_unverified_context |
This file contains 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
# Attempts to get procs on a given VM (uuid) | |
# Through pyvmomi and vmware-tools | |
# | |
from pyVim import connect | |
from pyVmomi import vim | |
import ssl | |
import tools.cli as cli | |
import atexit |
This file contains 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 pyVim import connect | |
from pyVmomi import vim | |
import pandas as pd | |
import ssl | |
import tools.cli as cli | |
import atexit | |
import json | |
# Monkey patch SSL |
This file contains 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 | |
from nmap import PortScanner | |
netws = [ | |
'a.b.c.d/24', | |
'a.b.c.d/23', | |
] | |
This file contains 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 | |
import os | |
while True: | |
line = input('> ') | |
line_array = line.split() | |
pid = os.fork() | |
if not pid: | |
os.execvp(line_array[0], line_array) |
This file contains 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 asyncio | |
import aiohttp | |
@asyncio.coroutine | |
def get_status(url): | |
code = '000' | |
try: | |
res = yield from asyncio.wait_for(aiohttp.request('GET', url), 4) | |
code = res.status |
This file contains 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 asyncio | |
import aiohttp | |
def fetch_page(url, idx): | |
url = 'https://yahoo.com' | |
response = yield from aiohttp.request('GET', url) | |
if response.status == 200: | |
print("data fetched successfully for: %d" % idx) | |
else: |
This file contains 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 python | |
""" | |
NOTE: | |
This gist has been moved to EZmomi: | |
https://github.com/snobear/ezmomi | |
Give it a star or fork. Contributions are more than welcome. I'm hoping it will become an easy cli tool for | |
common VMware tasks. |