Saltar al contenido
Underc0de /foro

Network Snniffer

Iniciado por ANTRAX, Febrero 24, 2010, 04:07:43 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Avatar de ANTRAX
Febrero 24, 2010, 04:07:43 PM Ultima modificación: Julio 31, 2014, 09:46:15 PM por Expermicid
Código: ruby

#!/usr/bin/ruby

# this line imports the libpcap ruby bindings
require 'pcaplet'

# create a sniffer that grabs the first 1500 bytes of each packet
$network = Pcaplet.new('-s 1500')

# create a filter that uses our query string and the sniffer we just made
$filter = Pcap::Filter.new('udp and dst port 5060', $network.capture)

# add the new filter to the sniffer
$network.add_filter($filter)

# iterate over every packet that goes through the sniffer
for p in $network
# print packet data for each packet that matches the filter
puts p.udp_data if $filter =~ p
end
WhatsApp Telegram


¿Te quedó una duda sobre Ruby?

Preguntala y te responde la comunidad (y el asistente Underc0de IA si nadie llega antes). Es gratis y tarda un minuto.

Ya tengo cuenta
Guardamos tu pregunta en este navegador: después de entrar la publicás con un clic.
Grupo de WhatsApp