Skip to content

Instantly share code, notes, and snippets.

View abdallah's full-sized avatar
🏠
Working from home

Abdallah Deeb abdallah

🏠
Working from home
View GitHub Profile
@abdallah
abdallah / guess_dns_zone.py
Created September 12, 2012 09:04
Guess DNS Zone
import dns.zone
import dns.resolver
domain_name = 'rimuhosting.com' # --- CHANGE THIS
dns_server = 'ns1.rimuhosting.com'
def guess_zone(domain_name):
soa_answer = dns.resolver.query(domain_name, 'SOA')
soa_rr = soa_answer.rrset[0]
ns_answer = dns.resolver.query(domain_name, 'NS')
@abdallah
abdallah / rimudns.py
Created September 18, 2012 13:02
RimuHosting/Zonomi DNS API
# See https://rimuhosting.com/dns/dyndns.jsp for more information
# or https://zonomi.com/app/dns/dyndns.jsp
# Tests
#
# from rimudns import RimuDNS
#
# api_key = '4ad62e78ac5595f662004b0f01c1a723'
# dns = DNS(api_key)
#
# dns.change_ip('192.168.59.133', '192.168.59.132')
@abdallah
abdallah / installmaven.sh
Last active December 14, 2015 16:38
Install latest maven
#!/bin/sh
URL="http://apache.mirrors.hoobly.com/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz"
INSTALLATION_DIR=/usr/local/maven
if [ -d $INSTALLATION_DIR ]; then
mv $INSTALLATION_DIR $INSTALLATION_DIR.$(date +"%Y%m%d")
fi
mkdir $INSTALLATION_DIR
wget -O- $URL | tar zx --strip-components=1 -C $INSTALLATION_DIR
cat << _EOF_ > /etc/profile.d/maven.sh
#!/bin/bash
@abdallah
abdallah / tellmewhenurdone.sh
Last active December 14, 2015 21:29
Email me when a long running process is finished
PROCESS=$1
SLEEP_TIME=60
EMAIL_ADDRESS=abdallah@example.com
while [ -n "$(pidof $PROCESS)" ]; do sleep $SLEEP_TIME; done; echo "Finished ..." | mail -s "Work finished" $EMAIL_ADDRESS
#!/bin/bash
httpdconfdir=/etc/httpd/conf
[ -e /etc/apache2 ] && httpdconfdir=/etc/apache2
is_wildcard="n"
domainname=""
keyfile=""
certfile=""
csrfile=""
conffile=".sslconf"
[Definition]
failregex = <HOST>.*] "POST /wp-login.php
ignoreregex =
@abdallah
abdallah / .htaccess
Created November 26, 2013 09:18
email tracking
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(png|css)$
RewriteRule (.*) n.php [L,QSA]
@abdallah
abdallah / ntp-ddos-vulnerable-ips.sh
Created January 15, 2014 10:03
Inspect range of IPs for NTP DDOS vulnerability
IPRANGE=10.10.10.0/24
nmap -sU -pU:123 -Pn -n --script=ntp-monlist $IPRANGE | grep -B 4 ntp-monlist | grep report | awk '{ print $5 }'
@abdallah
abdallah / newdjango.sh
Last active January 22, 2016 15:09
Bash script to initialize new django project
#!/bin/bash
#
# Author: Abdallah Deeb <abdallah@deeb.me>
# Requirements: python, pip, virtualenv, virutalenvwrapper, git
#
# Edit the following 2 lines
PROJECTNAME=proj
APPNAME=myapp
if [ -n "$2" ]
then
@abdallah
abdallah / plugin.php
Created February 10, 2016 08:33
WordPress ajax skeleton
<?php
/*
Plugin Name: My Plugin
Plugin URI: https://deeb.me
Description: 10 ways to peel an orange
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}