Skip to content

Instantly share code, notes, and snippets.

View rdapaz's full-sized avatar

ricdeez rdapaz

View GitHub Profile
@rdapaz
rdapaz / VisioGuides.py
Created July 9, 2020 03:54
Equidistant Guides in Visio (Using Python Script)
import win32com.client as c
vsApp = c.gencache.EnsureDispatch('Visio.Application')
vsApp.Visible = True
path = r'<file and path>.vsd'
dwg = vsApp.Documents.Open(path)
# TODO this range gets changed depending on the guides which need to be dragged and dropped on the sheet
guides = [f'Sheet.{x}' for x in range(1474, 1492)]
print(guides)
print(dwg.Pages('<TheSheet>').Name)
refShape = 'REFGUIDE'
@rdapaz
rdapaz / VisioGuideAdd.py
Created September 1, 2020 02:36
Add Visio Guides
import win32com.client as c
vsApp = c.gencache.EnsureDispatch('Visio.Application')
vsApp.Visible = True
path = r'https://woodsideenergy-my.sharepoint.com/personal/ricardo_dapaz_woodside_com_au/Documents/Desktop/ABB Transmittal-AU-33220002-AUABB-WSE-00001/LNADs/VA6000DJ0076.XXX1~.vsd'
dwg = vsApp.Documents.Open(path)
pge = dwg.Pages('Drawing')
x_diff = 144.64
x_steps = 24.0
x_step_diff = float(x_diff/x_steps)
x_start_step = 9.84
@rdapaz
rdapaz / VsdTools.py
Created September 24, 2020 06:46
Rename Visio Objects
import win32com.client as c
vsApp = c.gencache.EnsureDispatch('Visio.Application')
vsApp.Visible = True
path = r'https://woodsideenergy-my.sharepoint.com/personal/ricardo_dapaz_woodside_com_au/Documents/Desktop/Compass Documents/XA0000DJ0020.0009 (RDP).vsd'
dwg = vsApp.Documents.Open(path)
pge = dwg.Pages('CPMS CER, FAR 1&2')
nodes = {
'DESC.1': 'CERDAS1',
'DESC.2': 'CEREWS1',
@rdapaz
rdapaz / SubnetIPLister.py
Created October 7, 2020 04:14
List All IPs on a Subnet
import ipaddress
nw = ipaddress.IPv4Network('192.168.10.0/28')
for ip in nw:
print(ip)
@rdapaz
rdapaz / til.md
Last active October 7, 2020 13:34
TIL

Using Hashcat

echo -n "Password" | md5sum | tr -d " -" >> target_hashes.txt

echo -n "HELLO" | md5sum | tr -d " -" >> target_hashes.txt

echo -n "MYSECRET" | md5sum | tr -d " -" >> target_hashes.txt

echo -n "Test1234"| md5sum | tr -d " -" &gt;&gt; target_hashes.txt

@rdapaz
rdapaz / IguessIhavetoNameThis.sh
Created October 21, 2020 12:17
Download youtube video as mp3
# Note to future self...
# Preparatory Steps
# -----------------
# pip3 install youtube-dl
# sudo apt-get install ffmpeg
url=https://www.youtube.com/watch?v=b9fUdJdlExU
youtube-dl -F $url
# This gives list of available formats
youtube-dl -f 140 $url
# Say if file was downloaded as input.m4a
@rdapaz
rdapaz / getObjectsFromSecurityRules.py
Created November 18, 2020 09:07
Get Object Names from set commands in Palo Alto Firewall
import os
import re
import sqlite3
from pathlib import Path
def process(ary):
conn = sqlite3.connect(db_path)
cur = conn.cursor()
sql = """CREATE TABLE IF NOT EXISTS objects_in_rules (
id integer primary key,
@rdapaz
rdapaz / hypriot.md
Last active December 14, 2020 23:34
Change Hostname and IP Address on Hypriot

Change hostname on hypriot

Option 1: Do it after the SD card has been imaged and loaded on first boot

Change hostname by editing each of these files:

/etc/hosts
/etc/hostname
/etc/cloud/cloud.cfg 
@rdapaz
rdapaz / portscanner.ps1
Created December 17, 2020 07:12
Use Powershell as a port scanner
$range_of_ports = 1500 .. 1505
$ip = "10.230.149.232"
$range_of_ports | % { echo ((new-object Net.sockets.TCPClient).Connect($ip,$_)) (" Port $_ is open!") } 2>$null
https://www.sans.org/blog/pen-test-poster-white-board-powershell-built-in-port-scanner/
@rdapaz
rdapaz / ASA_tunnel.md
Created December 18, 2020 06:21
Configure Tunnel on ASA Firewall

Configure Tunnel on ASA

Phase 1 Configuration

Configure IKE V1

ASA1(config)# crypto ikev1 policy 10 
ASA1(config-ikev1-policy)# authentication pre-share