Skip to content

Instantly share code, notes, and snippets.

View pathcl's full-sized avatar

Luis San Martin pathcl

View GitHub Profile
@pathcl
pathcl / gist:3f71ae09457f01f3ad2b
Created July 24, 2015 15:29
session-counter.py
#!/usr/bin/env python
import requests
import warnings
import fixssl
import time
warnings.filterwarnings("ignore")
urls = [
@pathcl
pathcl / powerOn-by-uuid.py
Created August 7, 2015 15:03
Power on machines by uuid on VMware
#!/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
@pathcl
pathcl / get-cluster.py
Created August 7, 2015 15:14
Get some cluster through pymomi
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
@pathcl
pathcl / get_procs.py
Last active August 29, 2015 14:27
get procs on vm through pyvmomi
# 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
@pathcl
pathcl / vmproc_to_csv.py
Created August 19, 2015 17:15
export vm procceses to csv through vmware-tools
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
@pathcl
pathcl / scan for port 8443
Created September 16, 2015 19:18
scan.py
#!/usr/bin/env python3
from nmap import PortScanner
netws = [
'a.b.c.d/24',
'a.b.c.d/23',
]
@pathcl
pathcl / shell.py
Last active September 30, 2015 12:33
attemp to create a shell in python
#!/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)
@pathcl
pathcl / ex.py
Created October 13, 2015 18:52
aiohttp
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
@pathcl
pathcl / ex2.py
Created October 13, 2015 19:00
ex2.py
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:
@pathcl
pathcl / clone.py
Created October 21, 2015 21:45 — forked from snobear/clone.py
Clone VM from template with pyVmomi
#!/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.