Class: PacketGen::Packet

Inherits:
Object
  • Object
show all
Defined in:
lib/capra/packetgen_extensions.rb

Instance Method Summary collapse

Instance Method Details

#arp?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/capra/packetgen_extensions.rb', line 40

def arp?
  return true if self.is? 'ARP'
end

#dns?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/capra/packetgen_extensions.rb', line 32

def dns?
  return true if self.is? 'DNS'
end

#ftp?Boolean

Returns:

  • (Boolean)


3
4
5
6
# File 'lib/capra/packetgen_extensions.rb', line 3

def ftp?
  return false unless self.is? 'TCP'
  self.tcp.dport == 21 || self.tcp.sport == 21
end

#http?Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/capra/packetgen_extensions.rb', line 17

def http?
  return false unless self.is? 'TCP'
  self.is? 'HTTP::Request' or self.is? 'HTTP::Response'
end

#https?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/capra/packetgen_extensions.rb', line 22

def https?
  return false unless self.is? 'TCP'
  self.tcp.dport == 443 || self.tcp.sport == 443 
end

#icmp?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/capra/packetgen_extensions.rb', line 13

def icmp?
  self.is? 'ICMP'
end

#ip?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/capra/packetgen_extensions.rb', line 36

def ip?
  return true if self.is? 'IP'
end

#ssh?Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/capra/packetgen_extensions.rb', line 8

def ssh?
  return false unless self.is? 'TCP'
  self.tcp.dport == 22 || self.tcp.sport == 22
end

#telnet?Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/capra/packetgen_extensions.rb', line 27

def telnet?
  return false unless self.is? 'TCP'
  self.tcp.dport == 23 || self.tcp.sport == 23
end