/usr/share/ettercap/lua/third-party/bin.lua is in ettercap-common 1:0.8.2-10build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | --- Binary data utilities
--- Turn a little-endian word into a number
local function le_to_number (s)
local res = 0
for i = #s, 1, -1 do
res = res * 256 + string.byte (s, i)
end
return res
end
--- Turn a little-endian word into a hex string
local function le_to_hex (s)
local res = ""
for i = 1, #s do
res = res .. string.format ("%.2x", string.byte (s, i))
end
return res
end
local M = {
le_to_number = le_to_number,
le_to_hex = le_to_hex,
}
return M
|