Overview of imap_func.inc

Public Function Summary

Public functions are intended to be called by the code that imports this library.

Name Summary
get_imap_banner

Public Function Details

get_imap_banner

Named Parameters

port

Code

function get_imap_banner (port)
{
  local_var sb, banner, soc;

  if( ! port ) set_kb_item( name: "nvt_debug_empty/" + get_script_oid(), value:get_script_oid() + "#-#port#-#get_imap_banner" );
  
  sb = string("imap/banner/", port);
  banner = get_kb_item(sb);
  if(banner) return (banner);
  if ( get_kb_item("imap/" + port + "/broken") ) 
	return NULL;

  if(! get_port_state(port)) return (0);
  soc = open_sock_tcp(port);
  if (! soc) {
	set_kb_item(name:"imap/" + port + "/broken", value:TRUE);
	return NULL;
	}
  banner =  recv_line(socket: soc, length:4096);
  close(soc);
  if(! banner ) {
	set_kb_item(name:"imap/" + port + "/broken", value:TRUE);
	return NULL;
	}
	
  
  replace_kb_item(name: sb, value: banner);
  return(banner);
}


		
top