Method: Rex::Socket.addr_iton
- Defined in:
- lib/rex/socket.rb
.addr_iton(addr, v6 = false) ⇒ Object
Converts an integer into a network byte order address
412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'lib/rex/socket.rb', line 412 def self.addr_iton(addr, v6=false) if(addr < 0x100000000 && !v6) return [addr].pack('N') else w = [] w[0] = (addr >> 96) & 0xffffffff w[1] = (addr >> 64) & 0xffffffff w[2] = (addr >> 32) & 0xffffffff w[3] = addr & 0xffffffff return w.pack('N4') end end |