inux常用测评命令
cat /etc/shadow --查看口令 、查看账号
ifconfig --查看IP
LANG="en_US.UTF-8" #临时设置utf8编码
ip addr #查看IP地址
ifconfig #查看IP地址
cat /etc/hosts.allow 允许地址
cat /etc/hosts.deny 拒绝地址
cat /etc/ssh/sshd_config root是否可以远程登录
dmidecode -s system-product-name #查看服务器是虚拟机还是物理机
cat /proc/version #查看版本信息
cat /etc/redhat-release #查看centos 版本
lsb_release -a #此命令也适用于所有的Linux发行版。
uname -a #查看小版本
cat /etc/shadow #查看密码文件的信息 第一个:和第二个:之间有空说明空口令(*无法登录!被锁定)
cat /etc/login.defs | grep -E "PASS_*"| grep -v "^#" #查看密码有效期 Ubuntu也可以查看#############
cat /etc/pam.d/system-auth | grep -v "^#" | grep -E "pam_cracklib|pam_pwquality" #查看密码复杂度
cat /etc/pam.d/system-auth | grep -v "^#" | grep -v "^$" | head -n 1 #登录失败本机切换
cat /etc/pam.d/sshd | grep -v "^#" | grep -v "^$" | head -n 1 #登录失败-远程直连
cat /etc/security/pwquality.conf | grep -v "^#" | grep "=" #查看密码复杂度
cat /etc/pam.d/common-password #Ubuntu查看密码复杂度策略 ################
cat /etc/pam.d/common-auth #Ubuntu查看登录失败策略##############
cat /etc/passwd | grep -v "nologin" #查看用户的关键信息
cat /etc/group #查看用户组信息
cat /etc/login.defs | grep -E "PASS_*"| grep -v "^#" #查看全局策略
cat /etc/profile | grep -v "^#" | grep -v "^$" #查看全局变量
cat /etc/profile | grep TMOUT #查看超时时间参数TMOUT
cat /etc/ssh/sshd_config #ClientAliveInterval 300 ClientAliveCountMax 3 意思是5分钟检查一次客户端响应,最多检查3次。如果3次都检查到客户端不响应,那么就认为ssh已经断开了
chkconfig –list | grep telnet #列出telnet服务
ps aux | grep telnet | grep -v "color=auto" | grep -v "grep" #查看telnet服务
cat /etc/pam.d/login #登录失败策略 Ubuntu也可以查看 ##########################
cat /etc/pam.d/su #是否限制只有wheel组用户可使用su命令切换到root账户,查看auth required pam_wheel.so use_uid此行是否生效(未被注释)
cat /etc/ssh/sshd_config | grep PermitRootLogin #查看 root 用户是否可以远程链接
cat /etc/sudoers | grep -v "^#" | grep -v "^$" #查看是否限制了sudo命令的使用,如user ALL=(root) /usr/bin/passwd(user用户可使用sudo以root权限执行passwd命令)
ls -al /var/log #查看日志文件夹
ls -al /etc/shadow /etc/passwd /etc/group /etc/xinetd.conf /etc/rc.d/init.d /var/log/messages /var/log/wtmp /var/run/utmp /var/log/message /var/log/secure /var/log/audit/audit.log #查看访问级别
last | tail -n 20 #显示尾记录
last | head -n 20 #显示首记录
service rsyslog status | grep "running" #系统日志状态
service syslog status | grep "Active" #系统日志状态centos5之前版本
service auditd status | grep "running" #审计状态
who /var/log/wtmp #查看服务器登录记录,核查审计范围是否覆盖每个用户
service firewalld status | grep "Active" #firewall状态
service nfs status | grep "Active" #nfs状态
service samba status | grep "Active" #samba状态
service iptables status | grep "Active" #查看iptable策略
ps aux | grep auditd | grep -v "color=auto" | grep -v "grep" #查看auditd状态
ps aux | grep rsyslog | grep -v "color=auto" | grep -v "grep" #查看rsyslog状态
cat /etc/audit/auditd.conf | grep -v "^#" | grep -v "^$" #配置文件
cat /etc/audit/rules.d/audit.rules #配置文件
cat /etc/logrotate.conf | grep rotate #日志保存几个月 默认 rote 4 默认保存4个月
cat /var/log/messages | tail -n 10 #messages #查看审计日志
cat /var/log/audit/audit.log | tail -n 10 #查看审计进程日志
cat /var/log/messages | head -n 10 #messages #查看审计日志
cat /var/log/audit/audit.log | head -n 10 #查看审计进程日志
cat /etc/rsyslog.conf #查看日志外发配置
auditctl -s #auditctl状态
auditctl -l #查看定义规则
getenforce #查看SELinux 模式是否开启
cat /etc/selinux/config | grep -v "^#" | grep -v "^$" #selinux配置
netstat -ntupl #查看端口
ss -ntupl #查看端口
netstat -nulp #查看端口
ps -aux #查看进程
ss -tuarp #查看所有tcp,udp,名称显示,显示pid
rpm -qa |grep patch #查看patch安装
rpm -qa | grep cracklib #查看是否安装了 pam_cracklib.so 模块
authconfig --test | grep hashing #查看加密算法
cat /etc/hosts.allow | grep -v "^#" | grep -v "^$" #查看防火墙允许策略
cat /etc/hosts.deny | grep -v "^#" | grep -v "^$" #查看防火墙禁止策略
iptables -L -nv #查看iptables规则-端口及地址限制
firewall-cmd --list-all #查看firewall规则
cat /etc/crontab #定时任务文件
crontab -l #定时任务(注意定时)
ping baidu.com -c4 #是否连接外网
ping 8.8.8.8 -c4 #是否连接外网
top -n 1 |head -n 3 |tail -n 1 | awk -F " " '{print $2 "%"}' #查看CPU占用率
free | head -n 2 | tail -n 1 | awk -F " " '{printf("%.1f%\n",$3/$2*100)}' #查看内存占用率
df -h | awk '$NF=="/"{print $5}'
top -n 1|awk -F'[,| ]+' /'%Cpu'/'{ printf("%s %.01f\n",strftime("[%Y-%m-%d %H:%M:%S]",systime()),100-$11); }' #查看CPU占用率
free | head -n 2 | tail -n 1 | awk -F " " '{printf("%.1f%\n",$3/$2*100)}' #查看内存占用率
2、Windows命令
netplwiz 查看用户
gpedit.msc 本地组策略编辑器 远程服务会话限制 不显示最后登陆的用户名
lusrmgr.msc 本地用户和组 密码永不过期
secpol.msc 本地安全策略
eventvwr.msc 事件查看器
dcomcnfg 组件服务界面
appwiz.cpl 程序和功能界面
services.msc 系统服务管理界面
netstat -an 查看监听端口
net share 查看默认共享
firewall.cpl Windows防火墙界面
net user administrator