Skip to content

Instantly share code, notes, and snippets.

View agramajo's full-sized avatar

Alejandro Gramajo agramajo

View GitHub Profile
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
import re
from optparse import OptionParser
@agramajo
agramajo / update-openssl.yml
Last active September 22, 2021 11:28
update openssl with ansible
---
- hosts: all
gather_facts: false
user: root
vars:
openssl_packages:
- openssl
- libssl1.0.0
openssl_services:
- nginx
@agramajo
agramajo / grants.pl
Last active August 29, 2015 14:19
show mysql grants
use DBI;
my $dbname = $ARGV[0] || "mysql";
my $dbuser = $ARGV[1] || "root";
my $dbpass = $ARGV[2] || "pass";
my $dbhost = $ARGV[3] || "localhost";
my $socket = "";
$dsn = "DBI:mysql:database=$dbname;host=$dbhost;mysql_socket=$socket";
$dbh = DBI->connect($dsn, $dbuser, $dbpass);
@agramajo
agramajo / size.pl
Created April 15, 2015 14:12
show mysql database size
use DBI;
my $dbname = $ARGV[0] || "mysql";
my $dbuser = $ARGV[1] || "root";
my $dbpass = $ARGV[2] || "pass";
my $dbhost = $ARGV[3] || "localhost";
my $socket = "";
$dsn = "DBI:mysql:database=$dbname;host=$dbhost;mysql_socket=$socket";
$dbh = DBI->connect($dsn, $dbuser, $dbpass);
@agramajo
agramajo / optimize.pl
Created April 15, 2015 14:14
optimize mysql tables
use strict;
use vars qw/ $f /;
use DBI;
my $fix = $f || 0;
my $dbname = $ARGV[0] || "mysql";
my $dbuser = $ARGV[1] || "root";
my $dbpass = $ARGV[2] || "pass";
my $dbhost = $ARGV[3] || "localhost";
@agramajo
agramajo / xymon_rblcheck.pl
Created April 15, 2015 14:21
xymon check rbl
$|=1;
use warnings;
use strict;
use Getopt::Long;
use Net::IP;
use Net::DNS;
my $debug = 1;
my @rbl=(
@agramajo
agramajo / xymon_sslcheck.pl
Created April 15, 2015 14:22
xymon ssl check
|=1;
use strict;
use Time::Piece;
use Time::Seconds;
# BB and related test constants
use constant GREEN => 'green';
use constant YELLOW => 'yellow';
use constant RED => 'red';
@agramajo
agramajo / xymon_dbsync.pl
Created April 15, 2015 14:25
xymon mysql slaves sync
use strict;
use DBI;
use constant {
SYNC_NOTHING => 0x00,
SYNC_SEEMSFINE => 0x01,
SYNC_ISFUCKED => 0x02
};
sub slavehost {
@agramajo
agramajo / generate_rev.pl
Created April 21, 2015 20:19
generate reverse zones
@nets = qw(
x.x.x
x.x.y
);
$zone = <<EOF;
\$TTL 1800
@ IN SOA ns1.xxx.com.ar. root.xxx.com.ar. 2014111104 10800 3600 604800 1800
@ IN NS ns1.xxx.com.ar.
@ IN NS webmail.xxx.com.ar.
@agramajo
agramajo / stats.pl
Created April 29, 2015 19:16
display stats by ip accounting with iptables
#!/usr/bin/perl
use strict;
# Quick display stats by ip accounting with iptables chains
# Only for linux kernel and netfilter
#
# CONFIG
# Read the source!
#