Skip to content

Instantly share code, notes, and snippets.

View glenux's full-sized avatar
Being happy

Glenn Y. Rolland glenux

Being happy
View GitHub Profile
@glenux
glenux / gnux_wp-security-hammer.sh
Last active December 2, 2017 12:20
A simple script to secure wordpress installations
#!/bin/sh
set -u
set -e
echo "WP Security Hammer v0.1"
echo "======================="
echo "Target directory: $TARGET"
echo "Looking for files leading to information disclosure..."
while read -r FILE ; do
Verifying that +glenux is my blockchain ID. https://onename.com/glenux
@glenux
glenux / gnux_pdfnovector.sh
Created January 23, 2017 11:47
Script to compress large bitmap PDFs
#!/bin/sh
INPUT="$1"
TMPDIR=`mktemp -d`
# TODO: READ ALSO https://gist.github.com/yura/670974
echo "Input file: $INPUT"
echo "Converting PDF to images"
#!/usr/bin/env ruby
# vim: set ts=2 sw=2 et:
require 'find'
require 'colorize'
require 'fileutils'
class Merger
def initialize
@ind = 0

Faking DNS from userland

To give false DNS responses from userland we need to handle different type of syscalls : gethostbyname(), gethostbyname2(), getaddrinfo(), getnameinfo(), etc. To cover all these cases, and to prevent leaks to real dns servers, we will use two libraries : libresolv_wrapper and libnss_wrapper.

Installation

Install resolv_wrapper and nss_wrapper, either from sources or from your favorite Linux distribution.

/*
Exercice - prixttc (10 min)
===========================
A. Ecrire une fonction 'prixTTC' qui:
- prend un parametre numérique (prix_ht)
- calcule le prix TTC (rappel: la TVA est de 20%)
- retourne le prix TTC.
B. Vérifier votre fonction avec le programme suivant :
#!/bin/bash
org="$(git remote get-url origin |awk -F/ '{ print $4; }')"
project="$(basename "$(git rev-parse --show-toplevel)")"
branch=$(git rev-parse --abbrev-ref HEAD)
url="https://bitbucket.org/${org}/${project}/pull-request/new?source=${branch}&t=1"
xdg-open "$url"
#!/bin/bash
org="$(git remote get-url origin |awk -F/ '{ print $4; }')"
project="$(basename "$(git rev-parse --show-toplevel)")"
branch=$(git rev-parse --abbrev-ref HEAD)
url="https://bitbucket.org/${org}/${project}/pull-request/new?source=${branch}&t=1"
xdg-open "$url"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at