Library bin
来源:互联网 发布:剑网三dbm数据库 编辑:程序博客网 时间:2024/06/05 09:05
A problem script authors often face is the necessity of encoding valuesinto binary data. For example after analyzing a protocol the startingpoint to write a script could be a hex dump, which serves as a preambleto every sent packet. Although it is possible to work with thefunctionality Lua provides, it's not very convenient. Therefore NSE includesBinlib, based on lpack (http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/)by Luiz Henrique de Figueiredo.
The Binlib functions take a format string to encode and decode binarydata. Packing and unpacking are controlled by the following operatorcharacters:
H
hex stringB
bit stringx
null bytez
zero-terminated stringp
string preceded by 1-byte integer lengthP
string preceded by 2-byte integer lengtha
string preceded by 4-byte integer lengthA
stringf
floatd
doublen
Lua numberc
char (1-byte integer)C
byte = unsigned char (1-byte unsigned integer)s
short (2-byte integer)S
unsigned short (2-byte unsigned integer)i
int (4-byte integer)I
unsigned int (4-byte unsigned integer)l
long (8-byte integer)L
unsigned long (8-byte unsigned integer)<
little endian modifier>
big endian modifier=
native endian modifier
Note that the endian operators work as modifiers to all thecharacters following them in the format string.
Functions
pack (format, ...)Returns a binary packed string.
unpack (format, data, init)Returns values read from the binary packed data string.
Functions
- pack (format, ...)
Returns a binary packed string.
The format string describes how the parameters (
p1
,...
) will be interpreted. Numerical values following operatorsstand for operator repetitions and need an according amount of parameters.Operators expect appropriate parameter types.Note: on Windows packing of 64-bit values > 2^63 currentlyresults in packing exactly 2^63.
Parameters
- format: Format string, used to pack following arguments.
- ...: The values to pack.
Return value:
String containing packed data.- unpack (format, data, init)
Returns values read from the binary packed data string.
The first return value of this function is the position at which unpackingstopped. This can be used as the
init
value for subsequentcalls. The following return values are the values according to the formatstring. Numerical values in the format string are interpreted as repetitionslike inpack
, except if used withA
,B
, orH
, in which cases the number tellsunpack
how many bytes to read.unpack
stops ifeither the format string or the binary data string are exhausted.Parameters
- format: Format string, used to unpack values out of data string.
- data: String containing packed data.
- init: Optional starting position within the string.
Return values:
- Position in the data string where unpacking stopped.
- All unpacked values.
- Library bin
- Library bin
- /bin/thttpd: can't load library 'libcrypt.so.0问题解决
- Fail to load the JNI share library"..\jdk1.7.0\\bin\..\jre\bin\client\jvm.dll"解决方法
- eclipse Fail to load the JNI share library"C:\Java\jdk1.7.0\bin\..\jre\bin\client\jvm.dll
- failed to load the jni shared library "C:\Program Files\java\jdk1.7.0_15\bin..\jre\bin\server\jvm.d"
- Failed to load the JNI shared library "D:\Program Files\Java\jdk1.5.0_08\bin\..\jre\bin\client\jvm.d
- bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad i
- bin()
- /bin
- Eclipse Failed to load the JNI shared library "C:/JDK/bin/client/jvm.dll"
- ‘Failed to load the JNI shared library “C:\Program Files\Java\jdk1.8.0_31\bin\..解决方法
- 错误:'/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/bin/java'' finished with non-zer
- Failed to load the jni shared library "c:\java\bin..\jre
- Failed to load the JNI shared library "C:\Program Files(X86)\Java\jdk1.8.0_45\bin\.....
- failed to load the jni shared library:“……jre\bin\client\jvm.dll”
- $ /usr/bin/security unlock-keychain -p ******** /Users/admin/Library/Keychains/login.keychain securi
- Cannot run program "/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java"
- 菜鸟学习Cocos2d-x 3.x——浅谈动作Action
- win10 远程桌面时,用户名密码无误,仍然提示凭证不工作问题 的解决办法
- xml文件实现一次性导入功能(泉州)
- 读取property文件内容
- Javaweb学习总结(五):JavaBean的作用域
- Library bin
- instr函数
- Uri.parse()调用
- How to Login Automatically into Website Using Excel VBA
- 显示全部控制台信息
- 三、lua coroutine
- MongoDB使用小结:一些常用操作分享
- 怎么在Eclipse中添加VI插件
- [图像] K-means聚类(视觉单词)