Skip to content

Instantly share code, notes, and snippets.

@diablowu
diablowu / SignTools.java
Last active January 2, 2016 14:39
hmacwithsha1
package util;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class SignTools {
@diablowu
diablowu / AntiXss
Created February 11, 2014 03:53
anti-xss,escape
public static String antixss(String input){
//如果使用JDK5以上这里替换成StringBuilder
StringBuffer sb = new StringBuffer();
char[] arr = input.toCharArray();
for(int i=0,l=arr.length;i<l;i++){
switch (arr[i]) {
case '&':
sb.append("&amp;");
break;
case '<':
@diablowu
diablowu / payload.js
Created February 12, 2014 01:31
payloadtest
alert(window);
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.com.es</groupId>
<artifactId>es-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
alert(/hello/);
@diablowu
diablowu / keepalived.conf
Last active August 29, 2015 14:12
LVS/DS+keepalived config file
global_defs {
notification_email {
}
notification_email_fromroot@localhost
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_sync_group VG1 {
@diablowu
diablowu / keepalive_comment.conf
Created December 26, 2014 08:06
keepalive_comment.conf 详细注释
global_defs {
notification_email {
root@localhost #设置报警邮件地址,可以设置多个,每行一个。
}
router_id LVS_DEVEL #表示运行keepalived服务器的一个标识。发邮件时显示在邮件主题的信息
}
vrrp_instance VI_1 {
state MASTER #指定keepalived的角色,MASTER表示此主机是主服务器,BACKUP表示此主机是备用服务器
interface eth0 #指定HA监测网络的接口
@diablowu
diablowu / weblogic_decrypt.py
Created December 30, 2014 08:32
decrypt weblogic 3des
from weblogic.security.internal import *
from weblogic.security.internal.encryption import *
raw_input("Please make sure you have SerializedSystemIni.dat inside the current directory, if yes press ENTER to continue.")
# Encryption service
encryptionService = SerializedSystemIni.getEncryptionService(".")
clearOrEncryptService = ClearOrEncryptedService(encryptionService)
# Take encrypt password from user
@diablowu
diablowu / ZKTest.java
Created January 20, 2015 14:33
zookeeper datamonitor
package test;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.ZooKeeper;
@diablowu
diablowu / addnat.sh
Created March 10, 2015 01:30
add a nat rule of iptables
#!/bin/bash
pro='tcp'
cntip=$1
cntport=$2
hostip=$3
hostport=$4
sudo iptables -t nat -A PREROUTING -m $pro -p $pro --dport $hostport -j DNAT --to-destination $cntip:$cntport
sudo iptables -t nat -A POSTROUTING -m $pro -p $pro --dport $cntport -d $cntip -j SNAT --to-source $hostip