Repository: diacritic/wssdl Branch: master Commit: b34ee13491ac Files: 3 Total size: 5.2 KB Directory structure: gitextract_ds7lidd5/ ├── .gitignore ├── README.md └── pack.lua ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ * !*/ !*.lua !*.rst !*.md !.gitignore wssdl.lua test.lua ================================================ FILE: README.md ================================================ # 🝰 wssdl [![Build Status](https://api.travis-ci.org/diacritic/wssdl.svg?branch=master)](https://travis-ci.org/diacritic/wssdl/builds) [![License (GPL)](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://github.com/diacritic/wssdl/blob/master/LICENSE) [![Version (Experimental)](https://img.shields.io/github/release/diacritic/wssdl.svg?label=version)](https://github.com/diacritic/wssdl/releases/latest) [![Language (Lua)](https://img.shields.io/badge/powered_by-Lua-brightgreen.svg)](https://lua.org) [![Gitter chat](https://badges.gitter.im/diacritic/wssdl.png)](https://gitter.im/diacritic/wssdl) Wireshark-Specific Dissector Language ```lua wssdl.packet { message : u8(); definition : i32(); done : utf8z(); easy : ipv4(); } ``` ## What is this? wssdl is a domain specific language on top of lua built for the purpose of expressing easily message dissectors. ## Documentation | Stable | Latest | | --- | --- | [![Stable docs][doc-stable-badge]][doc-stable] | [![Latest docs][doc-latest-badge]][doc-latest] Also check out some of the [samples][samples]. ## Install ### From the release Grab the bootstrapped `wssdl.lua` from the [latest release][latest], and put it in your Wireshark Plugin directory (usually `~/.config/wireshark/plugins`, `~/.wireshark/plugins` or `/usr/lib/wireshark/`) ### From source The build toolchain needs lua 5.1 or newer, luarocks and the luafilesystem module. Clone this repository, and from the root directory call `make install` to install it to `~/.config/wireshark/plugins`, or `make WS_PLUGIN_DIR=/your/path install` to install it to the path of your choice. [latest]: https://github.com/diacritic/wssdl/releases/latest [samples]: https://github.com/diacritic/wssdl/tree/master/samples [doc-stable]: http://wssdl.readthedocs.io/en/stable/?badge=stable [doc-latest]: http://wssdl.readthedocs.io/en/latest/?badge=latest [doc-stable-badge]: https://readthedocs.org/projects/wssdl/badge/?version=stable [doc-latest-badge]: https://readthedocs.org/projects/wssdl/badge/?version=latest ================================================ FILE: pack.lua ================================================ -- -- Copyright 2016 diacritic -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- require 'luarocks.loader' local fs = require 'lfs' local args = {...} local root = args[1]:gsub('/$', ''):gsub('\\$', '') local files = {} function scandir(root, path) -- adapted from http://keplerproject.github.com/luafilesystem/examples.html path = path or '' for file in fs.dir(root..path) do if file ~= '.' and file ~= '..' then local f = path .. '/' .. file local attr = lfs.attributes(root..f) assert(type(attr) == 'table') if attr.mode == 'directory' then scandir(root, f) else if file:find('%.lua$') then hndl = (f:gsub('%.lua$', '') :gsub('/', '.') :gsub('\\', '.') :gsub('^%.', '') ):gsub('%.init$', '') files[hndl] = io.open(root..f):read('*a') :gsub(' *%-%-[^\n]*\n', '') end end end end return files end scandir(root) acc = { [[ -- -- Copyright 2016 diacritic -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- ]] } local wrapper = { '\n--------------------------------------\npackage.preload[\'', nil, '\'] = function (...)\n', nil, '\nend\n' } for k,v in pairs( files ) do wrapper[2], wrapper[4] = k, v table.insert(acc, table.concat(wrapper)) end table.insert(acc, [[ ----------------------------------------------- do if not package.__loadfile then local original_loadfile = loadfile local function lf(file) local hndl = file:gsub('%.lua$', '') :gsub('/', '.') :gsub('\\', '.') :gsub('%.init$', '') return package.preload[hndl] or original_loadfile(name) end function dofile(name) return lf(name)() end loadfile, package.__loadfile = lf, loadfile end end return require 'wssdl.core' ]]) print(table.concat(acc))