[Ruby]Metasploit Module, Packet Capture Probleem

Pagina: 1
Acties:

Acties:
  • 0 Henk 'm!

  • sh4d0wman
  • Registratie: April 2002
  • Laatst online: 20:00

sh4d0wman

Attack | Exploit | Pwn

Topicstarter
Ik ben bezig om een Metasploit Auxiliary Scanner module te maken welke een specifiek Ethernet Broadcast packet verzend en een eventueel antwoord opvangt. Verzenden gaat goed en packet is te zien met Wireshark.

Het probleem is dat ik het antwoord niet opgevangen krijg. Met Wireshark zie ik het wel op de interface binnenkomen. Een Broadcast packet met een specifiek protocl: 0x8033, max size = 416 bytes.

Relevante Code, aangepast van een bestaande module:

Run Functie (main), alleen relevante code:
Ruby:
1
2
3
4
5
6
#Setup a packet capture
open_pcap({'SNAPLEN' => 416, 'FILTER' => "ether broadcast and ether proto 0x8033"}) #Origineel
open_pcap({'SNAPLEN' => 512, 'FILTER' => "ether broadcast"}) #Test, geen effect

print_status("Listening for probe response...")
listen_for_broadcast_response()


Functie voor het opvangen van een response, aangeroepen vanuit main (run).
Ruby:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#Create a parser for broadcast replies
  def listen_for_broadcast_response(opts = {})
    timeout = opts['TIMEOUT'] || datastore['TIMEOUT'] #User defined timeout

    max_epoch = ::Time.now.to_i + timeout

    while(::Time.now.to_i < max_epoch) #Listen until timeout expires, works
      pkt_bytes = capture.next()
      Kernel.select(nil,nil,nil,0.1)
      next if not pkt_bytes
      p = PacketFu::Packet.parse(pkt_bytes)
      next unless p.is_eth? 
      print_status("Eth packet captured. Checking protocol.") #Never triggers
      next if p.eth_proto == 0x8033
      print_status("Protocol match. Decoding payload.") #Never triggers
      #Insert packet decoding code
    end
  end


Wat doe ik fout? p.is_eth lijkt nooit getriggered te worden.

Dit is de eerste keer dat ik met Ruby werk dus heb veel lopen Googlen. Het meeste snap ik maar wat doet dit? Kernel.select(nil,nil,nil,0.1)

Thx :)

This signature has been taken down by the Dutch police in the course of an international lawenforcement operation.


Acties:
  • 0 Henk 'm!

  • sh4d0wman
  • Registratie: April 2002
  • Laatst online: 20:00

sh4d0wman

Attack | Exploit | Pwn

Topicstarter
Het werkt met een echt device, alleen niet met een packet replay. :') Daar zal ik later nog eens induiken.

Nu eerst eens een custom packet parser implementeren om de informatie weer te geven. Nog iemand die de Kernel.Select regel uit kan leggen??

This signature has been taken down by the Dutch police in the course of an international lawenforcement operation.