Categories
PowerShell

Converting Bitmap Graphic to Icon

A simple script which takes two paths as parameters. The first is to an existing bitmap image (bmp/jpg/png/etc), and the second is the path to the desired icon file. The script will then use the .NET graphics library (System.Graphics) to perform the conversion and generate an icon file. This can be useful, for example when wanting to create a custom icon for an application you are developing, or for a shortcut you want to create on your desktop.

Categories
PowerShell

Base32 Encoder / Decoder

This is a PSM Module that implements a Base32 encoder and decoder. Although the .NET library contains native support for Base64 encoding/decoding via the [convert] class, there is no built in method for Base32 encoding or decoding.

Why might Base32 be useful?

Categories
PowerShell

Citrix ICA File CTX1 Encode/Decode

Categories
Infrastructure Linux

SMTPs Mail Relay using sendmail & stunnel

Configure sendmail & stunnel to relay email over SMTPs

This article describes how to install sendmail and stunnel onto an Ubuntu (Debian) Linux distribution and configure to forward all email for delivery to your ISP’s mail relay server via an stunnel proxy, so that the SMTP connection is tunnelled over TLS (i.e. it uses SMTPs).

Categories
Uncategorised

Make a TLS Connection to a server using OpenSSL

To establish a TLS connection to a server using the OpenSSL command-line, use the following…

Categories
Uncategorised

STARTTLS Everywhere

The Electronic Frontier Foundation (EFF) have started a project called “STARTTLS Everywhere”, with the aim of promoting more secure email delivery.

The idea is to maintain a queryable list of mail servers which support STARTTLS, in an effort to prevent downgrade attacks.

Categories
PowerShell

PoSh RNG via CSP

Generating Random Numbers in PowerShell using the Cryptographic Service Provider

The sample code shown below is broadly equivalent to using the PowerShell get-random cmdlet, but uses the native .NET RNG Cryptographic Service Provider.

Categories
Languages PowerShell

Send Raw PS or PCL to Printer

Want to send a raw PostScript or PCL file to a Windows network printer share? Simply copy the file to the UNC path…

Categories
Languages PowerShell

PoSh XPS MetaData

Reading & Editing

A simple proof-of-concept PowerShell Script to read and edit the metadata properties of an existing XML Paper Specification (XPS) document. The script opens the document, modifies the Title and Creator properties, and then outputs all properties to the PowerShell console window, before closing the document again.

Categories
Languages PowerShell

PoSh Win32 API PoC

ShowWindowASync

A simple proof-of-concept PowerShell script, which levereages the Win32 API to minimise the PowerShell console window for five seconds, and restore it again. Code taken from the Microsoft Docs page for the Add-Type cmdlet (see example 3).