• 大小: 1.02MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-04
  • 语言: 其他
  • 标签: nessus  源码  

资源简介

nessus源码分析

资源截图

代码片段和文件信息

/* Nessus Attack scripting Language 
 *
 * Copyright (C) 2002 - 2003 Michel Arboi and Renaud Deraison
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation
 *
 * 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 write to the Free Software
 * Foundation Inc. 675 Mass Ave Cambridge MA 02139 USA.
 *
 * In addition as a special exception Renaud Deraison and Michel Arboi
 * give permission to link the code of this program with any
 * version of the OpenSSL library which is distributed under a
 * license identical to that listed in the included COPYING.OpenSSL
 * file and distribute linked combinations including the two.
 * You must obey the GNU General Public License in all respects
 * for all of the code used other than OpenSSL.  If you modify
 * this file you may extend this exception to your version of the
 * file but you are not obligated to do so.  If you do not wish to
 * do so delete this exception statement from your version.
 */
#include 
#include 

#include “capture_packet.h“
#include “nasl_raw.h“



extern int islocalhost(struct in_addr *);




/*
 * Set up the pcap filter and select the correct interface.
 *
 * The filter will be changed only if this is necessary
 * 
 */
 
int init_capture_device(struct in_addr src struct in_addr dst char * filter)

{
 int ret = -1;
 char * interface = NULL;
 char * a_dst *a_src;
 char errbuf[PCAP_ERRBUF_SIZE];
 int free_filter = 0;
 
 a_src = estrdup(inet_ntoa(src));
 a_dst = estrdup(inet_ntoa(dst));
 
 if((filter == NULL) || (filter[0]==‘\0‘) || (filter[0]==‘0‘))
 {
  filter = emalloc(256);
  free_filter = 1;
  if(islocalhost(&src) == 0)
   snprintf(filter 256 “ip and (src host %s and dst host %s)“
    a_src a_dst);
  
 }
 else {
  if(islocalhost(&src) == 0)filter = estrdup(filter);
else filter = emalloc(1);
free_filter = 1;
  }
 
 efree(&a_dst);
 efree(&a_src);

 if((interface = routethrough(&src &dst))||
    (interface = pcap_lookupdev(errbuf)))   
    ret = bpf_open_live(interface filter);
     
 
 if(free_filter != 0)efree(&filter);

 return ret;   
}

struct ip * capture_next_packet(int bpf int timeout int * sz)
{
  int len;
  int dl_len;
  char * packet = NULL;
  char * ret = NULL;
  struct timeval past now then;
  struct timezone tz;
 
  if(bpf < 0)
   return NULL;
   
  dl_len =  get_datalink_size(bpf_datalink(bpf));
  bzero(&past sizeof(past));
  bzero(&now sizeof(now));
  gettimeofday(&then &tz);
  for(;;)
  {
   bcopy(&then &past sizeof(then));
   packet = (char*)bpf_next(bpf &len);
   if(packet != NULL)
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3267  2003-06-06 05:16  libnasl\include\config.h.in

     文件       5246  2003-05-22 00:25  libnasl\include\includes.h

     文件        575  2003-11-25 03:49  libnasl\include\nasl.h

     文件       2110  1999-06-12 21:03  libnasl\include\nasl_icmp.h

     文件       1089  2003-02-18 07:39  libnasl\include\nasl_ip.h

     文件        308  1999-06-12 21:03  libnasl\include\nasl_raw.h

     文件       1179  2001-10-16 01:58  libnasl\include\nasl_tcp.h

     文件        569  2001-10-16 01:58  libnasl\include\nasl_udp.h

     目录          0  2004-03-08 12:52  libnasl\include

     文件       3073  2003-11-21 16:45  libnasl\nasl\Makefile

     文件       3597  2003-07-18 02:05  libnasl\nasl\capture_packet.c

     文件       1572  2003-01-18 23:54  libnasl\nasl\capture_packet.h

     文件      41346  2004-01-20 05:38  libnasl\nasl\exec.c

     文件       1590  2003-02-23 04:16  libnasl\nasl\exec.h

     文件       4298  2003-04-02 19:54  libnasl\nasl\hmacmd5.c

     文件       2377  2004-01-20 05:38  libnasl\nasl\hmacmd5.h

     文件       3139  2003-01-07 09:39  libnasl\nasl\lfind.c

     文件       8053  2003-04-02 19:54  libnasl\nasl\md5.c

     文件        870  2003-04-02 18:46  libnasl\nasl\md5.h

     文件       6030  2003-07-18 02:05  libnasl\nasl\nasl.c

     文件      12255  2004-01-20 05:38  libnasl\nasl\nasl_crypto.c

     文件        847  2003-04-02 18:46  libnasl\nasl\nasl_crypto.h

     文件       3005  2003-03-24 07:49  libnasl\nasl\nasl_debug.c

     文件       1566  2003-02-23 02:20  libnasl\nasl\nasl_debug.h

     文件       9268  2004-01-20 05:38  libnasl\nasl\nasl_func.c

     文件       1896  2003-07-18 02:05  libnasl\nasl\nasl_func.h

     文件       1649  2003-01-18 23:54  libnasl\nasl\nasl_global_ctxt.h

     文件      24144  2004-01-20 05:38  libnasl\nasl\nasl_grammar.y

     文件       6075  2003-07-18 02:05  libnasl\nasl\nasl_host.c

     文件       1868  2003-01-18 23:54  libnasl\nasl\nasl_host.h

............此处省略407个文件信息

评论

共有 条评论