From 0d47952611198ef6b1163f366dc03922d20b1475 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 09:42:04 +0200 Subject: Adding upstream version 7.94+git20230807.3be01efb1+dfsg. Signed-off-by: Daniel Baumann --- nselib/nrpc.lua | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 nselib/nrpc.lua (limited to 'nselib/nrpc.lua') diff --git a/nselib/nrpc.lua b/nselib/nrpc.lua new file mode 100644 index 0000000..d5af8a6 --- /dev/null +++ b/nselib/nrpc.lua @@ -0,0 +1,164 @@ +--- A minimalistic library to support Domino RPC +-- +-- Summary +-- ------- +-- The library currently only supports user enumeration and uses chunks of +-- captured data to do so. +-- +-- Overview +-- -------- +-- The library contains the following classes: +-- +-- o DominoPacket +-- - The packet class holding the packets sent between the client and the +-- IBM Lotus Domino server +-- +-- o Helper +-- - A helper class that provides easy access to the rest of the library +-- +-- Example +-- ------- +-- The following sample code illustrates how scripts can use the Helper class +-- to interface the library: +-- +-- +-- helper = nrpc.Helper:new(host, port) +-- status, err = nrpc:Connect() +-- status, res = nrpc:isValidUser("Patrik Karlsson") +-- status, err = nrpc:Close() +-- +-- +-- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html +-- @author Patrik Karlsson +-- + +-- +-- Version 0.1 +-- Created 07/23/2010 - v0.1 - created by Patrik Karlsson +-- + + +local match = require "match" +local nmap = require "nmap" +local stdnse = require "stdnse" +local string = require "string" +_ENV = stdnse.module("nrpc", stdnse.seeall) + +-- The Domino Packet +DominoPacket = { + + --- Creates a new DominoPacket instance + -- + -- @param data string containing the packet data + -- @return a new DominoPacket instance + new = function( self, data ) + local o = {} + setmetatable(o, self) + self.__index = self + o.data = data + return o + end, + + --- Reads a packet from the socket + -- + -- @param domsock socket connected to the server + -- @return Status (true or false). + -- @return Error code (if status is false). + read = function( self, domsock ) + local status, data = domsock:receive_buf(match.numbytes(2), true) + local len = string.unpack( "