Diagnosticar el sistema operativo
Sistemas *nix
Sun, 10 Feb 2019
Aviso: No todos los comandos funcionan en todas las distribuciones.
Sistema Operativo
Tipo de distribución y versión:
$ cat /etc/issue
$ cat /etc/*-release
$ cat /etc/lsb-release # Debian based
$ cat /etc/redhat-release # Redhat based
Versión del kernel y si es de 64 bits.
$ cat /proc/version
$ uname -a
$ uname -mrs
$ rpm -q kernel
$ dmesg | grep Linux
$ ls /boot | grep vmlinuz-
Para ver que hay en las variables de entorno:
$ cat /etc/profile
$ cat /etc/bashrc
$ cat ~/.bash_profile
$ cat ~/.bashrc
$ cat ~/.bash_logout
$ env
$ set
Alguna impresora:
$ lpstat -a
Servicios y Aplicaciones
Servicios que están corriendo. Servicios y sus privilegios de usuario:
$ ps aux
$ ps -ef
$ top
$ cat /etc/services
Que servicios están corriendo como root:
$ ps aux | grep root
$ ps -ef | grep root
Que aplicaciones están instaladas, que versiones tienen y cuales se están ejecutando.
$ ls -alh /usr/bin/
$ ls -alh /sbin/
$ dpkg -l
$ rpm -qa
$ ls -alh /var/cache/apt/archivesO
$ ls -alh /var/cache/yum/
Para revisar la configuración de los servicios:
$ cat /etc/syslog.conf
$ cat /etc/chttp.conf
$ cat /etc/lighttpd.conf
$ cat /etc/cups/cupsd.conf
$ cat /etc/inetd.conf
$ cat /etc/apache2/apache2.conf
$ cat /etc/my.conf
$ cat /etc/httpd/conf/httpd.conf
$ cat /opt/lampp/etc/httpd.conf
$ ls -aRl /etc/ | awk '$1 ~ /^.*r.*/
Hay algún job con ejecución programada:
$ crontab -l
$ ls -alh /var/spool/cron
$ ls -al /etc/ | grep cron
$ ls -al /etc/cron*
$ cat /etc/cron*
$ cat /etc/at.allow
$ cat /etc/at.deny
$ cat /etc/cron.allow
$ cat /etc/cron.deny
$ cat /etc/crontab
$ cat /etc/anacrontab
$ cat /var/spool/cron/crontabs/root
Algún usuario y/o contraseña en texto plano:
grep -i user [filename]
grep -i pass [filename]
grep -C 5 "password" [filename]
find . -name "*.php" -print0 | xargs -0 grep -i -n "var $password" # archivos php
Redes y comunicaciones
Redes e interfaces:
$ /sbin/ifconfig -a
$ cat /etc/network/interfaces
$ cat /etc/sysconfig/network
Conocer la configuración de red:
$ cat /etc/resolv.conf
$ cat /etc/sysconfig/network
$ cat /etc/networks
$ iptables -L
$ hostname
$ dnsdomainname
Que usuarios o host se comunican con el sistema:
$ lsof -i
$ lsof -i :80
$ grep 80 /etc/services
$ netstat -antup
$ netstat -antpx
$ netstat -tulpn
$ chkconfig --list
$ chkconfig --list | grep 3:on
$ last
$ w
IP y dirección Mac
$ netstat -rn
$ arp -e
$ route
$ /sbin/route -nee
$ ifconfig en1 | awk '/ether/{print $2}'
Listar tráfico actual de red:
# tcpdump tcp dst [ip] [port] and tcp dst [ip] [port]
$ tcpdump tcp dst 192.168.1.7 80 and tcp dst 10.5.5.252 21