1. 程式人生 > >【取證分析】Linux信息搜集

【取證分析】Linux信息搜集

相關信息 查看系統 hist PC 系統用戶 啟動項順序 print 內核版本號 uname

## 1、取證工具

- LiME 內存獲取工具
- volatility 內存分析工具

## 2、機器信息收集

#sysinfo  16

# # 查看當前登錄用戶
who > who.txt
# # 顯示目前登入系統的用戶信息
w > w.txt
# # 顯示時間
date > date.txt
# # 查看CPU信息
cat /proc/cpuinfo > cpuinfo.txt
# # 查詢系統版本
lsb_release -a > lsb_release.txt
# # 當前系統相關信息(內核版本號、硬件架構、主機名稱和操作系統類型等)
uname -a > uname.txt
# # Linux查看當前操作系統版本信息
cat /proc/version >  version.txt
# # 以批處理模式顯示進程信息,更新1次後不再更新
top -b -n 1 > top.txt
# # 查看系統負載
uptime > uptime.txt
# # MB顯示當前內存的使用
free -m > free_m.txt
# # 文件系統的磁盤空間占用情況
df -lhT > df_lhT.txt
# #  顯示分區類型
fdisk -l > fdisk_l.txt
# # 掛載設備情況
mount > mount.txt
# # 顯示系統中已存在的環境變量
env > env.txt
# # 查看自定義環境變量
cat ~/.bashrc > bashrc.txt
# # 讀取內核信息
cat /proc/meminfo > meminfo.txt

#account check  7

# # 系統用戶信息
cat /etc/passwd > etc_passwd.txt
# # 密文信息
cat /etc/shadow > etc_shadow.txt
# # 查看用戶文件狀態
stat /etc/passwd > etc_passwd_stat.txt
stat /etc/shadow > etc_shadow_stat.txt
# # 查看特權用戶
awk -F: ‘$3==0 {print $1}‘ /etc/passwd > etc_passwd_special_usr.txt
grep “0” /etc/passwd > etc_passwd_new_user.txt
awk -F: ‘length($2)==0 {print $1}‘ /etc/shadow > etc_shadow_no_password_user.txt

#process check  4
# # 全格式顯示所有進程
ps -elf > ps_elf.txt
# # 顯示所有進程,包括其他用戶 
ps aux > ps_aux.txt
ps -ef | grep inted  >  ps_inted.txt
ls /proc |sort -n|uniq > proc.txt

#file check 11
# # 根據uid、執行權限來查找
find / -uid 0 -perm -4000 > uid0_perm4000.txt
# # 根據文件大小
find / -size +10000k > size10000.txt
find / -name "..." > 3point_name_file.txt
find / -name ".. " > 2point_name_file.txt
find / -name ". " > 1point_name_file.txt
find / -name " " > blankspace_name_file.txt
# # 查看隱藏文件
find / -name ".*" > hide_file.txt
find / -name "*" > all_file.txt
find / -name ".rhosts" > rhosts.txt
find / -name ".forward" > forward.txt
# # 列出當前系統打開文件
lsof > lsof.txt

#integrity check 5
# # 查詢指定文件來自於哪個安裝包
rpm -qf /bin/ls > rpm_ls.txt
rpm -Vf /bin/ls >> rpm_ls.txt
rpm -qf /bin/netstat > rpm_netstat.txt
rpm -Vf /bin/netstat >> rpm_netstat.txt
rpm -qf /bin/login > rpm_login.txt
rpm -Vf /bin/login >> rpm_login.txt
rpm -qf /bin/find > rpm_find.txt
rpm -Vf /bin/find >> rpm_find.txt
rpm -qf /usr/bin/top > rpm_top.txt
rpm -Vf /usr/bin/top >> rpm_top.txt


#network check 6
# # 查看路由表條目
ip link | grep PROMISC > ip_promisc.txt
# # 顯示所有聯網文件
lsof -i > lsof_i.txt
# # 顯示TCP、UDP傳輸協議、Socket程序名稱
netstat -ntulpa >  netstat_ntulpa.txt
# # 顯示正在使用Socket的程序
netstat -anpo > netstat_anpo.txt
# # 顯示arp緩沖區的所有條目
arp -a > arp_a.txt
# # 顯示全部接口信息
ifconfig -a > ifconfig_a.txt

#schedule check 5
# # 顯示root的crontab文件內容
crontab -l -u root > root_crontab.txt
crontab -l -u coremail > coremail_crontab.txt
# # 計劃任務
cat /etc/crontab > etc_crontab.txt
# # 列出計劃任務的腳本
ls /etc/cron.* -a > etc_cron.txt
# # 查看定時任務
ls /var/spool/cron/ -a > var_spool_cron.txt

#rc check 4
# # 啟動項順序
cat /etc/rc.d/rc.local > rc_local.txt
# # 該目錄下存在各個運行級別的腳本文件
ls /etc/rc.d -a > rc_d.txt
ls /etc/rc*.d -a > rcV_d.txt
# # 搜索執行權限4000的普通類型文件
find / -type f -perm 4000 > type_f_perm_4000.txt

#log check 11
# # 日誌進程
ps -ef | grep syslog > syslog.txt
# # 列出日誌目錄
ls -al /var/log > var_log.txt
# # 列出日誌目錄狀態
stat /var/log/wtmp > stat_wtmp.txt
stat /var/run/utmp > stat_utmp.txt
cat /var/run/utmp > utmp.txt
cat /etc/rsyslog.conf > rsyslog_conf.txt
cat /etc/init.d/rsyslog > rsyslog.txt
# # 列出登入系統失敗的用戶相關信息
lastb > lastb.txt
# # :列出目前與過去登入系統的用戶相關信息
last > last.txt
# # Shell歷史命令記錄文件
cat ~/.bash_history > history.txt
ls -l ~/.bash_history > bash_history.txt

#inetd sheck 1
# # 擴展互聯網服務守護進程配置
cat /etc/xinetd.conf > xinetd_config.txt

#kernel check 2
# # 加載的模塊信息
lsmod > lsmod.txt
find / -name core -exec ls -l {} \; > core_file.txt

#service check 2
# # 查看開機啟動服務
chkconfig --list > chkconfig_lists.txt
# # 查看本地rpc進程
rpcinfo -p > rpcinfo.txt

#files get 5
# # 打包守護進程文件
tar -zcvf xinetd.tar.gz /etc/xinetd.d/*
# # 打包日誌文件
tar -zcvf log.tar.gz /var/log/*
# # 打包自啟動腳本
tar -zcvf rcd.tar.gz /etc/rc.d/* 
# # 打包計劃任務
tar -zcvf cron.tar.gz /etc/cron.*
tar -zcvf at.tar.gz /var/spool/at/* 

【取證分析】Linux信息搜集