June 2008 Archives

彻底删除daemontools启动的服务

| No Comments | No TrackBacks

一直感觉删除一个daemontools启动的服务好麻烦。昨天strace了一下svscan和svc等程序,然后搞了个脚本专门来删这种服务。

具体细节请看: http://www.jianingy.com/killdaemontools.html

罪恶的Admin(一): 调戏你的用户

| No Comments | No TrackBacks

作为罪恶的Admin,一定要有罪恶的脚本。当那个讨厌的用户又登录了你的server,不要pkill -9 -f "sshd: the_user". 如果你这么做了,那是粗鲁而不是罪恶。罪恶的admin要调戏(molest)他的用户。让我们发挥SIGSTOP和SIGCONT的威力吧。找到那家伙的sshd,kill -STOP,sleep 0.1,kill -CONT.让他的终端像9C的魔兽世界一样卡。从精神上打垮他。当然我们需要sleep的真实一些,让这看起来真的像网络故障。于是moluser脚本出现了:

#!/bin/bash
# molest user by SIGSTOP and SIGCONT his sshd

GUY="$1"
MAXSLEEP="$2"
MAXSLEEP=${MAXSLEEP:0:10}
ZERO="0000000000"
if [ -z "$GUY" ]
then
    echo "Usage: moluser <username> [max sleep time(millionseconds)]"
    echo
    echo "Molest a user py kill -STOP his sshd"
    echo '$Id$'
    exit 0
fi

[ -z "$MAXSLEEP" ] && SLEEP=1000

while true
do
    SLEEP=$(expr $RANDOM % $MAXSLEEP)
    SLEEP="${ZERO:0:$(expr ${#MAXSLEEP} - ${#SLEEP})}$SLEEP"
    SLEEP="${SLEEP:0:1}.${SLEEP:1}"
    _UID="$(id -u $GUY 2>/dev/null)"
    pkill -SIGSTOP -U $_UID sshd
    sleep $SLEEP
    pkill -SIGCONT -U $_UID sshd
done

October 2008

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Friends' Links

Recent Comments

  • jianingy: test read more
  • mmx: thank u very much ! read more
  • FW: pls contact me with email.about APIHook. read more
  • jianingy: 这个lc是啥意思? -------- read more
  • cnhackTNT: 晕,被过滤掉了,再试试: s/(?<!\\)\$NICK/lc/e; 汗,过滤了小于符号,只好写<了呵呵 read more
  • cnhackTNT: s/(? 这样可以少打几个字呵呵 read more
  • R.Q.: 酱紫哦,了了 -------- read more

Archives

Powered by Movable Type 4.21-en