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 previaPróxima revisiónAmbos lados, revisión siguiente | ||
enlaces:utilidades_de_red [2011/06/10 13:09] – cayu | enlaces:utilidades_de_red [2018/11/01 16:35] – [Netcat] 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 343: | Línea 352: | ||
Muestra y busca paquetes. Ngrep se esfuerza por proveer de la mayoría de características comunes del " | 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) | ||
+ | </ | ||
Línea 415: | Línea 469: | ||
- | ==== Netcat ==== | ||
- | | + | ==== MSN Dump ==== |
- | It is designed to be a reliable " | + | |
- | It provides access to the following main features: | + | Sniffea eh interpreta lo que va por el puerto 1863 :p |
- | * Outbound and inbound connections, | + | <code perl> |
- | * Featured tunneling mode which allows also special tunneling such as UDP to TCP, with the possibility of specifying all network parameters (source port/interface, listening port/interface, and the remote host allowed to connect to the tunnel. | + | #!/usr/bin/perl -w |
- | * Built-in port-scanning capabilities, | + | # quick dirty msn sniffer |
- | * 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. | + | # http:// |
- | * Optional RFC854 telnet codes parser and responder. | + | # $Id: msndump.pl,v 1.3 2004/11/17 10:00:33 meh Exp $ |
+ | #To capture live traffic from device eth0 run: | ||
+ | #msndump.pl -i eth0 | ||
- | The GNU Netcat is distributed freely under the GNU General Public License (GPL). | + | #To capture from tcpdump traffic.pcap file run: |
+ | #msndump.pl -r traffic.pcap | ||
- | <code bash> | + | # you need Net::Pcap and Net::Packet |
- | echo -e " | + | # use cpan or get manually |
- | </code> | + | # http://search.cpan.org/ |
+ | # http:// | ||
- | Referencias : | + | my $lowuid=' |
+ | my $lowgid=' | ||
- | http:// | + | 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; | ||
- | Tutorial con ejemplos prácticos | + | my %opts; |
+ | getopt(" | ||
+ | if ( (!($opts{i})) && (!($opts{r})) ) { | ||
+ | print "[ msndump - miscname.com ]\n Usage:\n\t-i rl0 || -r file.pcap\n\t-c X - capture X packets\n\t-w freshIMz.txt\n\n"; | ||
+ | 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 " | ||
+ | Net:: | ||
+ | $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 " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </code> | ||
==== Python Proxy ==== | ==== Python Proxy ==== | ||
+ | |||
+ | Mini Proxy en Python | ||
http:// | http:// | ||
Línea 452: | Línea 665: | ||
GET http:// | GET http:// | ||
GET http:// | GET http:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ==== Parser y formateador de salida NMap ==== | ||
+ | |||
+ | Algo muy útil a la hora de hacer reporte de servidores en base a un archivo de lista de servidores, ej nmap-report.pl servidores.txt, | ||
+ | |||
+ | <code perl> | ||
+ | # | ||
+ | BEGIN { | ||
+ | eval "use Nmap:: | ||
+ | if ( $@ ) { | ||
+ | warn "Error to load module: Nmap:: | ||
+ | . " | ||
+ | . " | ||
+ | exit (); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | use POSIX qw(strftime); | ||
+ | my $scanner = new Nmap:: | ||
+ | $scanner-> | ||
+ | $scanner-> | ||
+ | $scanner-> | ||
+ | $scanner-> | ||
+ | my $lista = $ARGV[0]; | ||
+ | my $opciones_scan = "-sS -A -vv -p0-65535 -sV -O -iL $lista"; | ||
+ | print " | ||
+ | print " | ||
+ | $scanner-> | ||
+ | |||
+ | sub scan_started { | ||
+ | my $self = shift; | ||
+ | my $host = shift; | ||
+ | $hostname = $host-> | ||
+ | $addresses = join(',', | ||
+ | my $status = $host-> | ||
+ | # print " | ||
+ | } | ||
+ | |||
+ | sub port_found { | ||
+ | my $self = shift; | ||
+ | my $host = shift; | ||
+ | my $port = shift; | ||
+ | no warnings; | ||
+ | my $name = $host-> | ||
+ | my $puerto = $port-> | ||
+ | if ($puerto eq " | ||
+ | elsif($puerto eq " | ||
+ | my $proto= $port-> | ||
+ | if ($proto eq " | ||
+ | elsif($proto eq " | ||
+ | my $salida_puerto = join(''," | ||
+ | print " | ||
+ | } | ||
+ | |||
+ | sub scan_complete { | ||
+ | my $self = shift; | ||
+ | my $host = shift; | ||
+ | no warnings; | ||
+ | |||
+ | for my $match ($host-> | ||
+ | print " | ||
+ | } | ||
+ | |||
+ | for my $c ($host-> | ||
+ | # print "-- " . $c-> | ||
+ | print "- OS generation: " . $c-> | ||
+ | print "- OS family: | ||
+ | print "- OS Type: " | ||
+ | } | ||
+ | } | ||
</ | </ |
enlaces/utilidades_de_red.txt · Última modificación: 2019/01/22 15:34 por cayu