Path: blob/master/lib/postgres/byteorder.rb
19850 views
# -*- coding: binary -*-1require 'postgres_msf'23# Namespace for Metasploit branch.4module Msf5module Db67module ByteOrder8Native = :Native9BigEndian = Big = Network = :BigEndian10LittleEndian = Little = :LittleEndian1112# examines the byte order of the underlying machine13def byte_order14if [0x12345678].pack("L") == "\x12\x34\x56\x78"15BigEndian16else17LittleEndian18end19end2021alias byteorder byte_order2223def little_endian?24byte_order == LittleEndian25end2627def big_endian?28byte_order == BigEndian29end3031alias little? little_endian?32alias big? big_endian?33alias network? big_endian?3435module_function :byte_order, :byteorder36module_function :little_endian?, :little?37module_function :big_endian?, :big?, :network?38end3940end41end424344