This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* run this program using the console pauser or add your own getch, system("pause") or input loop */ | |
#include <iostream> | |
#include <windows.h> | |
#include <stdio.h> | |
#include <conio.h> | |
#include <fstream> | |
#include <io.h> | |
//控制字定义 | |
#define BLOCK0_EN 0x01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOST=`hostname` | |
INTERFACE=eth0 | |
DUMPDIR=./dump/ | |
SUBJECT="WARNING: Packet alert on $HOST" | |
EMAIL="[email protected]" | |
EMAILMESSAGE="./dump/emailmessage.txt" | |
LOG="./dump/log.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Put it in /etc/rc.local, let it run every time machine boot. | |
filename=`date +%Y%m%d-%H%M%S` | |
cd /etc/records | |
hostname >> $filename | |
ifconfig eth0|grep inet|grep -v inet6|awk '{print $2}' >> $filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Find out all .jpg files except in *CorelDRAW* subdirectories and identify them. | |
# Filter out CMYK colorspace files. | |
find ./ -path "*CorelDRAW*" -prune -o -name *.jpg -print0 | \ | |
xargs -0 identify -verbose | \ | |
grep -E '(^Image|^ Colorspace: CMYK)' | \ | |
grep -B1 CMYK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Sum student's upload files MD5. | |
# Check whether they copy file each other. | |
# Tested in CentOS Linux. | |
dir=`date +%Y.%m.%d` | |
output="result.html" | |
echo -e "<pre>\n$dir" >> $output | |
md5sum $dir/* | sort | uniq -Dw32 | sed -e "s/$dir\///" >> $output | |
echo "</pre>" >> $output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
sysname H3C | |
# | |
firewall packet-filter enable | |
firewall packet-filter default permit | |
# | |
undo connection-limit enable | |
connection-limit default deny | |
connection-limit default amount upper-limit 50 lower-limit 20 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Building configuration... | |
Current configuration : 1183 bytes | |
! | |
version RGOS 10.3(4b1), Release(53844)(Mon Apr 13 14:50:04 CST 2009 -ngcf31) | |
! | |
! | |
! | |
! | |
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo Today is: `date +%d/%b/%Y` | |
for file in `ls *access_log` | |
do | |
grep `date +%d/%b/%Y` $file | \ | |
awk ' | |
{ | |
gsub(/:/, " ") | |
# print $14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
sysname H3C | |
# | |
firewall packet-filter enable | |
firewall packet-filter default permit | |
# | |
undo connection-limit enable | |
connection-limit default deny | |
connection-limit default amount upper-limit 50 lower-limit 20 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Limit Apache user connect to updates.drupal.org,itself and LAN IPs only. | |
/sbin/iptables -A OUTPUT -p tcp -d 140.211.166.6 --dport 80 -m owner --uid-owner apache -j ACCEPT | |
/sbin/iptables -A OUTPUT -p tcp -d 140.211.166.21 --dport 80 -m owner --uid-owner apache -j ACCEPT | |
/sbin/iptables -A OUTPUT -p all -d 202.68.199.208 -m owner --uid-owner apache -j ACCEPT | |
/sbin/iptables -A OUTPUT -p all -d 192.168.168.0/24 -m owner --uid-owner apache -j ACCEPT | |
/sbin/iptables -A OUTPUT -p all -d 10.0.0.0/8 -m owner --uid-owner apache -j ACCEPT | |
/sbin/iptables -A OUTPUT -p all -d 127.0.0.1 -m owner --uid-owner apache -j ACCEPT | |
/sbin/iptables -A OUTPUT -p tcp --sport 8250 -m owner --uid-owner apache -j ACCEPT |