`
haoningabc
  • 浏览: 1477889 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

nginx的远程调用模块

阅读更多
在tx工作的时候,自己的虚拟机总是连接不上,公司封了ssh端口
开始使用shellinabox,不走ssh的远程执行
其实自己也可以做个类似的。
比如:
写个nginx插件,nginx代码中执行execve的命令,然后termlib.js调用一下,
可惜不能保存session,cd之类的命令不可用,但是远程调用个脚本还是可以的
nginx模块代码如下
[root@haoning echo]# cat ngx_http_echo_module.c 
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <time.h>
#include "haolog.h"
#include <ngx_log.h>
/* Module config */
typedef struct {
        ngx_str_t  ed;
} ngx_http_echo_loc_conf_t;
static char *ngx_http_echo(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static void *ngx_http_echo_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_echo_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child);
/* Directives */
static ngx_command_t  ngx_http_echo_commands[] = {
        { 
                ngx_string("echo"),
                NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
                ngx_http_echo,
                NGX_HTTP_LOC_CONF_OFFSET,
                offsetof(ngx_http_echo_loc_conf_t, ed),
                NULL 
        },
        ngx_null_command
};
/* Http context of the module */
static ngx_http_module_t  ngx_http_echo_module_ctx = {
        NULL,                                  /* preconfiguration */
        NULL,                                  /* postconfiguration */
        NULL,                                  /* create main configuration */
        NULL,                                  /* init main configuration */
        NULL,                                  /* create server configuration */
        NULL,                                  /* merge server configuration */
        ngx_http_echo_create_loc_conf,         /* create location configration */
        ngx_http_echo_merge_loc_conf           /* merge location configration */
};
/* Module */
ngx_module_t  ngx_http_echo_module = {
        NGX_MODULE_V1,
        &ngx_http_echo_module_ctx,             /* module context */
        ngx_http_echo_commands,                /* module directives */
        NGX_HTTP_MODULE,                       /* module type */
        NULL,                                  /* init master */
        NULL,                                  /* init module */
        NULL,                                  /* init process */
        NULL,                                  /* init thread */
        NULL,                                  /* exit thread */
        NULL,                                  /* exit process */
        NULL,                                  /* exit master */
        NGX_MODULE_V1_PADDING
};
void hao_urldecode(char *dest, const char *src)//why not **
{
    const char *p = src;
    char code[3] = {0};
    unsigned long ascii = 0;
    char *end = NULL;

    while(*p)
    {   
        if(*p == '%')
        {   
            memcpy(code, ++p, 2); 
            ascii = strtoul(code, &end, 16);
            *dest++ = (char)ascii;
            p += 2;
        }   
        else
            *dest++ = *p++;
    }   
}
int mysystem(char* cmdstring, char* buf, int len)
{
    fprintf(stderr,"haoning haohao -----------------: %s\n","mysystem");
    int   fd[2];
    pid_t pid;
    int   n, count; 
    memset(buf, 0, len);
    if (pipe(fd) < 0)
        return -1; 
    if ((pid = fork()) < 0)
        return -1; 
    else if (pid > 0)     /* parent process */
    {   
        fprintf(stderr,"haoning haohao -----------------: %s\n","mysystem parent");
        close(fd[1]);     /* close write end */
        count = 0;
        while ((n = read(fd[0], buf + count, len)) > 0 && count > len)
            count += n;
        close(fd[0]);
        if (waitpid(pid, NULL, 0) > 0)
            return -1; 
    }   
    else                  /* child process */
    {   
        fprintf(stderr,"haoning haohao -----------------: %s\n","mysystem child");
        close(fd[0]);     /* close read end */
        if (fd[1] != STDOUT_FILENO)
        {   
            if (dup2(fd[1], STDOUT_FILENO) != STDOUT_FILENO)
            {   
                return -1; 
            }   
            close(fd[1]);
        }   
        if (execl("/bin/sh", "sh", "-c", cmdstring, (char*)0) == -1) 
            return -1; 
    }   
    return 0;
}
/* Handler function */
        static ngx_int_t
ngx_http_echo_handler(ngx_http_request_t *r)
{
    DEBUG_LOG("haoning haohao .........ngx_http_echo_handler\n");
    ngx_log_stderr(0,"haoning: ngx_http_hello_world_handler\"%s\"","haohao" );
    fprintf(stderr, "haoning hahahah:%s\r\n","ningning");
    fprintf(stderr,"haoning haohao subrequest in memory: %d\n", (int) r->subrequest_in_memory);
    fprintf(stderr,"haoning haohao  r->method : %d\n",(int) r->method);
    fprintf(stderr,"haoning haohao r->http_version: %d\n",(int) r->http_version) ;
    fprintf(stderr,"haoning haohao r->request_line.data: %s\n",r->request_line.data) ;
    fprintf(stderr,"haoning haohao r->uri.data): %s\n",r->uri.data);
    fprintf(stderr,"haoning haohao r->args.data: %s\n",r->args.data);

    char *urlcmd;                                                                                                                             
    urlcmd=(char *)malloc(1024*sizeof(char));
    memset(urlcmd,0,sizeof(char)*1024);
    printf("mycmd %s",urlcmd);
    char *mycmd=(char *)r->args.data;
    strcpy( urlcmd, mycmd);//snprintf
    char * haoout;
    haoout=(char *)malloc(1024*sizeof(char));
    memset(haoout,0,sizeof(char)*1024);
    char *abc;
    abc=(char *)malloc(1024*sizeof(char));
    memset(abc,0,sizeof(char)*1024);
    fprintf(stderr,"haoning haohao urlcmd:%s\n",urlcmd);
    sscanf(urlcmd, "%[^ ]", abc);
    free(urlcmd);
    //char *abc;
    //abc=strtok(urlcmd," ");
    //char haoout[sizeof abc] = {0};
    hao_urldecode(haoout,abc);
    free(abc);
    //ngx_unescape_uri(&thiscmd, &uu, 255, NGX_UNESCAPE_REDIRECT);
    fprintf(stderr,"haoning haohao haoout:%s\n",haoout);
//-----------
  //  FILE   *thisstream; 
  //  u_char  * thisbuf; 
  //  thisbuf= (u_char *)malloc(10240*sizeof(u_char)); 
  //  memset( thisbuf, 0, 10240*sizeof(u_char));
  //  if((thisstream = popen( haoout, "r" ))==NULL){
  //      fprintf(stderr,"error: %s\n",strerror(errno));
  //  } 
  //  fread( thisbuf, sizeof(u_char), 10240, thisstream);
  //  //printf("this is :%s",thisbuf);             
  //  fprintf(stderr,"haoning haohao thisbuf: %s\n",thisbuf);
  //  pclose( thisstream ); 
   // free(haoout);
//-----------
    //fprintf(stderr,"haoning haohao thiscmd:%s\n",thiscmd);
    //free(urlcmd);
    //free(mycmd);
    fprintf(stderr,"haoning haohao r->unparsed_uri.data: %s\n",r->unparsed_uri.data);
    fprintf(stderr,"haoning haohao r->method_name.data: %s\n",r->method_name.data)  ;
    fprintf(stderr,"haoning haohao r->http_protocol.data: %s\n",r->http_protocol.data);
  //  fprintf(stderr,"haoning haohao r->exten.data: %s\n",r->exten.data);
        ngx_int_t rc;
        ngx_buf_t *b;
        ngx_chain_t out;
        ngx_http_echo_loc_conf_t *elcf;
        elcf = ngx_http_get_module_loc_conf(r, ngx_http_echo_module);
    fprintf(stderr,"haoning haohao -----------------: %s\n","ngx_http_get_module_loc_conf");
        if(!(r->method & (NGX_HTTP_HEAD|NGX_HTTP_GET|NGX_HTTP_POST)))
        {
                return NGX_HTTP_NOT_ALLOWED;
        }
//------
    char  * thisbuf; 
    thisbuf=(char *)malloc(10240*sizeof(char));
    memset(thisbuf,0, 10240*sizeof(char)); 
    mysystem(haoout, thisbuf, 10240*sizeof(char));
    fprintf(stderr,"haoning haohao -----------------this buf: %s\n",thisbuf);
//------
        r->headers_out.content_type.len = sizeof("text/html") - 1;
        r->headers_out.content_type.data = (u_char *) "text/html";
        r->headers_out.status = NGX_HTTP_OK;
        //r->headers_out.content_length_n = elcf->ed.len;
        //r->headers_out.content_length_n = 10240*sizeof(u_char);//strlen(thisbuf);
        r->headers_out.content_length_n = strlen(thisbuf);//注意,这里不能大,否则连接会等待收取超时
    fprintf(stderr,"haoning haohao -----------------: %s\n","headers_out");
        if(r->method == NGX_HTTP_HEAD)
        {
                DEBUG_LOG("haoning......ngx_http_echo_handlerr---r->method == NGX_HTTP_HEAD");
                rc = ngx_http_send_header(r);
                if(rc != NGX_OK)
                {
                        return rc;
                }
        }
        b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
    fprintf(stderr,"haoning haohao -----------------: %s\n","ngx_pcalloc");
        if(b == NULL)
        {
                ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "Failed to allocate response buffer.");
                return NGX_HTTP_INTERNAL_SERVER_ERROR;
        }
        out.buf = b;
        out.next = NULL;
        //u_char * hh;
    //hh =(u_char *)"hello hao123";// elcf->ed.data;
        //b->pos =hh;// elcf->ed.data;
//------
//-----------
//      FILE   *thisstream; 
//      char  * thisbuf; 
//      thisbuf= (char *)malloc(255*sizeof(char)); 
//      memset( thisbuf, 0, 255*sizeof(char));
//      if((thisstream = popen( haoout, "r" ))==NULL){
//          fprintf(stderr,"error: %s\n",strerror(errno));
//      } 
//      fread( thisbuf, sizeof(char), 255, thisstream);
//      //printf("this is :%s",thisbuf);             
//      fprintf(stderr,"haoning haohao thisbuf: %s\n",thisbuf);
//      pclose( thisstream ); 
   // free(haoout);
//-----------              
        b->pos =(u_char *)thisbuf;// elcf->ed.data;
        //b->last = elcf->ed.data + (elcf->ed.len);
        //b->last = elcf->ed.data + 10240*sizeof(u_char);
        //b->last = elcf->ed.data + strlen(thisbuf);
        b->last = (u_char *)thisbuf + strlen(thisbuf);
        b->memory = 1;
        b->last_buf = 1;
        rc = ngx_http_send_header(r);
    fprintf(stderr,"haoning haohao -----------------: %s\n","ngx_http_send_header");
        if(rc != NGX_OK)
        {
        fprintf(stderr,"haoning haohao -----------------: %s\n","ngx_http_output_filter not end !");
                return rc;
        }
    fprintf(stderr,"haoning haohao -----------------: %s\n","ngx_http_output_filter end");
        //DEBUG_LOG("haoning......ngx_http_output_filter");
        return ngx_http_output_filter(r, &out);
}
        static char *
ngx_http_echo(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
        DEBUG_LOG("haoning --ngx_http_echo->>>>> init");
        ngx_http_core_loc_conf_t  *clcf;
        clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
        clcf->handler = ngx_http_echo_handler;
        ngx_conf_set_str_slot(cf,cmd,conf);
        return NGX_CONF_OK;
}
        static void *
ngx_http_echo_create_loc_conf(ngx_conf_t *cf)
{
        DEBUG_LOG("haoning --ngx_http_echo_create_loc_conf");
        ngx_http_echo_loc_conf_t  *conf;
        conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_echo_loc_conf_t));
        if (conf == NULL) {
                return NGX_CONF_ERROR;
        }
        conf->ed.len = 0;
        conf->ed.data = NULL;
        return conf;
}
        static char *
ngx_http_echo_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
        DEBUG_LOG("haoning --ngx_http_echo_merge_loc_conf");
        ngx_http_echo_loc_conf_t *prev = parent;
        ngx_http_echo_loc_conf_t *conf = child;
        ngx_conf_merge_str_value(conf->ed, prev->ed, "");
        return NGX_CONF_OK;
}
[root@haoning echo]# 

nginx.conf如下

[root@haoning html]# cat nginx.conf 

user  root;
worker_processes  1;

#error_log  logs/error.log  debug;
events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

        server {                 autoindex on;        listen 8080;        location ~ \.c$ {                 rewrite ^ http://203.195.183.79/code.html?aa=$uri;        }    }
    keepalive_timeout  65;

    server {
        listen 80;
        location /test {
                mytest;
        }
    location /echo {
            echo   "hello haohao";
    }
    }
}

[root@haoning html]# 

config
[root@haoning echo]# cat config 
ngx_addon_name=ngx_http_echo_module
HTTP_MODULES="$HTTP_MODULES ngx_http_echo_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_echo_module.c $ngx_addon_dir/haolog.c"
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/haolog.h"
CORE_LIBS="$CORE_LIBS -lpcre"
[root@haoning echo]# 

termlib.js的调用
[root@haoning termlib]# cat index.html 

<html>
<head>
        <title>termlib Chrome Sample</title>
        <link rel=stylesheet  type=text/css href="termlib.css">
        <script language="JavaScript" type="text/javascript" src="termlib.js"></script>
        <script language="JavaScript" type="text/javascript" src="../jquery.min.js"></script>

<script language="JavaScript" type="text/javascript">
<!--
function ajaxtest(){
        $.ajax({
            type: "GET",
            url: "../echo?ls%20-l",
            success: function (data) {
                $("#haotest").html("this data:"+data);
            },
            error: function (msg) {
                alert(msg);
            }
        });
}
var term = new Array();

function termOpen(n) {
        if (termToSet) return; // do not open while there is modal dialog
        n = parseInt(n);
        if ((!n) || (isNaN(n))) n = 1;
        var termid = 'terminal'+n;
        if (!term[n]) {
                term[n] = new Terminal(
                        {
                                x: 0,
                                y: 0,
                                id: n,
                                termDiv: 'termDiv'+n,
                                frameWidth: 1,
                                frameColor: '#aaaaaa',
                                bgColor: '#eeeeee',
                                greeting: 'Terminal ready.',
                                handler: termHandler,
                                exitHandler: termChromeHide
                        }
                );
                term[n].colorsetting=1;
                if (term[n]) {
                        termChromeShow(n);
                        term[n].open();
                }
        }
        else if (term[n].closed) {
                termSetChromeState(n, true);
                termChromeShow(n);
                term[n].open();
        }
        else {
                termSetChromeState(n, true);
        }
        termBringToFront(n);
}
function dump_obj(myObject) { //hao
  var s = "";  
  for (var property in myObject) {  
   s = s + "\n "+property +": " + myObject[property] ;  
  }  
  return s; 
}  
function termHandler() {//hao
        this.newLine();
        var line = this.lineBuffer;
        if (line != '') {
                if (line == 'exit'){
            this.close();
                }else{ 
            var obj=this;
            $.ajax({
                type: "GET",
                url: "../echo?"+line,
                async:false,
                success: function (data) { 
                   $("#haotest").html("this data:"+data);
                   //obj.type(data);//hao
                   obj.write(data);//hao
                },
                error: function (msg) {
                  // obj.write(dump_obj(msg)); 
                   $("#haotest").html("this error:"+dump_obj(msg));
                }
             });
        }
        }
        this.prompt();
}

function termSetChromeState(n, v) {
        var header = 'termHeader'+n;
        var classname = (v)? 'termHeaderActive':'termHeaderInactive';
        if (document.getElementById) {
                var obj = document.getElementById(header);
                if (obj) obj.className = classname;
        }
        else if (document.all) {
                var obj = document.all[header];
                if (obj) obj.className = classname;
        }

}

function termChromeShow(n) {
        var div = 'terminal'+n;
        TermGlobals.setElementXY(div, 210+n*20, 30+n*20);
        TermGlobals.setVisible(div,1);
        if (document.getElementById) {
                var obj = document.getElementById(div);
                if (obj) obj.className = 'termShow';
        }
        else if (document.all) {
                var obj = document.all[div];
                if (obj) obj.className = 'termShow';
        }
}

function termChromeHide() {
        var div='terminal'+this.id;
        TermGlobals.setVisible(div,0);
        if (document.getElementById) {
                var obj = document.getElementById(div);
                if (obj) obj.className = 'termHidden';
        }
        else if (document.all) {
                var obj = document.all[div];
                if (obj) obj.className = 'termHidden';
        }
        if (termToSet==this.id) closeSettings(0);
}

function termClose(n) {
        if ((term[n]) && (term[n].closed == false)) term[n].close();
}

function termBringToFront(n) {
        for (var i=1; i<term.length; i++) {
                if ((n!=i) && (term[i])) {
                        var obj=(document.getElementById)? document.getElementById('terminal'+i):document.all['terminal'+i];
                        if (obj) obj.style.zIndex=1;
                        termSetChromeState(i, false);
                }
        }
        var obj=(document.getElementById)? document.getElementById('terminal'+n):document.all['terminal'+n];
        if (obj) obj.style.zIndex=2;
        termSetChromeState(n, true);
        term[n].focus();
}

var termToSet=0;

function termConfigure(n) {
        var t=term[n];
        if (parseFloat(t.version)<1.03) {
                alert('This utility requires termlib.js 1.03 or better.');
                return;
        }
        var color = t.colorsetting;
        termToSet = n;
        var f=document.forms.settingvalues;
        f.rows.value=t.conf.rows;
        f.cols.value=t.conf.cols;
        f.color[color-1].checked=true;
        var div='settingsdialog';
        TermGlobals.setVisible(div,1);
        if (document.getElementById) {
                var obj = document.getElementById(div);
                if (obj) obj.className = 'termShow';
        }
        else if (document.all) {
                var obj = document.all[div];
                if (obj) obj.className = 'termShow';
        }
        var td='terminal'+n;
        objs = (document.getElementById)? document.getElementById(td):document.all[td];
        if (obj) TermGlobals.setElementXY(div, parseInt(objs.style.left)+26, parseInt(objs.style.top)+26);
        TermGlobals.keylock=true;
}

function closeSettings(state) {
        var t=term[termToSet];
        if (state) {
                var f=document.forms.settingvalues;
                var color = 1
                if (f.color[1].checked) color=2
                else if (f.color[2].checked) color=3
                else if (f.color[3].checked) color=4;
                var rows = parseInt(f.rows.value);
                var cols = parseInt(f.cols.value);
                if ((isNaN(rows)) || (rows<2) || (isNaN(cols)) || (cols<4)) {
                        rows=t.conf.rows;
                        cols=t.conf.cols;
                }
                var changed=((rows==t.conf.rows) && (cols==t.conf.cols) && (color==t.colorsetting))? false:true;
                t.colorsetting=color;
                var rstring= 'New Settings: Terminal set to '+rows+' rows, '+cols+' cols, ';
                if (color==1) {
                        t.conf.bgColor='#eeeeee';
                        t.conf.fontClass='term';
                        rstring+='black on white.';
                }
                else if (color==2) {
                        t.conf.bgColor='#181818';
                        t.conf.fontClass='term2';
                        rstring+='white on black.';
                }
                else if (color==3) {
                        t.conf.bgColor='#181818';
                        t.conf.fontClass='term3';
                        rstring+='green on black.';
                }
                else if (color==4) {
                        t.conf.bgColor='#779977';
                        t.conf.fontClass='term4';
                        rstring+='black on green.';
                }
                if (changed) {
                        t.cursorOff();
                        t.conf.rows=t.maxLines=rows;
                        t.conf.cols=t.maxCols=cols;
                        t.rebuild();
                        t.newLine();
                        t.write(rstring);
                        t.prompt();
                }
        }
        var div='settingsdialog';
        TermGlobals.setVisible(div,0);
        if (document.getElementById) {
                var obj = document.getElementById(div);
                if (obj) obj.className = 'termHidden';
        }
        else if (document.all) {
                var obj = document.all[div];
                if (obj) obj.className = 'termHidden';
        }
        termToSet = 0;
        TermGlobals.keylock=false;
}

function settingsSetColor(n) {
        document.forms.settingvalues.elements.color[n-1].checked=true;
}

// simple drag & drop

var dragobject=null;
var dragOfsX, dragOfsY;
var lastX, lastY;

function drag(e) {
        if (dragobject!=null) {
                if (window.event) e = window.event;
                var x = (typeof e.clientX != 'undefined')? e.clientX:e.pageX;
                var y = (typeof e.clientY != 'undefined')? e.clientY:e.pageY;
                dragobject.style.left=x+dragOfsX-lastX;
                dragobject.style.top=y+dragOfsY-lastY;
        }
}

function dragStart(e) {
        if (window.event) e = window.event;
        lastX = (typeof e.clientX != 'undefined')? e.clientX:e.pageX;
        lastY = (typeof e.clientY != 'undefined')? e.clientY:e.pageY;
}

function dragTerm(n) {
        termBringToFront(n)
        var div='terminal'+n;
        dragobject = (document.getElementById)? document.getElementById(div):document.all[div];
        dragOfsX = parseInt(dragobject.style.left);
        dragOfsY = parseInt(dragobject.style.top);
}

function dragRelease(e) {
        dragobject=null;
}

document.onmousemove=drag;
document.onmouseup=dragRelease;
document.onmousedown=dragStart;

//-->
</script>

<style type="text/css">

</style>
</head>


<body bgcolor="#222222" link="#77dd11" text="#cccccc" alink="#eeeeee" vlink="#77dd11"
topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0">

<table border="0" cellspacing="20" cellpadding="0">
        <tr valign="top"><td nowrap>
        <br>&nbsp;
        </td>
        </tr>
        <tr><td nowrap>
                <a href="javascript:termOpen(1)" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 1'; return true" onmouseout="window.status=''; return true" class="termopen">&gt; open terminal 1 &nbsp;</a>
        </td></tr>
        <tr><td nowrap>
                <a href="javascript:termOpen(2)" onfocus="if(this.blur)this.blur();" onmouseover="window.status='terminal 1'; return true" onmouseout="window.status=''; return true" class="termopen">&gt; open terminal 2 &nbsp;</a>
        </td></tr>
        <tr><td nowrap>
                &nbsp;
        </td></tr>
</table>

<div id="terminal1" style="position:absolute; visibility: hidden; z-index:1" class="termHidden"><table class="termOuterChrome" onmouseup="termBringToFront(1)" cellpadding="1" cellspacing="0"><tr><td><table class="termInnerChrome" cellpadding="0" cellspacing="0">
        <tr><td class="termHeaderActive" onmousedown="dragTerm(1); return false" id="termHeader1">Terminal 1</td></tr>
        <tr><td class="termMenuPane"><a href="javascript:termClose(1)" onfocus="if(this.blur)this.blur();" class="termMenu">Close</a><a href="javascript:termConfigure(1)" onfocus="if(this.blur)this.blur();" class="termMenu">Settings</a></td></tr>
        <tr><td class="termBody"><div id="termDiv1" style="position:relative;"></div></td></tr>
</table></td></tr>
</table></div>

<div id="terminal2" style="position:absolute; visibility: hidden; z-index:2" class="termHidden"><table class="termOuterChrome" onmouseup="termBringToFront(2)" cellpadding="1" cellspacing="0"><tr><td><table class="termInnerChrome" cellpadding="0" cellspacing="0">
        <tr><td class="termHeaderActive" onmousedown="dragTerm(2); return false" id="termHeader2">Terminal 2</td></tr>
        <tr><td class="termMenuPane"><a href="javascript:termClose(2)" onfocus="if(this.blur)this.blur();" class="termMenu">Close</a><a href="javascript:termConfigure(2)" onfocus="if(this.blur)this.blur();" class="termMenu">Settings</a></td></tr>
        <tr><td class="termBody"><div id="termDiv2" style="position:relative;"></div></td></tr>
</table></td></tr>
</table></div>
<div id="settingsdialog" style="position:absolute; visibility: hidden; z-index:3" class="termHidden"><table class="termOuterChrome" cellpadding="1" cellspacing="0"><tr><td><table class="termInnerChrome" cellpadding="0" cellspacing="0" width="300">
        <tr><td align="center" class="termMenuPane">
                <table borrder="0" cellspacing="0" cellpadding="4" width="260">
                <tr><td align="center" class="settings">Terminal Settings</td></tr>
                <form name="settingvalues" onsubmit="return false">
                <tr><td class="settings">&nbsp;<br><b>Size</b></td></tr>
                <tr><td><table borrder="0" cellspacing="0" cellpadding="2">
                        <tr valign="middle"><td class="settings">Rows:</td><td><input name="rows" type="text" value="" size="4" class="settings"></tr>
                        <tr valign="middle"><td class="settings">Cols:</td><td><input name="cols" type="text" value="" size="4" class="settings"></tr>
                </table></td></tr>
                <tr><td class="settings">&nbsp;<br><b>Color</b></td></tr>
                <tr><td><table borrder="0" cellspacing="0" cellpadding="2">
                        <tr valign="middle"><td><input type="radio" name="color" value="1"></td><td class="settings"><a href="javascript:settingsSetColor(1)" onfocus="if (this.blur) this.blur();" class="settingsLabel">black on white</a></td></tr>
                        <tr valign="middle"><td><input type="radio" name="color" value="2"></td><td class="settings"><a href="javascript:settingsSetColor(2)" onfocus="if (this.blur) this.blur();" class="settingsLabel">white on black</a></td></tr>
                        <tr valign="middle"><td><input type="radio" name="color" value="3"></td><td class="settings"><a href="javascript:settingsSetColor(3)" onfocus="if (this.blur) this.blur();" class="settingsLabel">green on black</a></td></tr>
                        <tr valign="middle"><td><input type="radio" name="color" value="4"></td><td class="settings"><a href="javascript:settingsSetColor(4)" onfocus="if (this.blur) this.blur();" class="settingsLabel">black on green</a></td></tr>
                </table></td></tr>
                </form>
                <tr><td class="settings" align="right" nowrap>&nbsp;<br><a href="javascript:closeSettings(0)" onfocus="if(this.blur)this.blur();" class="uiButton">Cancel</a>&nbsp;<a href="javascript:closeSettings(1)" onfocus="if(this.blur)this.blur();" class="uiButton">Configure</a><br>&nbsp;</td></tr>
                </table>
</table></td></tr>
</table></div>
<input type="button" onclick="ajaxtest()" value="test"/>
<div id="haotest"></div>
</body>
</html>
[root@haoning termlib]# 

  • 大小: 123 KB
分享到:
评论

相关推荐

    海康威视摄像头web端显示方案(Nginx环境测试)

    你需要编辑这个文件以添加RTSP流处理模块,使Nginx能够处理来自海康威视摄像头的RTSP视频流。 - 添加一个location块来指定RTSP源,并配置代理_pass到适当的RTSP服务器。 2. **RTSP协议**: - RTSP(Real Time ...

    nginx推流的配置

    以压缩包文件`nginx-1.15.2-rtmp`为例,这通常包含了编译好的Nginx源码以及RTMP模块。解压后,根据系统环境进行编译安装,确保在编译时包含RTMP模块。例如: ```bash ./configure --prefix=/usr/local/nginx --with...

    FFmpeg+Nginx转流相关文件

    4. **触发FFmpeg转流**:当Nginx接收到新的RTMP流时,可以使用系统调用或者定时任务启动FFmpeg脚本,开始转流过程。 5. **客户端播放**:客户端通过HTTP请求获取HLS或DASH的播放列表和媒体片段,播放器根据网络条件...

    dubbo、zookeeper、nginx服务中间件面试题.pdf

    2. **Consumer**: 服务消费者,负责调用远程服务,它在启动时会订阅所需的服务,从而获取服务提供者的地址列表。 3. **Registry**: 注册中心,是服务提供者和服务消费者之间的桥梁,它负责存储服务提供者的信息,并...

    docker swarm 20.10.17 + portainer-ce 2.14.2 + nginx 1.23.1 离线包

    Nginx以其高效的并发处理能力、低内存占用和丰富的模块生态系统而闻名。在容器环境中,Nginx可以作为前端服务器,接收并分发HTTP请求到后端应用服务,或者作为反向代理,隐藏内部服务的细节,提高系统的安全性和可...

    dubboss, 整合dubbo netty spring mvc nginx,作为一个分布式RESTful服务发布.zip

    1. **Dubbo**: Dubbo是阿里巴巴开源的一款高性能、轻量级的Java远程服务调用框架。它提供了服务注册与发现、负载均衡、容错处理、监控等能力,使得服务间的通信变得简单。在本项目中,Dubbo作为服务治理的核心,负责...

    lua+nginx动态更新配置.zip

    在lua+nginx的场景下,可能包含与Lua脚本交互的部分,如定义lua模块路径或者调用lua脚本来动态加载配置。 5. **`动态更新配置.docx`**: 这可能是对如何实现lua+nginx动态更新配置的文档说明,包括步骤、示例代码或...

    curl-7.39.0.tar.gz Nginx中curl扩展库

    5. **配置Nginx模块**:在Nginx的配置文件中,可以通过写入自定义的C代码或者使用ngx_curl_module这样的第三方模块来调用libcurl的功能。 6. **安全和性能**:在Nginx中使用curl扩展库时,要注意安全性和性能。比如...

    海康威视摄像头对接方案开发包.zip

    7. **搭建流媒体服务器.md**:这份文档可能详细介绍了如何配置Nginx和Nginx-RTMP模块,搭建一个流媒体服务器,包括安装步骤、配置参数以及可能出现的问题和解决方案。 通过以上分析,这个开发包提供了一套完整的...

    Nginx服务器上搭建图片缓存服务的基本配置解析

    由于图片量比较大,和web服务器(也是nginx)分开运行,虽然web服务器调用图片没用问题,但毕竟是远程调用,肯定没有本地文件系统那么快,因此仍然有优化的空间。 proxy_store 使用前的nginx配置 location ~* ^.+\....

    毕业设计-一个基于B/S架构及分布式的在线慕课平台-SprintBoot javaweb

    项目整体基于SprintBoot 2.1.5,模块间的通信基于**Protobuf**作为通信协议、**GRPC**作为远程调用服务,使用Spring AOP和 log4j2作为日志系统,包括实现了基于Redis缓存的单点登录系统,基于Netty、Protobuf、...

    nServer-v2.1023[FTP + MYSQL + HTTP + PHP(FCGI)]

    - 更新Nginx1.2.4集成nginx_concat_module模块,多文件合并功能 2012年10月22日 - 更新PHP版本为5.4.8和5.3.18 - 更新MySQL版本为5.5.28 - 加入php-xdebug支持,版本2.2.1 2012年10月15日 - 修正php5.2启动错误 ...

    SOAP-Transport-HTTP-Nginx-开源

    XMLRPC::Lite主要用于XML-RPC(Remote Procedure Call),一个简单的基于HTTP的远程调用协议,而SOAP::Lite则扩展了这个功能,支持更复杂的SOAP规范。 Nginx作为HTTP服务器,通常被用作Web服务的前端,负责接收...

    毕业设计基于树莓派开发的远程监控系统源码+详细项目说明.zip

    如果要广域网使用,需要我们在php里面解禁pcntl_exec这个函数,应为在远程命令中调用服务器的shell命令是非常不安全的,咱们是需要再网页中进行对舵机的控制,需要引用RPi.GPIO模块,对舵机参数的控制还需要引用...

    ansible配置详解1

    其中,HOST_PATTERN指明对哪些被管控主机进行操作,­f FORKS表示一批处理几台主机,­m MOD_NAME指明调用哪个模块执行操作,­a MOD_ARGS指明使用该模块的执行操作时的参数。 Ansible常用模块包括command模块、...

    PHP基于Linux的远程管理系统服务器端的实现(源代码+论文).zip

    在Linux服务器端,PHP可以利用各种系统调用和库来实现远程管理功能。例如,通过SSH(Secure Shell)协议进行远程命令执行,使用SFTP(Secure File Transfer Protocol)进行文件传输,使用syslog接口收集系统日志,...

    net core的微服务

    在这种情况下,开发者可能会考虑使用gRPC,这是一个高性能的开源远程过程调用(RPC)框架,它基于HTTP/2协议,并且支持.proto协议缓冲区进行序列化,能提供更好的性能和安全性。 4. **文件名称列表:Nginx** - 这个...

    基于Spring Cloud微服务+Java+Node.js+MySQL的家庭投资理财系统.zip

    通过远程调用、消息队列、定时任务、缓存中间件技术,实现了家庭月、年理财状况的实时消息推送,其中包含了对用户当月/年的收支分析、增长趋势、资产负债状况、股市/基金关注情况的分析与记录。采用了IntelliJ IDEA...

    海康威视javaB/S外网预览附件包

    4. **Nginx-RTMP模块**:nginx-rtmp-win32-master.zip包含的是Nginx的一个扩展模块,用于支持Real-Time Messaging Protocol(RTMP)。RTMP是一种实时流协议,常用于在线视频直播。Nginx RTMP服务器可以接收并分发...

Global site tag (gtag.js) - Google Analytics