Overview of hp_printers.inc

Automatic Includes

These files are automatically included by the library.

Public Variable Summary

Public variables are intended to be accessed by the code that imports this library.

Name Summary
cookie

Public Function Summary

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

Name Summary
check_hp_default_login
error_exit
hp_login_details

Public Variable Details

top

Public Function Details

check_hp_default_login

Named Parameters

model

Code

function check_hp_default_login(model) {

  HP = hp_login_details(model:model);
  if(!HP)return FALSE;

  if(HP['no_default_auth']) {
    if(HP['req_type'] == "GET") {
      if(HP['req_auth'] == "BASIC") {

        req = string("GET ", HP['login_url']," HTTP/1.1\r\n",
                     "Host: ", get_host_name(),"\r\n");

        buf = http_send_recv(port:port, data:req + '\r\n', bodyonly:FALSE);
        error_exit(buf:buf);

        if(HP['http_status'] >< buf) {

          if(eregmatch(pattern:HP['login_success'], string:buf)) {
            return 2;
          }  
        }  
      }  
    }  
  }  
}  


function hp_login_details(model) {

		
top

error_exit

Named Parameters

buf

Code

function error_exit(buf) {

  if(!buf || ereg(pattern:"HTTP/1.(0|1) (404|401|500)", string: buf))exit(0);

  return TRUE;

}


		
top

hp_login_details

Named Parameters

model

Code

function hp_login_details(model) {

  global_var cookie;

  hp_printer = make_array();

  if(model == "LaserJet 100 colorMFP M175nw" ||
     model == "LaserJet P2015"               ||
     model == "LaserJet CP2025n"             ||
     model == "LaserJet CP1515n"             ||
     model == "LaserJet M1522nf MFP"         ||
     model == "LaserJet M1536dnf MFP"        ||
     model == "LaserJet M2727nf MFP"         ||
     model == "LaserJet 2605dtn"             ||
     model == "LaserJet 2605dn"              ||
     model == "LaserJet 3055"                ||
     model == "LaserJet CM1312nfi"           ||
     model == "LaserJet CM2320fxi"           ||
     model == "LaserJet CM1415fn"            ||
     model == "LaserJet CM2320nf"            ||
     model == "LaserJet 400 color M451dn"    ||
     model == "LaserJet 400 M401n"           ||
     model == "LaserJet 400 M401dn") {
  
    hp_printer['req_type'] = "GET";
    hp_printer['login_url'] = '/set_config_networkIP.html';
    hp_printer['req_auth'] = "BASIC";
    hp_printer['no_default_auth'] = "TRUE";

    hp_printer['http_status'] = 'HTTP/1.1 200';
    hp_printer['login_success'] = 'label for="IPAddr1">';

    return hp_printer;

  } 
  
  else if(model == "LaserJet 2840") {

    hp_printer['req_type'] = "GET";
    hp_printer['login_url'] = '/hp/device/set_config_networkIP.html';
    hp_printer['req_auth'] = "BASIC";
    hp_printer['no_default_auth'] = "TRUE";

    hp_printer['http_status'] = 'HTTP/1.1 200';
    hp_printer['login_success'] = 'This table contains the Network IP heading';

    return hp_printer;

  } 

  else if(model == "LaserJet 5100"   ||
          model == "LaserJet 5000"   ||
          model == "LaserJet 4000"   ||
          model == "LaserJet 4050"   ||
          model == "LaserJet 3800"   ||
          model == "LaserJet 3700"   ||
          model == "LaserJet 3600"   ||
          model == "LaserJet 3500"   ||
          model == "LaserJet 2200"   ||
          model == "LaserJet 3550"   ||
          model == "LaserJet 3030"   ||
          model == "LaserJet 2300"   ||
          model == "LaserJet 8150"   ||
          model == "LaserJet 5800"   ||
          model == "Designjet 800PS" ||
          model == "DesignJet 800"   ||
          model == "LaserJet 2550"   ||
          model == "LaserJet 1320"   ||
          model == "Designjet 500"   ||
          model == "DesignJet 1055CM") {

    hp_printer['req_type'] = "GET";
    hp_printer['login_url'] = '/tcp_param.htm';
    hp_printer['req_auth'] = "BASIC";
    hp_printer['no_default_auth'] = "TRUE";

    hp_printer['http_status'] = 'HTTP/1.1 200';
    hp_printer['login_success'] = 'This table displays the TCP/IP configuration items';

    return hp_printer;

  } 

  else if(model == "LaserJet 4250"    ||
          model == "LaserJet 4600"    ||
          model == "LaserJet 4650"    ||
          model == "designjet 5500ps" ||
          model == "LaserJet 4200"    ||
          model == "LaserJet 4730mfp" ||
          model == "LaserJet 4730"    ||
          model == "LaserJet CM4730"  ||
          model == "LaserJet P2055dn" ||
          model == "LaserJet 2430") {

    hp_printer['req_type'] = "GET";
    hp_printer['login_url'] = '/hp/jetdirect/tcp_param.htm';
    hp_printer['req_auth'] = "BASIC";
    hp_printer['no_default_auth'] = "TRUE";

    hp_printer['http_status'] = 'HTTP/1.1 200';
    hp_printer['login_success'] = 'This table displays the TCP/IP configuration items';

    return hp_printer;

  }  

  else if(model == "psc 2500") {

    hp_printer['req_type'] = "GET";
    hp_printer['login_url'] = '/uvl_gen_settings.htm';
    hp_printer['req_auth'] = "BASIC";
    hp_printer['no_default_auth'] = "TRUE";

    hp_printer['http_status'] = 'HTTP/1.1 200';
    hp_printer['login_success'] = 'This table is used to display the network protocol links/tabs';

    return hp_printer;

  } 

  else if(model == "Officejet Pro K5400"  ||
          model == "Officejet Pro K5400"  ||
          model == "Officejet Pro L7600"  ||
          model == "Officejet Pro 8500"   ||
          model == "Officejet 7000 E809a") {

    hp_printer['req_type'] = "GET";
    hp_printer['login_url'] = '/index.htm?cat=network&page=wiredIfc&adaptorID=0';
    hp_printer['req_auth'] = "BASIC";
    hp_printer['no_default_auth'] = "TRUE";

    hp_printer['http_status'] = 'HTTP/1.1 200';
    hp_printer['login_success'] = 'id="alt_dnsserver1"';

    return hp_printer;

  } 

  else if(model == "Officejet 4500") {

    hp_printer['req_type'] = "GET";
    hp_printer['login_url'] = '/index.htm?cat=network&page=wirelessIfc';
    hp_printer['req_auth'] = "BASIC";
    hp_printer['no_default_auth'] = "TRUE";

    hp_printer['http_status'] = 'HTTP/1.1 200';
    hp_printer['login_success'] = 'id="alt_dnsserver1"';

    return hp_printer;

  }

  else if(model == "Officejet Pro 8600") {

    hp_printer['req_type'] = "GET";
    hp_printer['login_url'] = '/webApps/Wired/ipV4.htf';
    hp_printer['req_auth'] = "BASIC";
    hp_printer['no_default_auth'] = "TRUE";

    hp_printer['http_status'] = 'HTTP/1.1 200';
    hp_printer['login_success'] = '<?hp te.includeSubPage';

    return hp_printer;

  }

}  

function error_exit(buf) {

		
top