Skip to content

Instantly share code, notes, and snippets.

@MorbosVermin
MorbosVermin / tomcat-info.py
Created August 1, 2014 20:30
Tomcat information script in Python. This will parse the server.xml, tomcat-users.xml, and output deployed applications.
#!/usr/bin/env python
'''
Parses a Tomcat configuration and will output various helpful
settings to aide in the review/assessment of the service.
Copyright (c)2014 Mike Duncan <[email protected]>.
'''
import os, sys
import xml.etree.ElementTree as et
#!/bin/bash
#
# Provides useful information for a GIT repo. Place somewhere in your PATH
# and you should be able to simply execute 'git info' or 'git-info' to
# execute.
#
# Check for git binary.
git=`which git`
[ -z "${git}" ] && echo "Error: git is required to be installed." && exit 1;
#!/bin/bash
[[ -e $HOME/colors.conf ]] && . $HOME/colors.conf
CWD=`pwd`
NAME=$1
#DIALOG="${DIALOG=dialog} --clear"
tempfile=/tmp/sel-$$
[[ -z "${NAME}" ]] && echo "Syntax: $0 <name> [<path to stage3 tarball>] [<path to portage tarball>]" && exit 1;
sudo ls > /dev/null
#!/bin/bash
NAME=$1
[[ -z "${NAME}" ]] && echo "Syntax: $0 <package>" && exit 1;
sudo ls > /dev/null
echo -n ">> Setting up environment; please wait..."
sudo mount -t proc /proc ${NAME}/proc
sudo mount --bind /dev ${NAME}/dev
sudo mount --bind /sys ${NAME}/sys
/**
* Converts the given RSAPublicKey obejct to RSA-SSH format byte array. This
* byte[] returned DOES NOT include the prefixed <i>ssh-rsa</i> nor any appended
* text (i.e. the username or email address) for a comment.
*
* @param pubkey java.security.interfaces.RSAPublicKey to convert.
* @return byte[]
* @throws IOException
*/
public static final byte[] publicKeyToRsaSsh(RSAPublicKey pubkey)
#!/bin/bash
rootpwd=$(cat /dev/urandom|tr -dc "a-zA-Z0-9-_\$\?"|fold -w 30|head -n 1)
passwd "root" <<EOF
$rootpwd
$rootpwd
EOF
logger -t root_scramble "Scrambled the eggs doOd!"
exit $?
import os, sys, base64
from M2Crypto import X509
'''
Load the certificate from a file.
'''
cert = X509.load_cert(filename, X509.FORMAT_DER)
'''
Lets first save the certiticate as PEM.
#!/bin/bash
# grab the public keys on a PIV/CAC and generate ssh-rsa which can be appended to the .ssh/authorized_keys(2) file for pubkeyauth.
# your PKCS#11 driver may vary (we also used cackey).
#LIB=/usr/lib/libcackey.so
LIB=/usr/lib/pkcs11/libcoolkeypkcs11.so
ssh-keygen -D ${LIB}
@MorbosVermin
MorbosVermin / StringSec.cs
Last active December 6, 2017 15:19
General Utils
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Com.WaitWha.Utils
@MorbosVermin
MorbosVermin / TestClass.java
Created February 16, 2018 15:20
Validation using an Enum type.
import java.text.ParseException;
public class TestClass {
static class Parameter {
private String name;
private Object value;
public Parameter(String name, Object value) {