Skip to content

Instantly share code, notes, and snippets.

View mendel129's full-sized avatar

mendel129

View GitHub Profile
# Mendel's PowerShell profile
# https://gist.github.com/mendel129/33bc020d25efd813950eabc56be373a9
set-alias -name npp 'C:\Program Files\Notepad++\notepad++.exe'
set-alias -name edit 'C:\Program Files\Notepad++\notepad++.exe'
set-alias -name notepad 'C:\Program Files\Notepad++\notepad++.exe'
set-alias -name wireshark "C:\Program Files\Wireshark\Wireshark.exe"
$profilepath = $env:USERPROFILE
@mendel129
mendel129 / set-certificate
Created February 22, 2017 13:15
Another quick and dirty PoC script to retreive a Let's Encrypt certificate and post it to Directadmin. Script receives token and uploads to FTP to verify domain ownership. Probably needs PowerShell 5.
#import the ACMEsharp module - https://github.com/ebekker/ACMESharp
#more info: https://github.com/ebekker/ACMESharp/wiki/Quick-Start
import-module .\ACMESharp\ACMESharp.psd1
#set global variables
$date = "$(get-date -format yyyy-MM-dd--HH-mm)"
$dnsname1 = "dns1-$date"
$dnsname2 = "dns2-$date"
#DirectAdmin and FTP credentials
$Username = "fancyusername"
@mendel129
mendel129 / add-ntlmexception.ps1
Created June 1, 2017 07:07
adds ntlm exception
# used together with the Windows security policy "Network security: Restricit NTLM.
# if all NTLM is blocked, a computer becomes pretty useless, so this script to create exceptions based on failed connections from the NTLM log
# Adds exception to Network security: Restricit NTLM: Add remote server exceptions for NTLM authentication
function add-ntlmexception
{
$event = Get-WinEvent -FilterHashTable @{LogName='Microsoft-Windows-NTLM/Operational'; ID = 4001} -maxevents 1
$newexception = ((([xml]$event.toxml()).Event.EventData.Data) | ?{$_.name -eq "targetname"}).'#text'
$regpath = "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0"
$regname = "clientallowedntlmservers"
$currentvalues = (Get-ItemProperty $regpath).$regname
@mendel129
mendel129 / recycleapp.py
Last active October 18, 2020 22:05
python wrapper to get data from Belgium's waste pickup schedule via https://recycleapp.be
import requests
from datetime import datetime, date, timedelta
import re
CONF_CONSUMER = "recycleapp.be"
CONF_APPAPI="https://recycleapp.be/api/app/v1/"
# CONF_DAYSINFUTURE = 14
CONF_DAYSINFUTURE = 31
CONF_LANG='nl'
CONF_USERAGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0"