Beispiel #1
0
def netstat_nat_json():
	str=_netstat_nat()
	rows=table.getLines(str)
	tbl=table.makeTable(rows,r"\s*")
	tbl.pop(0)
	js=json.JSONEncoder().encode(tbl)
	return js
Beispiel #2
0
def run():
    str = netstat.netstat_nat()
    rows = table.getLines(str)
    tbl = table.makeTable(rows, r"\s*")
    tbl.pop(0)
    html = []
    open = '<table>'
    close = '</table>'
    html.append(open)
    for row in tbl:
        html.append('<tr>')
        for column in row:
            value = '<td>{}</td>'.format(column)
            html.append(value)
        html.append('</tr>')
    return html
Beispiel #3
0
def ip_conntrack_json():
	str=_ip_conntrack()
	rows=table.getLines(str)
	tbl=table.makeTable(rows,r"\s*")
	tbl_new=[]

	for row in tbl:	
		tmp=ip_conntrack_parse0(row)
		#print "####################################################"
		#print_arr (row )
		#print tmp
		#print "####################################################"
		tbl_new.append(tmp)

	js=json.JSONEncoder().encode(tbl_new)
	return js
Beispiel #4
0
def ip_conntrack():
	str=_ip_conntrack()
	rows=table.getLines(str)
	tbl=table.makeTable(rows,r"\s*")
	html=[]
	open='<table class="netstat">'
	close='</table>'
	html.append(open)
	for row in tbl:
		html.append('<tr>')
		for column in row:		
			value='<td>{}</td>'.format(column)
			html.append(value)
		html.append('</tr>')
	ret='\n'.join(html)
	return ret