Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import logging
from scapy.all import *
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
fakeip = ["4.36.66.178", "8.7.198.45", "37.61.54.158", "46.82.174.68", "59.24.3.173", "64.33.88.161", "64.33.99.47", "64.66.163.251", "65.104.202.252", "65.160.219.113", "66.45.252.237", "72.14.205.104", "72.14.205.99", "78.16.49.15", "93.46.8.89", "128.121.126.139", "159.106.121.75", "169.132.13.103", "192.67.198.6", "202.106.1.2", "202.181.7.85", "203.161.230.171", "207.12.88.98", "208.56.31.43", "209.145.54.50", "209.220.30.174", "209.36.73.33", "211.94.66.147", "213.169.251.35", "216.221.188.182", "216.234.179.13"]
testdomain = ["twitter.com", "facebook.com", "youtube.com"]
dnshost = "8.8.8.8"
for h in testdomain:
var crypto = require('crypto');
var SaltLength = 9;
function createHash(password) {
var salt = generateSalt(SaltLength);
var hash = md5(password + salt);
return salt + hash;
}
import types
def create_function(name, args):
def y():
pass
y_code = types.CodeType(args, \
y.func_code.co_nlocals, \
y.func_code.co_stacksize, \
y.func_code.co_flags, \
y.func_code.co_code, \
y.func_code.co_consts, \
@zhangw
zhangw / gcc_path_include_libs.sh
Last active December 19, 2015 15:59
show gcc default include && libs path
echo | gcc -v -x c++ -E -
@zhangw
zhangw / bankcard_check.js
Created November 8, 2013 06:18
银行卡号Luhm校验算法
//Description: 银行卡号Luhm校验算法
//Luhm校验规则:16位银行卡号(19位通用):
// 1.将未带校验位的 15(或18)位卡号从右依次编号 1 到 15(18),位于奇数位号上的数字乘以 2。
// 2.将奇位乘积的个十位全部相加,再加上所有偶数位上的数字。
// 3.将加法和加上校验位能被 10 整除。
  //bankno位银行卡号
function luhmCheck(bankno){
foreach($i in ls -recurse -Include *.asp,*.js,*.html,*.css) {
$temp = get-content $i.fullname
out-file -filepath $i.fullname -inputobject $temp -encoding utf8 -force
}
@zhangw
zhangw / interfaces
Created June 5, 2014 08:23
the network interfaces configuration in ubuntu
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
# The secondary network interface
auto eth1
/*
Copyright 2014 Levi Gross. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@zhangw
zhangw / ord_unichr_unicode_char
Created August 28, 2014 11:02
convert unicode one-character to integer,return unicode one-character with ordinal integer.
#unicode character
char = u'\u2708'
print char
#integer value of the character
ord_char = ord(char)
print ord_char,hex(ord_char)
#return the character
uni_char = unichr(ord_char)
assert(char==uni_char)
print uni_char
description "PostgreSQL 9.1 Server"
author "PostgreSQL"
start on runlevel [2345]
stop on runlevel [016]
expect fork
respawn
env POSTGRESQL_HOME="/var/lib/postgresql/9.1/main"