Skip to content

Instantly share code, notes, and snippets.

@kckrinke
kckrinke / list-missing-ldd.sh
Created September 25, 2015 23:40
List missing ldd files
#!/bin/bash
sudo ldconfig -p \
| grep "=>" \
| perl -pe 's!^.*\=\>\s(.+?)\s*$!$1\n!' \
| while read SO; do [ ! -f "${SO}" ] && echo "missing: ${SO}"; done

Keybase proof

I hereby claim:

  • I am kckrinke on github.
  • I am kckrinke (https://keybase.io/kckrinke) on keybase.
  • I have a public key ASCVHGJNL85LzXbwMnSCM-qrs0EUDDAUf1PMcivH09QwPwo

To claim this, I am signing this object:

<?php
/*
iframe-test.php - Test for iframe-based site vulnerabilities.
author: Kevin C. Krinke <kevin@krinke.ca>
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
@kckrinke
kckrinke / psgrep.sh
Created October 24, 2016 17:47
Simple script to grep the ps list without grep'ing the grep itself
#!/bin/bash
export COLUMNS=1024
exec \
ps -eo pid,user,pri,stat,pcpu,command \
| grep -v grep \
| egrep "$@"
@kckrinke
kckrinke / git-whoami.sh
Last active October 24, 2016 17:51
Who does GIT think you are?
#!/bin/bash
MODE_SHOW=short
SHOW_MAIL=1
SHOW_NAME=1
while [ $# -gt 0 ]
do
case "$1" in
"-h"|"--help")
@kckrinke
kckrinke / apt-hold
Created October 24, 2016 17:56
apt-get hold / un-hold debian package
#!/bin/bash
#
# To hold one or more packages:
# apt-hold <pkg> [pkg2 ...]
#
# To un-hold one ore more packages:
# apt-hold -u <pkg> [pkg2 ...]
# or if this script is symlinked as apt-unhold:
# apt-unhold <pkg> [pkg2 ...]
@kckrinke
kckrinke / php-lint.sh
Created October 24, 2016 17:58
Check php source files for syntax errors
#!/bin/bash
function lint_check () {
result=`php -l "$1" 2>&1`
if [ $? -ne 0 ]
then
echo "ERROR: php -l \"$1\""
echo "${result}"
return $?
fi
@kckrinke
kckrinke / get-remote-ssl-cert.sh
Created October 24, 2016 18:00
Retrieve SSL (public) certificate from a remote host
#!/bin/bash
if [ -z "$1" ]
then
echo "usage: $(basename $0) <server:port>"
exit 1
fi
echo | openssl s_client -connect "$1" 2>&1 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
@kckrinke
kckrinke / get-remote-ssl-cert2.sh
Created October 24, 2016 18:02
Another way of retrieving SSL (public) certificate from a remote host
#!/bin/bash
if [ $# -ne 1 ]
then
echo "usage: $(basename $0) host:port"
exit 1
fi
openssl x509 -in <(openssl s_client -connect "$1" -prexit 2>/dev/null)
@kckrinke
kckrinke / psgrep.sh
Created November 1, 2016 22:50
Grep the process list, without grep'ing grep itself.
#!/bin/bash
: "${PS_OPTS:=ax}"
exec ps ${PS_OPTS} | egrep -v '\b(psgrep|grep)\b' | egrep "$@"