1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00
Files
nmap/nse_main.h
david b838242e01 Merge from /nmap-exp/david/nmap-mem. This brings in two memory-reducing
changes. The first is that Port objects don't allocate memory for
service and RPC results unless that information is set. This reduces the
size of a bare Port from 92 to 40 bytes on my machine. The second change
is that PortList now has the notion of a "default port state," which is
the state of any ports that didn't receive a response. These ports don't
need an allocated Port object, which saves a lot of memory in scans
where most ports didn't get a response.
2009-12-19 21:26:14 +00:00

61 lines
1.2 KiB
C++

#ifndef NMAP_LUA_H
#define NMAP_LUA_H
#include <vector>
#include <list>
#include <string>
#include <string.h>
#include <iostream>
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
class ScriptResult
{
private:
std::string output;
std::string id;
public:
void set_output (const char *);
std::string get_output (void) const;
void set_id (const char *);
std::string get_id (void) const;
};
typedef std::vector<ScriptResult> ScriptResults;
class Target;
/* API */
int nse_yield (lua_State *);
void nse_restore (lua_State *, int);
void nse_destructor (lua_State *, char);
void nse_base (lua_State *);
void nse_selectedbyname (lua_State *);
void nse_gettarget (lua_State *, int);
void open_nse (void);
void script_scan (std::vector<Target *> &targets);
void close_nse (void);
int script_updatedb (void);
#define SCRIPT_ENGINE "NSE"
#ifdef WIN32
# define SCRIPT_ENGINE_LUA_DIR "scripts\\"
# define SCRIPT_ENGINE_LIB_DIR "nselib\\"
#else
# define SCRIPT_ENGINE_LUA_DIR "scripts/"
# define SCRIPT_ENGINE_LIB_DIR "nselib/"
#endif
#define SCRIPT_ENGINE_DATABASE "script.db"
#define SCRIPT_ENGINE_EXTENSION ".nse"
#endif