enlaces:utilidades_de_red
Diferencias
Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previaÚltima revisiónAmbos lados, revisión siguiente | ||
enlaces:utilidades_de_red [2011/10/26 13:36] – [Network Grep - ngrep] cayu | enlaces:utilidades_de_red [2018/11/22 16:36] – [Network Grep - ngrep] cayu | ||
---|---|---|---|
Línea 2: | Línea 2: | ||
===== Conectividad ===== | ===== Conectividad ===== | ||
+ | |||
+ | ==== Agregar ruta estatica ==== | ||
+ | |||
+ | < | ||
+ | ip route add 192.168.55.0/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | route add -net 192.168.55.0 netmask 255.255.255.0 gw 192.168.1.254 dev eth1 | ||
+ | </ | ||
==== Forzar el modo ethernet ==== | ==== Forzar el modo ethernet ==== | ||
Línea 10: | Línea 20: | ||
ethtool -s eth0 speed 100 duplex full autoneg off | ethtool -s eth0 speed 100 duplex full autoneg off | ||
</ | </ | ||
- | |||
==== Conectarse a redes Wi Fi ==== | ==== Conectarse a redes Wi Fi ==== | ||
Primero bajamos el servicio de Network Manager si es que lo tenemos instalado | Primero bajamos el servicio de Network Manager si es que lo tenemos instalado | ||
Línea 339: | Línea 348: | ||
http:// | http:// | ||
- | |||
- | ==== Network Grep - ngrep ==== | ||
- | |||
- | Muestra y busca paquetes. Ngrep se esfuerza por proveer de la mayoría de características comunes del " | ||
- | |||
- | |||
- | Usage examples: | ||
- | |||
- | **ngrep** '' | ||
- | |||
- | **ngrep** '' | ||
- | |||
- | **ngrep** '' | ||
- | |||
- | **ngrep** '' | ||
- | |||
- | **ngrep** ' | ||
- | |||
- | **ngrep** -iq 'rcpt to|mail from' tcp port 25 (monitor current delivery and print sender and recipients) | ||
- | |||
- | **ngrep** ' | ||
- | |||
- | **ngrep** -q ' | ||
- | Microsoft operating system?) | ||
- | |||
- | **ngrep** -iq ' | ||
- | |||
- | **ngrep** ' | ||
- | |||
- | **ngrep** ' | ||
- | |||
- | **ngrep** -v '' | ||
- | |||
- | **ngrep** -d le0 '' | ||
- | |||
- | |||
- | |||
- | Useful flags: | ||
- | |||
- | -A n (prints out " | ||
- | |||
- | -l (pipe the output of ngrep to another program for more processing) | ||
- | |||
- | -v (print all lines not matching the expression) | ||
- | |||
- | -d (specify the device you want to monitor) | ||
- | |||
- | |||
- | |||
- | http:// | ||
- | |||
- | |||
- | Un posteo interesante en un blog : http:// | ||
- | |||
Línea 458: | Línea 413: | ||
- | ==== Netcat ==== | ||
- | | ||
- | It is designed to be a reliable " | ||
- | |||
- | It provides access to the following main features: | ||
- | |||
- | * Outbound and inbound connections, | ||
- | * Featured tunneling mode which allows also special tunneling such as UDP to TCP, with the possibility of specifying all network parameters (source port/ | ||
- | * Built-in port-scanning capabilities, | ||
- | * Advanced usage options, such as buffered send-mode (one line every N seconds), and hexdump (to stderr or to a specified file) of trasmitted and received data. | ||
- | * Optional RFC854 telnet codes parser and responder. | ||
- | |||
- | |||
- | The GNU Netcat is distributed freely under the GNU General Public License (GPL). | ||
- | |||
- | <code bash> | ||
- | echo -e "GET / HTTP/ | ||
- | </ | ||
- | |||
- | Para pasar un archivo de un equipo a otros podemos ejecutar | ||
- | |||
- | Desde el servidor | ||
- | < | ||
- | cat backup.iso | nc -l 3333 | ||
- | </ | ||
- | Desde el cliente | ||
- | < | ||
- | nc 192.168.0.1 3333 > backup.iso | ||
- | </ | ||
- | Si queremos poner un contador | ||
- | < | ||
- | nc 192.168.0.1 3333 | pv -b > backup.iso | ||
- | </ | ||
- | |||
- | Otro ejemplo | ||
- | |||
- | Desde el servidor | ||
- | < | ||
- | dd if=/ | ||
- | </ | ||
- | Desde el cliente | ||
- | < | ||
- | nc 192.168.0.1 3333 | pv -b > myhdb5partition.img.gz | ||
- | </ | ||
- | |||
- | Referencias : | ||
- | |||
- | http:// | ||
- | |||
- | |||
- | Tutorial con ejemplos prácticos : http:// | ||
- | |||
- | Mas ejemplos : http:// | ||
- | |||
- | ==== MSN Dump ==== | ||
- | |||
- | Sniffea eh interpreta lo que va por el puerto 1863 :p | ||
- | |||
- | <code perl> | ||
- | # | ||
- | # quick dirty msn sniffer | ||
- | # http:// | ||
- | # $Id: msndump.pl, | ||
- | |||
- | #To capture live traffic from device eth0 run: | ||
- | #msndump.pl -i eth0 | ||
- | |||
- | #To capture from tcpdump traffic.pcap file run: | ||
- | #msndump.pl -r traffic.pcap | ||
- | |||
- | # you need Net::Pcap and Net::Packet | ||
- | # use cpan or get manually | ||
- | # http:// | ||
- | # http:// | ||
- | |||
- | my $lowuid=' | ||
- | my $lowgid=' | ||
- | |||
- | my $filter = 'tcp and port 1863'; | ||
- | |||
- | # no modify below | ||
- | use Getopt:: | ||
- | use Net::Pcap; | ||
- | use NetPacket:: | ||
- | use NetPacket:: | ||
- | use Fcntl; | ||
- | $|=1; | ||
- | my $flags |= O_NONBLOCK; | ||
- | |||
- | my %opts; | ||
- | getopt(" | ||
- | if ( (!($opts{i})) && (!($opts{r})) ) { | ||
- | print "[ msndump - miscname.com ]\n Usage: | ||
- | exit; | ||
- | } | ||
- | |||
- | if ((!$opts{r}) && ($> != ' | ||
- | die ("you need uid 0\n"); | ||
- | } | ||
- | |||
- | # main loop | ||
- | my $exitvar = ' | ||
- | while ($exitvar == ' | ||
- | |||
- | # create pcap | ||
- | my $pcap = & | ||
- | if (!($pcap)) { | ||
- | die ("cant capture\n" | ||
- | } | ||
- | |||
- | # drop privs | ||
- | my $GID=" | ||
- | my $UID=" | ||
- | my $EGID=" | ||
- | |||
- | # -w if set | ||
- | if ($opts{w}) { | ||
- | open (FILEOUT,"> | ||
- | fcntl(FILEOUT, | ||
- | } | ||
- | |||
- | # capture loop | ||
- | if (($opts{c}) && ($opts{c} =~ /(\d+)/)) { | ||
- | print " | ||
- | | ||
- | $exitvar = ' | ||
- | } else { | ||
- | | ||
- | my %stats; | ||
- | Net:: | ||
- | print "saw $stats{ps_recv} packets, dropped $stats{ps_drop}\n"; | ||
- | } | ||
- | |||
- | # free it | ||
- | print " | ||
- | Net:: | ||
- | # close fh | ||
- | if ($opts{w}) { | ||
- | print "wrote $opts{w}.\n"; | ||
- | close FILEOUT; | ||
- | } | ||
- | } | ||
- | |||
- | # sub procs below | ||
- | sub cap_pkt { | ||
- | |||
- | my ($pcap, | ||
- | my $snaplen = 14096; # seen some big im's :( | ||
- | my $promisc = 1; # promisc of course | ||
- | my $timeout = 0; # timeout | ||
- | |||
- | # file.pcap? | ||
- | if ($opts{r}) { | ||
- | print " | ||
- | $pcap = Net:: | ||
- | if (!($pcap)) { | ||
- | | ||
- | } | ||
- | } else { | ||
- | |||
- | # set dev from cmdline | ||
- | $dev = $opts{i}; | ||
- | print " | ||
- | |||
- | # get netmask for filter | ||
- | if ((Net:: | ||
- | die (" | ||
- | } | ||
- | | ||
- | # open it | ||
- | $pcap = Net:: | ||
- | if (!($pcap)) { | ||
- | die (" | ||
- | } | ||
- | } | ||
- | |||
- | # sanity check | ||
- | if (!($pcap)) { | ||
- | die (" | ||
- | } elsif (!($mask)) { | ||
- | $mask = ' | ||
- | } | ||
- | |||
- | # make filter struct | ||
- | if (Net:: | ||
- | die (" | ||
- | } | ||
- | # apply | ||
- | Net:: | ||
- | |||
- | return $pcap; | ||
- | } | ||
- | |||
- | sub proc_pkt { | ||
- | |||
- | my($user_data, | ||
- | my ($user, | ||
- | |||
- | my $ip_obj = NetPacket:: | ||
- | #my $ip_obj = NetPacket:: | ||
- | |||
- | # check if its a message (or a p2p file transfer) | ||
- | # if your reading this, include ' | ||
- | if (($ip_obj-> | ||
- | ; | ||
- | } else { | ||
- | print $ip_obj-> | ||
- | # extract goodies | ||
- | if ( (($ip_obj-> | ||
- | $user = " | ||
- | } | ||
- | |||
- | if ($ip_obj-> | ||
- | $msg = $1; | ||
- | } | ||
- | |||
- | # display if we have both | ||
- | if (($user) || ($msg)) | ||
- | { | ||
- | | ||
- | { | ||
- | $user = " | ||
- | } | ||
- | if (!($opts{w})) { | ||
- | print " | ||
- | print " | ||
- | print " | ||
- | } else { | ||
- | print FILEOUT " | ||
- | print FILEOUT " | ||
- | print FILEOUT " | ||
- | } | ||
- | } | ||
- | } | ||
- | } | ||
- | </ | ||
==== Python Proxy ==== | ==== Python Proxy ==== |
enlaces/utilidades_de_red.txt · Última modificación: 2019/01/22 15:34 por cayu