summary是纯bash编写的脚本,能快速帮你洞悉你的LINUX软硬件配置,如果你正在学习Bash也可以学习一下他的脚本!
wget http://aspersa.googlecode.com/svn/trunk/summary
chmod a+x summary
./summary
# Aspersa System Summary Report ##############################
Date | 2011-01-08 12:32:21 UTC (local TZ: CST +0800)
Hostname | ltos.linuxtone.org
Uptime | 24 days, 21:40, 1 user, load average: 0.03, 0.09, 0.08
System | Dell Inc.; PowerEdge R410; vNot Specified ()
Service Tag | CBWHQ2X
Release | CentOS release 5.5 (Final)
Kernel | 2.6.18-194.8.1.el5
Architecture | CPU = 64-bit, OS = 64-bit
Threading | NPTL 2.5
Compiler | GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-48).
SELinux | Disabled
# Processor ##################################################
Processors | physical = 2, cores = 8, virtual = 8, hyperthreading = no
Speeds | 8x1995.049
Models | 8xIntel(R) Xeon(R) CPU E5504 @ 2.00GHz
Caches | 8x4096 KB
# Memory #####################################################
Total | 15.67G
Free | 4.05G
Used | physical = 11.62G, swap = 0.00k, virtual = 11.62G
Buffers | 374.24M
Caches | 8.73G
Used | 4.92G
Swappiness | vm.swappiness = 0
DirtyPolicy | vm.dirty_ratio = 40, vm.dirty_background_ratio = 10
Locator Size Speed Form Factor Type Type Detail
========= ======== ================= ============= ============= ==
...............................
DIMM_A1 4096 MB 1066 MHz DIMM DDR3 Synchronous
DIMM_A2 4096 MB 1066 MHz DIMM DDR3 Synchronous
DIMM_B1 4096 MB 1066 MHz DIMM DDR3 Synchronous
DIMM_B2 4096 MB 1066 MHz DIMM DDR3 Synchronous
DIMM_A3 {EMPTY} Unknown DIMM DDR3 Synchronous
DIMM_A4 {EMPTY} Unknown DIMM DDR3 Synchronous
DIMM_B3 {EMPTY} Unknown DIMM DDR3 Synchronous
DIMM_B4 {EMPTY} Unknown DIMM DDR3 Synchronous
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/sda1 99M 25% ext3 (rw) /boot
/dev/sda2 34G 17% ext3 (rw) /
/dev/sda5 96G 18% ext3 (rw,noatime) /data
tmpfs 7.9G 0% tmpfs (rw) /dev/shm
# Disk Schedulers And Queue Size #############################
sda | [cfq] 128
sdb | [cfq] 128
sr0 | [cfq] 128
# Disk Partioning ############################################
States of connections
ESTABLISHED 3711
FIN_WAIT1 2
FIN_WAIT2 2
LAST_ACK 1
LISTEN 9
TIME_WAIT 61
# Top Processes ##############################################
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
31542 root 21 0 12868 1100 720 R 2.0 0.0 0:00.01 top
1 root 15 0 10348 700 588 S 0.0 0.0 0:01.37 init
2 root RT -5 0 0 0 S 0.0 0.0 0:01.99 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:01.79 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root RT -5 0 0 0 S 0.0 0.0 0:08.67 migration/1
6 root 34 19 0 0 0 S 0.0 0.0 0:03.64 ksoftirqd/1
7 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
8 root RT -5 0 0 0 S 0.0 0.0 0:01.22 migration/2
# Simplified vmstat (wait please) ############################
procs ---swap-- -----io---- ---system---- --------cpu--------
r b si so bi bo in cs us sy id wa st
0 0 0 0 0 22 1 1 0 0 99 1 0
0 0 0 0 0 44 1031 277 0 0 99 1 0
0 0 0 0 0 0 1009 146 0 0 100 0 0
0 0 0 0 0 928 1058 355 0 0 97 2 0
0 0 0 0 0 0 1002 147 0 0 100 0 0
# The End ####################################################
wget http://aspersa.googlecode.com/svn/trunk/summary
chmod a+x summary
./summary
# Aspersa System Summary Report ##############################
Date | 2011-01-08 12:32:21 UTC (local TZ: CST +0800)
Hostname | ltos.linuxtone.org
Uptime | 24 days, 21:40, 1 user, load average: 0.03, 0.09, 0.08
System | Dell Inc.; PowerEdge R410; vNot Specified (
Service Tag | CBWHQ2X
Release | CentOS release 5.5 (Final)
Kernel | 2.6.18-194.8.1.el5
Architecture | CPU = 64-bit, OS = 64-bit
Threading | NPTL 2.5
Compiler | GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-48).
SELinux | Disabled
# Processor ##################################################
Processors | physical = 2, cores = 8, virtual = 8, hyperthreading = no
Speeds | 8x1995.049
Models | 8xIntel(R) Xeon(R) CPU E5504 @ 2.00GHz
Caches | 8x4096 KB
# Memory #####################################################
Total | 15.67G
Free | 4.05G
Used | physical = 11.62G, swap = 0.00k, virtual = 11.62G
Buffers | 374.24M
Caches | 8.73G
Used | 4.92G
Swappiness | vm.swappiness = 0
DirtyPolicy | vm.dirty_ratio = 40, vm.dirty_background_ratio = 10
Locator Size Speed Form Factor Type Type Detail
========= ======== ================= ============= ============= ==
...............................
DIMM_A1 4096 MB 1066 MHz DIMM DDR3 Synchronous
DIMM_A2 4096 MB 1066 MHz DIMM DDR3 Synchronous
DIMM_B1 4096 MB 1066 MHz DIMM DDR3 Synchronous
DIMM_B2 4096 MB 1066 MHz DIMM DDR3 Synchronous
DIMM_A3 {EMPTY} Unknown DIMM DDR3 Synchronous
DIMM_A4 {EMPTY} Unknown DIMM DDR3 Synchronous
DIMM_B3 {EMPTY} Unknown DIMM DDR3 Synchronous
DIMM_B4 {EMPTY} Unknown DIMM DDR3 Synchronous
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/sda1 99M 25% ext3 (rw) /boot
/dev/sda2 34G 17% ext3 (rw) /
/dev/sda5 96G 18% ext3 (rw,noatime) /data
tmpfs 7.9G 0% tmpfs (rw) /dev/shm
# Disk Schedulers And Queue Size #############################
sda | [cfq] 128
sdb | [cfq] 128
sr0 | [cfq] 128
# Disk Partioning ############################################
States of connections
ESTABLISHED 3711
FIN_WAIT1 2
FIN_WAIT2 2
LAST_ACK 1
LISTEN 9
TIME_WAIT 61
# Top Processes ##############################################
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
31542 root 21 0 12868 1100 720 R 2.0 0.0 0:00.01 top
1 root 15 0 10348 700 588 S 0.0 0.0 0:01.37 init
2 root RT -5 0 0 0 S 0.0 0.0 0:01.99 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:01.79 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root RT -5 0 0 0 S 0.0 0.0 0:08.67 migration/1
6 root 34 19 0 0 0 S 0.0 0.0 0:03.64 ksoftirqd/1
7 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
8 root RT -5 0 0 0 S 0.0 0.0 0:01.22 migration/2
# Simplified vmstat (wait please) ############################
procs ---swap-- -----io---- ---system---- --------cpu--------
r b si so bi bo in cs us sy id wa st
0 0 0 0 0 22 1 1 0 0 99 1 0
0 0 0 0 0 44 1031 277 0 0 99 1 0
0 0 0 0 0 0 1009 146 0 0 100 0 0
0 0 0 0 0 928 1058 355 0 0 97 2 0
0 0 0 0 0 0 1002 147 0 0 100 0 0
# The End ####################################################
此脚本可以查看ip归属地!
#!/bin/bash
path="/usr/local/bin/nali"
if [ ! -f $path ]
then
wget http://qqwry.googlecode.com/files/nali-0.1.tar.gz -P /opt/ && cd /opt/
tar zxvf nali-0.1.tar.gz
cd nali-0.1
./configure && make && make install
echo -e "\033[31m 安装IP归属地插件成功! \033[0m"
else
echo -e "\033[31m nali工具已安装..... \033[0m"
fi
#测试命令
echo -e "\033[31m ====测试命令是否成功!==== \033[0m"
tracert mail.t4game.com | nali
path="/usr/local/bin/nali"
if [ ! -f $path ]
then
wget http://qqwry.googlecode.com/files/nali-0.1.tar.gz -P /opt/ && cd /opt/
tar zxvf nali-0.1.tar.gz
cd nali-0.1
./configure && make && make install
echo -e "\033[31m 安装IP归属地插件成功! \033[0m"
else
echo -e "\033[31m nali工具已安装..... \033[0m"
fi
#测试命令
echo -e "\033[31m ====测试命令是否成功!==== \033[0m"
tracert mail.t4game.com | nali
#!/bin/bash
wget http://sourceforge.net/projects/denyhosts/files/denyhosts/2.6/DenyHosts-2.6.tar.gz
tar -zxvf DenyHosts-2.6.tar.gz
mv DenyHosts-2.6 denyhost
cd denyhost/
python setup.py install
cd /usr/share/denyhosts/
cp daemon-control-dist daemon-control
cp denyhosts.cfg-dist denyhosts.cfg
chown root daemon-control
chmod 700 daemon-control
ln -s /usr/share/denyhosts/daemon-control /etc/init.d/denyhosts
chkconfig --add denyhosts
chkconfig denyhosts on
mv denyhosts.cfg denyhosts.cfg.bak
cat > /usr/share/denyhosts/denyhosts.cfg << EOF
#ssh日志文件
SECURE_LOG = /var/log/messages
#将阻止IP写入到hosts.deny
HOSTS_DENY = /etc/hosts.deny
#过多久后清除已经禁止的,其中w代表周,d代表天,h代表小时,s代表秒,m代表分钟
PURGE_DENY = 5m
#阻止服务名
BLOCK_SERVICE = sshd
#允许无效用户(在/etc/passwd未列出)登录失败次数,允许无效用户登录失败的次数.
DENY_THRESHOLD_INVALID = 1
#允许普通用户登录失败的次数
DENY_THRESHOLD_VALID = 5
#允许root登录失败的次数
DENY_THRESHOLD_ROOT = 3
#设定 deny host 写入到该资料夹
DENY_THRESHOLD_RESTRICTED = 1
#将deny的host或ip纪录到Work_dir中
WORK_DIR = /usr/share/denyhosts/data
SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES
#是否做域名反解
HOSTNAME_LOOKUP=NO
#将DenyHOts启动的pid纪录到LOCK_FILE中,已确保服务正确启动,防止同时启动多个服务。
LOCK_FILE = /var/lock/subsys/denyhosts
#有效用户登录失败计数归零的时间
AGE_RESET_VALID=5d
#root用户登录失败计数归零的时间
AGE_RESET_ROOT=25d
#无效用户的失败登录计数重置为0的时间(/usr/share/denyhosts/data/restricted-usernames)
AGE_RESET_RESTRICTED=25d
#无效用户登录失败计数归零的时间
AGE_RESET_INVALID=10d
#日志文件
DAEMON_LOG = /var/log/denyhosts
DAEMON_LOG_TIME_FORMAT = %b %d %H:%M:%S
#该项与PURGE_DENY 设置成一样,也是清除hosts.deniedssh 用户的时间
DAEMON_SLEEP = 30s
DAEMON_PURGE = 5m
EOF
/etc/init.d/denyhosts start
wget http://sourceforge.net/projects/denyhosts/files/denyhosts/2.6/DenyHosts-2.6.tar.gz
tar -zxvf DenyHosts-2.6.tar.gz
mv DenyHosts-2.6 denyhost
cd denyhost/
python setup.py install
cd /usr/share/denyhosts/
cp daemon-control-dist daemon-control
cp denyhosts.cfg-dist denyhosts.cfg
chown root daemon-control
chmod 700 daemon-control
ln -s /usr/share/denyhosts/daemon-control /etc/init.d/denyhosts
chkconfig --add denyhosts
chkconfig denyhosts on
mv denyhosts.cfg denyhosts.cfg.bak
cat > /usr/share/denyhosts/denyhosts.cfg << EOF
#ssh日志文件
SECURE_LOG = /var/log/messages
#将阻止IP写入到hosts.deny
HOSTS_DENY = /etc/hosts.deny
#过多久后清除已经禁止的,其中w代表周,d代表天,h代表小时,s代表秒,m代表分钟
PURGE_DENY = 5m
#阻止服务名
BLOCK_SERVICE = sshd
#允许无效用户(在/etc/passwd未列出)登录失败次数,允许无效用户登录失败的次数.
DENY_THRESHOLD_INVALID = 1
#允许普通用户登录失败的次数
DENY_THRESHOLD_VALID = 5
#允许root登录失败的次数
DENY_THRESHOLD_ROOT = 3
#设定 deny host 写入到该资料夹
DENY_THRESHOLD_RESTRICTED = 1
#将deny的host或ip纪录到Work_dir中
WORK_DIR = /usr/share/denyhosts/data
SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES
#是否做域名反解
HOSTNAME_LOOKUP=NO
#将DenyHOts启动的pid纪录到LOCK_FILE中,已确保服务正确启动,防止同时启动多个服务。
LOCK_FILE = /var/lock/subsys/denyhosts
#有效用户登录失败计数归零的时间
AGE_RESET_VALID=5d
#root用户登录失败计数归零的时间
AGE_RESET_ROOT=25d
#无效用户的失败登录计数重置为0的时间(/usr/share/denyhosts/data/restricted-usernames)
AGE_RESET_RESTRICTED=25d
#无效用户登录失败计数归零的时间
AGE_RESET_INVALID=10d
#日志文件
DAEMON_LOG = /var/log/denyhosts
DAEMON_LOG_TIME_FORMAT = %b %d %H:%M:%S
#该项与PURGE_DENY 设置成一样,也是清除hosts.deniedssh 用户的时间
DAEMON_SLEEP = 30s
DAEMON_PURGE = 5m
EOF
/etc/init.d/denyhosts start





