Nessus 0.99.0 C Plugins API
Author : Renaud Deraison <deraison@nessus.org>
Overview
-----------------------------------------------------------------
The Nessus Security Scanner performs its security
checks by launching external pieces of code called 'plugins'.
One plugin is in charge of one security check against one
host.
There are, at this time, two languages to write security checks :
NASL (the Nessus Attack Scripting Language) and C.
NASL should be prefered as it makes plugins which are easily
portable and shareable. C plugins should be avoided, except when
NASL proves to not be powerful enough.
This document teaches you how to write a C Nessus plugin.
Once more : *** C Nessus plugins should be avoided, except when
it is not possible to write them in NASL ***
This document covers the following topics :
1. How to compile a C plugin
2. The plugins framework
2.1 The main .c file
2.2 The file includes.h
2.3 The file nessusraw.h
2.4 The plugin_init() function
2.5 The plugin_run() function
3. The Nessus library functions
3.1 plugin_init() related functions
3.1.1 plug_set_name()
3.1.2 plug_set_category()
3.1.3 plug_set_family()
3.1.4 plug_set_description()
3.1.5 plug_set_summary()
3.1.6 plug_set_copyright()
3.2 plugin additional functions
3.2.1 plug_set_timeout()
3.2.2 plug_set_dep()
3.2.3 add_plugin_preference()
3.2.4 get_plugin_preference()
3.3 target informations
3.3.1 plug_get_hostname()
3.3.2 plug_get_host_ip()
3.3.3 plug_get_host_open_port()
3.3.4 host_get_port_state()
3.4 network operations
3.4.1 open_sock_tcp()
3.4.2 recv_line()
3.4.3 ftp_log_in()
3.4.4 ftp_get_pasv_address()
3.4.5 is_cgi_installed()
3.4.6 ping_host()
3.4.7 tcp_ping_host()
3.4.8 tcp_timing()
3.5 plugins inter communication (PIIC)
3.5.1 Introduction
3.5.2 plug_set_key()
3.5.3 plug_get_key()
3.5.4 Standard keys
3.6 Reporting a problem to the Nessus server
3.6.1 post_hole()
3.6.2 post_info()
4. Interfacing a Nessus plugin with the libpcap library
4.1 Makefile changes
4.2 libpcap-related Nessus functions
4.2.1 routethrough()
4.2.2 get_datalink_size()
5. A sample plugin commented
1. How to compile a C plugin
-----------------------------------------------------------------
C plugins must be compiled into shared libraries
before they can be used by Nessus. Turning a C file into
a shared library is a painful process, which is not portable.
That is why nessus-0.99.0 comes with the utility 'nessus-build'
which will build a .c plugin and turn it into a .nes file.
Its usage is :
nessus-build input.c output.nes
This script will create the directory $TMP/nessus-build and
will copy there the libtool which is appropriate to your system,
as well as a generic Makefile. But you should not care anyway,
except if your plugin contains several .c files.
2. The plugins framework
-----------------------------------------------------------------
2.1 The main .c file
----------------------------------------------------------------
The main .c file will contain the two critical functions that
we will discuss right after this.
2.2 The file "includes.h"
----------------------------------------------------------------
The file "includes.h" contains all the includes necessary to
write a plugin.
2.3 The file "nessusraw.h"
----------------------------------------------------------------
nessusraw.h contains all the includes to define the structs
ip, tcphdr, udphdr and icmp (BSD style). If these structures
are not defined in the system includes, then it redefines
them.
You should include this file if your plugin plays with
raw sockets.
2.4 the plugin_init() function
----------------------------------------------------------------
Synopsis :
int plugin_init(struct arglist * desc);
Description :
This function is called by the server so that the plugin
declares who is it, what it performs and so on. It should be
declared by your plugin, and must contain calls to the
following functions :
plug_set_name() (3.1.1)
plug_set_category() (3.1.2)
plug_set_family() (3.1.3)
plug_set_description() (3.1.4)
plug_set_summary() (3.1.5)
plug_set_copyright() (3.1.6)
It may also contain some calls to the function
add_plugin_preference()
We will define all these functions in section 3.1
(except add_plugin_preference which will be defined in another
section)
This function should return 0. Also, no initialization must be made
during this function, since all the dynamically allocated variables
will be destroyed right after the plugin exits from plugin_init()
2.5 the plugin_run() function
----------------------------------------------------------------
Synopsis :
int plugin_run(struct arglist * desc);
Description :
This is the main plugin entry point. It may contain whatever you want.
3. The Nessus library functions
-----------------------------------------------------------------
3.0 Notes on the internationalization of Nessus
----------------------------------------------------------------
nessus-0.99.0 and newer support multilingual plugins. That is,
each plugin may contain descriptions in any language.
As a result of this, most of the functions have
a 'language' argument which will tell nessusd in which
language the data passed is.
Those functions can be called several times, with a
different 'language' argument each time.
The 'language' argument must be NULL for english (default),
or must contain the same name as in nessusd.conf.
("deutsch", "francais", and so on...)
The NULL language must be called LAST !
Here is an exemple :
plug_set_name(env, "Test FTP", "francais");
plug_set_name(env, "FTP check", NULL);
3.1 plugin_init() related functions
----------------------------------------------------------------
3.1.1 plug_set_name()
---------------------------------------------------------------
Synopsis :
#include <includes.h>
void plug_set_name(struct arglist * desc, const char * name,
const char * language);
Description :
This function tells the server the full name of the plugin. The
name may contain spaces.
The argument 'desc' is the argument which is given to the function
plugin_init().
This function must only be called during plugin_init().
See also explained here :
languages (3.0)
plugin_init(2.3)
3.1.2 plug_set_category
---------------------------------------------------------------
Synopsis :
#include <includes.h>
void plug_set_category(struct arglist * desc, int category);
Description :
This function tells the server in which category the plugin is.
The argument 'category' must be one of the following :
ACT_GATHER_INFO : the plugin gathers informations about the
remote host. No harm is made
ACT_ATTACK : the plugin will attack the remote server and
may steal sensitive data. However, no harm
is made : the attacked services are still working
after the plugin has done its job.
ACT_DENIAL : the plugin performs a denial of service attack
against the remote host.
ACT_PASSIVE : the plugin will perform a passive attack.
ACT_SCANNER : the plugin is actually a port scanner
If a plugin is in one of the first three category, then it will be
subject to a timeout watchdog on the server side, so even if there
is an infinite loop i
没有合适的资源?快使用搜索试试~ 我知道了~
nessus-plugins-2.0.10.tar.gz_NS-2_nessus plugi_nessus-_nessus-li
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 145 浏览量
2022-09-14
14:39:01
上传
评论
收藏 1.38MB GZ 举报
温馨提示
共2000个文件
nasl:1969个
c:32个
makefile:16个
Nessus 2.0.10 其中有个人部分注释,希望对大家学习有所帮助
资源详情
资源评论
资源推荐
收起资源包目录
nessus-plugins-2.0.10.tar.gz_NS-2_nessus plugi_nessus-_nessus-li (2000个子文件)
nessus-build.1 525B
nessus-update-plugins.8 2KB
find_service.c 73KB
nmap_wrapper.c 28KB
hydra.c 26KB
d3des.c 15KB
synscan.c 14KB
hydra4nessus.c 12KB
nmap_tcp_connect.c 11KB
snmp_portscan.c 11KB
3com_hub.c 10KB
hydra-mod.c 9KB
ftp_write_dirs.c 8KB
hydra-smb.c 7KB
hydra-telnet.c 7KB
ssl_ciphers.c 7KB
hydra-icq.c 7KB
nikto_wrapper.c 6KB
smad.c 6KB
hydra-cisco-enable.c 6KB
objectserver.c 6KB
hydra-pcnfs.c 5KB
linux_tftp.c 5KB
hydra-vnc.c 5KB
tftp_grab_file.c 5KB
hydra-http.c 5KB
hydra-cisco.c 5KB
hydra-ldap.c 4KB
hydra-nntp.c 4KB
hydra-ftp.c 4KB
hydra-pop3.c 3KB
hydra-imap.c 3KB
hydra-socks5.c 3KB
hydra-rexec.c 3KB
CHANGES 4KB
configure 195KB
COPYING 15KB
.create-dir 0B
Makefile.darwin 2KB
Makefile.darwin 339B
Makefile.darwin 338B
Makefile.darwin 338B
Makefile.darwin 337B
Makefile.darwin 337B
Makefile.darwin 336B
Makefile.darwin 336B
Makefile.darwin 334B
Makefile.darwin 333B
Makefile.darwin 332B
Makefile.darwin 330B
Makefile.darwin 330B
Makefile.darwin 327B
LICENSE.GNU 18KB
config.guess 38KB
d3des.h 2KB
hydra.h 1KB
nmap.h 1KB
hydra-mod.h 1004B
LICENCE.HYDRA 898B
nessus-update-plugins.in 5KB
configure.in 4KB
nessus-build.in 3KB
nessus.tmpl.in 597B
smb_nt.inc 69KB
http_func.inc 9KB
http_keepalive.inc 8KB
nfs_func.inc 7KB
misc_func.inc 6KB
ssl_funcs.inc 4KB
smtp_func.inc 4KB
network_func.inc 3KB
backport.inc 2KB
ftp_func.inc 2KB
uddi.inc 2KB
default_account.inc 1KB
dump.inc 983B
pingpong.inc 928B
telnet_func.inc 569B
INSTALL 408B
INSTALL 36B
install-sh 5KB
install_plug 1KB
aclocal.m4 129KB
make_world 575B
Makefile 2KB
Makefile 2KB
Makefile 459B
Makefile 370B
Makefile 370B
Makefile 366B
Makefile 358B
Makefile 354B
Makefile 349B
Makefile 348B
Makefile 348B
Makefile 346B
Makefile 345B
Makefile 344B
Makefile 338B
Makefile 313B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
林当时
- 粉丝: 95
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0