Skip to content

Instantly share code, notes, and snippets.

View pathcl's full-sized avatar

Luis San Martin pathcl

View GitHub Profile
@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 / fixnan.sh
Created August 27, 2015 20:49
fixnan cacti
#!/bin/bash
rddToolBin="/usr/bin/rrdtool"
rmBin="/bin/rm"
chownBin="/bin/chown"
userThatOwnsDb="www-data"
dbList="someRRd.rrd"
rm -fr /var/www/dump
rm -fr /var/www/restore
@pathcl
pathcl / googlesearch.py
Last active August 28, 2015 14:23
googlesearch.py
#!/usr/bin/env python2.7
# You need to have installed google module
# i.e.
# easy_install google
# https://pypi.python.org/pypi/google
try:
import re
import sys
@pathcl
pathcl / check ssl certificate
Created September 16, 2015 19:17
check_ssl_certificate.py
#!/usr/bin/python
"""
Usage: check_ssl_certificate -H <host> -p <port> [-m <method>]
[-c <days>] [-w <days>]
-h show the help
-H <HOST> host/ip to check
-p <port> port number
-m <method> (SSLv2|SSLv3|SSLv23|TLSv1) defaults to SSLv23
-c <days> day threshold for critical
@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 / shell-vmware.py
Last active July 10, 2020 01:54
VMware shell through pyVmomi
#!/usr/bin/env python3
# Please install pyVmomi first.
# i.e.
# pip install pyvmomi
#
from pyVim import connect
from pyVmomi import vmodl
from pyVmomi import vim
import re
@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