示例#1
0
if loc.message:
    message = loc.message

### service ####
service = Service("snort", req['host'])
if req["service_action"] == "stop":
    message += service.stop()
if req["service_action"] == "start":
    message += service.start()
if req["service_action"] == "reload":
    message += service.reload()

### render html #####

### <html><head>--</head> ####
renderHead(loc.str('menu_snort'), "", "")

print("<body onLoad='setRefreshTimerAndScroll(" + req["refresh"] + "," + req["y_scroll"] + ")'>")

Menu(req['tab_id'], loc).render()

### form (hidden params) #####
params = { 
    'refresh':req["refresh"], 'y_scroll':'0', 'tab_id': req['tab_id']
}
HtmlForm("form1", "snort_ctl.py", "POST", params).render()

print("<div id='header'>")
print("<table style='margin-bottom: 0px;'><tr>")
print("<td style='border: 0;'><h3>"  + loc.str('snort_title') + "(" + req['host'] + ")</h3></td>")
示例#2
0
### get new log #########
httpLog = HaproxyHttpLog(req['host'])

if service.state == "running":

    ### get stats ######
    st = HaproxyStats(req['host'])
    socket_output = ""
    if req["socket_command"]:
        socket_output = st.socketCommand(req["socket_command"])
    stats = st.getStats()

### render html #####

### <head>--</head> ####
renderHead(loc.str('menu_haproxy'), "", "haproxy.js")

print("<body onLoad='setRefreshTimerAndScroll(" + req["refresh"] + "," + req["y_scroll"] + ")'>")

Menu(req['tab_id'], loc).render()

### form (hidden params) #####
params = { 
    'refresh':req["refresh"], 'editServer':'none', 'service_action':'none', 'addServer':'none',
    'delServer':'none', 'weightServer':'none', 'y_scroll':'0', 'socket_command':'', 'save':'no',
    'host':req['host'], 'tab_id':req['tab_id']
}
HtmlForm("form1", "haproxy_ctl.py", "POST", params).render()

print("<div id='header'>")
print("<table style='margin-bottom: 0px;'><tr>")
示例#3
0
文件: index.py 项目: ryobot/misctl
    'lang':"ja", 'tab_id': "-99"
}
for key in req.keys():
    if form.has_key(key):
        req[key] = form[key].value

loc = Localize(req['lang'])
if loc.message:
    message = loc.message

menu = Menu(req['tab_id'], loc)

### render html #####

### <html><head>--</head> ####
renderHead(loc.str('menu_index'), "", "")

print("<body>")

menu.render()

### form (hidden params) #####
params = {
    'tab_id': req['tab_id']
}
HtmlForm("form1", "index.py", "POST", params).render()

print("<div id='header'>")
print("<table style='margin-bottom: 0px;'><tr>")
print("<td style='border: 0;'><h3>"  + loc.str('index_title') + "</h3></td>")
示例#4
0
        menu.items.append(item);
        menu.save();
        menu = Menu(req['tab_id'], loc)

if req['config_action'] == "do_auth":
    if req['service_id'] != "none" and req['passwd'] != "":
        (ret, msg) = Ssh(menu.items[int(req['service_id'])].host).doAuth(req['passwd'])
        if ret:
            message += "SSH key not authenticated on remote host. " + msg

menu.sshAuthCheck()

### render html #####

### <html><head>--</head> ####
renderHead(loc.str('menu_config'), "", "webadmin_config.js")

print("<body>")

menu.render()

### form (hidden params) #####
params = { 
    'tab_id' : req['tab_id'], 'config_action': 'none', 'service_id': '-1', 'passwd': ''
}
HtmlForm("form1", "webadmin_config.py", "POST", params).render()

print("<div id='header'>")
print("<table style='margin-bottom: 0px;'><tr>")
print("<td style='border: 0;'><h3>"  + loc.str('config_title') + "</h3></td>")
示例#5
0
    (ret,content) = ssh.commandAsRoot(com)
    if ret == 0 and content:
        message = ""
        lines = content.splitlines()
        for i in range(1,len(lines)):
            message += lines[i] + "<br>"
    else:
        if ret != 0:
            message = "[error] Command failed."
        else:
            message = "[no output]"

### render html #####

### <html><head>--</head> ####
renderHead(loc.str('menu_remote'), "", "remote.js")

print("<body onLoad='focusInput()'>")

Menu(req['tab_id'], loc).render()

### form (hidden params) #####
params = { 
    'refresh':req["refresh"], 'y_scroll':'0', 'tab_id': req['tab_id'], 'host': req['host']
}
HtmlForm("form1", "remote_ctl.py", "POST", params).render()

print("<div id='header'>")
print("<table style='margin-bottom: 0px;'><tr>")
print("<td style='border: 0;'><h3>"  + loc.str('remote_title') + "(" + req['host'] + ")</h3></td>")