Qué es Gulcas?
La lista de correo
Normas de uso
Fotos
Wiki
Hackit
Socat: flexibilidad y potencia
Enviado por arrase el Vie, 2007-01-05 13:55.
En mi primer contacto con 'socat' pense que era como un 'netcat' a lo bruto, con muchas mas opciones, pero al pegar una mirada a su man me he quedado sorprendido por la increible flexibilidad de la aplicacion.
¿Cuantas aplicaciones conoces capaces de hacer esto?:
socat TCP4-LISTEN:5555,fork,tcpwrap=script \
EXEC:/bin/myscript,chroot=/home/sandbox,su-d=sandbox,pty,stderr
A simple server that accepts connections (TCP4-LISTEN) and
fork's a new child process for each connection; every child
acts as single relay. The client must match the rules for
daemon process name "script" in /etc/hosts.allow and
/etc/hosts.deny, otherwise it is refused access (see "man 5
hosts_access"). For EXEC'uting the program, the child process
chroot's to /home/sandbox, su's to user sandbox, and then
starts the program /home/sandbox/bin/myscript. Socat and
myscript communicate via a pseudo tty (pty); myscript's stderr
is redirected to stdout, so its error messages are transferred
via socat to the connected client.
No esta nada mal pero.....¿cuantas conoces que tambien puedan hacer esto con la misma facilidad que lo anterior?:
echo |socat -u - file:/tmp/bigfile,create,largefile,seek=100000000000
creates a 100GB sparse file; this requires a file system type that
supports this (ext2, ext3, reiserfs, jfs; not minix, vfat). The
operation of writing 1 byte might take long (reiserfs: some minutes;
ext2: "no" time), and the resulting file can consume some disk space
with just its inodes (reiserfs: 2MB; ext2: 16KB)
Increible para ser siempre la misma aplicacion, y eso no es todo ¿editamos algo en hexadecimal?:
echo -e "\0\14\0\0\c" |socat -u - file:/usr/bin/squid.exe,seek=0x00074420
functions as primitive binary editor: it writes the 4 bytes 000 014
000 000 to the executable /usr/bin/squid at offset 0x00074420 (this
is a real world patch to make the squid executable from Cygwin.
Esto es lo que yo llamo ser flexible, funcional y potente.
- arrase's blog
- Inicie sesión o regístrese para enviar comentarios


Comentarios recientes
hace 4 años 40 semanas
hace 4 años 41 semanas
hace 5 años 45 semanas
hace 5 años 45 semanas
hace 5 años 45 semanas
hace 5 años 47 semanas
hace 5 años 48 semanas
hace 5 años 50 semanas
hace 5 años 51 semanas
hace 5 años 51 semanas