本文整理汇总了Python中skaldship.hosts.host_title_maker函数的典型用法代码示例。如果您正苦于以下问题:Python host_title_maker函数的具体用法?Python host_title_maker怎么用?Python host_title_maker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了host_title_maker函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: service_vulns_add
def service_vulns_add():
if request.vars.has_key('service'):
svc = db.t_services[request.vars.service] or redirect(URL('default', 'error', vars={'msg': T('Service record not found')}))
svc_id = [svc.id, "%s :: %s/%s" % (host_title_maker(db.t_hosts[svc.f_hosts_id]), svc.f_proto, svc.f_number)]
else:
svc_id = None
if request.vars.has_key('host'):
# grab services for a host
host_id = db.t_hosts[request.vars.host] or redirect(URL('default', 'error', vars={'msg': T('Host record not found')}))
services = db(db.t_services.f_hosts_id == host_id.id).select()
svc_set = []
for svc in services:
svc_set.append([svc.id, "%s :: %s/%s" % (host_title_maker(db.t_hosts[svc.f_hosts_id]), svc.f_proto, svc.f_number)])
else:
host_id = None
if svc_id or host_id:
if svc_id:
db.t_service_vulns.f_services_id.default = svc_id
response.title = "%s :: Add Service Vulnerablity :: %s" % (settings.title, svc)
else:
db.t_service_vulns.f_services_id.requires = IS_IN_SET(svc_set)
response.title = "%s :: Add Service Vulnerablity :: %s" % (settings.title, host_title_maker(db.t_hosts[svc.f_hosts_id]))
form=crud.create(db.t_service_vulns,message='Vulnerability added',next=URL('service_vulns_add', vars={'id': svc.id}))
db.t_service_vulns.f_services_id.requires = None
response.title = "%s :: Add Service Vulnerablity :: %s" % (settings.title, host_title_maker(db.t_hosts[svc.f_hosts_id]))
else:
form=crud.create(db.t_service_vulns,next='service_vulns_edit/[id]')
response.title = "%s :: Add Service Vulnerablity" % (settings.title)
return dict(form=form)
示例2: edit
def edit():
record = db.t_accounts(request.args(0)) or redirect(URL('default', 'error', vars={'msg': T('Account record not found')}))
service = db(db.t_services.id == record.f_services_id).select().first()
services = db(db.t_services.f_hosts_id == service.f_hosts_id).select()
svc_set = []
for svc in services:
svc_set.append([svc.id, "%s :: %s/%s" % (host_title_maker(db.t_hosts[svc.f_hosts_id]), svc.f_proto, svc.f_number)])
db.t_accounts.f_services_id.requires = IS_IN_SET(svc_set)
form=crud.update(db.t_accounts,record,next='edit/[id]',
ondelete=lambda form: redirect(URL('list')))
db.t_accounts.f_services_id.requires = None
hosttitle = "%s :: %s/%s" % (host_title_maker(db.t_hosts[service.f_hosts_id]), service.f_proto, service.f_number)
response.title = "%s :: Update Account :: %s :: %s" % (settings.title, record.f_username, hosttitle)
return dict(form=form)
示例3: edit
def edit():
record = db.t_evidence(request.args(0)) or redirect(
URL("default", "error", vars={"msg": T("Evidence record not found")})
)
response.title = "%s :: Evidence Update :: %s" % (settings.title, host_title_maker(db.t_hosts[record.f_hosts_id]))
form = crud.update(db.t_evidence, record, next="edit/[id]", ondelete=lambda form: redirect(URL("list")))
return dict(form=form)
示例4: by_host
def by_host():
"""
Returns a list of OS records based upon an host identifier
(id, ipv4, ipv6)
"""
if request.args(0) is None: redirect(URL('default', 'error', vars={'msg': T('Host record not found')}))
record = get_host_record(request.args(0))
if record is None:
redirect(URL('default', 'error', vars={'msg': T('Host record not found')}))
response.title = "%s :: SNMP Records for %s" % (settings.title, host_title_maker(record))
snmplist = db(db.t_snmp.f_hosts_id==record.id).select()
aaData = []
if request.extension == "json":
for snmp in snmplist:
# datatables json requires aaData to be specificly formatted
aaData.append({
'0': A("edit", _target="snmp_update_%s" % (snmp.id), _href=URL('edit',extension='html',args=snmp.id)).xml(),
'1': snmp.f_community,
'2': snmp.f_version,
'3': snmp.f_access,
'DT_RowId': snmp.id,
})
result = { 'sEcho': request.vars.sEcho,
'iTotalRecords': len(aaData),
'aaData': aaData,
}
return result
form = TABLE(THEAD(TR(TH(T('ID'), _width="5%"),
TH(T('Community')),
TH(T('Version')),
TH(T('Access')),
) ),
_class="datatable",
_id="snmptable",
_style="width:100%")
add = AddModal(
db.t_snmp, 'Add', 'Add', 'Add SNMP String',
fields=[ 'f_community', 'f_version', 'f_access'],
cmd='snmptable.fnReloadAjax();'
)
db.t_snmp.f_hosts_id.default = record.id
db.t_snmp.id.comment = add.create()
return dict(form=form, host=record, add=add)
示例5: add
def add():
if request.vars.has_key('id'):
host_id = db.t_hosts[request.vars.id] or redirect(URL('default', 'error', vars={'msg': T('Host record not found')}))
else:
host_id = None
if host_id:
# grab services for a host
services = db(db.t_services.f_hosts_id == host_id.id).select(cache=(cache.ram,30))
svc_set = []
for svc in services:
svc_set.append([svc.id, "%s :: %s/%s" % (host_title_maker(db.t_hosts[svc.f_hosts_id]), svc.f_proto, svc.f_number)])
db.t_accounts.f_services_id.requires = IS_IN_SET(svc_set)
form=crud.create(db.t_accounts,message='Account added',next=URL('accounts_create', vars={'id': host_id.id}))
db.t_accounts.f_services_id.requires = None
else:
form=crud.create(db.t_accounts, next='edit/[id]',message="Account added")
cache.ram.clear('accounts_list')
response.title = "%s :: Add Account" % (settings.title)
return dict(form=form)
示例6: summary_by_host
def summary_by_host():
"""
Returns a list of notes records based upon an host identifier
(id, ipv4, ipv6)
"""
if request.args(0) is None: redirect(URL('default', 'error', vars={'msg': T('No host record provided')}))
record = get_host_record(request.args(0))
if record is None:
redirect(URL('default', 'error', vars={'msg': T('Host record not found')}))
response.title = "%s :: Notes for host %s" % (settings.title, host_title_maker(record))
rows = db(db.t_host_notes.f_hosts_id == record.id)(db.t_host_notes).select(db.t_host_notes.id, db.t_host_notes.f_note)
aaData = []
if request.extension == "json":
for r in rows:
# datatables json requires aaData to be specificly formatted
atxt = []
atxt.append('<a href="javascript:void()" onclick="delnotes_summ(' + str(r.id) +')">X</a>')
atxt.append(r.f_note)
# add columns after this, don't do anything prior since it'll affect the hidden fields
aaData.append(atxt)
result = { 'sEcho': request.vars.sEcho,
'iTotalRecords': len(aaData),
'aaData': aaData,
}
return result
notes = TABLE(THEAD(TR(TH(T('[X]'), _width="5%"),
TH(T('Note'), _width="90%"),
), _style="display:none" ),
_class="table table-condensed", _id="notestable_summary", _style="width:100%")
return dict(notes=notes)
示例7: popover
def popover():
"""
Returns the detail of a host for popovers
"""
host_rec = get_host_record(request.args(0))
resp = {}
if not host_rec:
resp['title'] = "Host not found"
resp['content'] = ""
else:
svcs = host_rec.t_services
svc_cnt = 0
vuln_cnt = 0
acct_cnt = 0
for svc in svcs.select():
svc_cnt += 1
vuln_cnt += svc.t_service_vulns.count()
acct_cnt += svc.t_accounts.count()
host_os = (0, 'Unknown')
for os_rec in host_rec.t_host_os_refs.select():
if os_rec.f_certainty > host_os[0]:
host_os = (os_rec.f_certainty, db.t_os[os_rec.f_os_id].f_title)
resp['title'] = host_title_maker(host_rec)
resp['content'] = XML(TABLE(
TR(TD(T('Asset Group')), TD(host_rec.f_asset_group)),
TR(TD(T('Engineer')), TD(db.auth_user[host_rec.f_engineer].username)),
TR(TD(T('OS')), TD("%s (%s)" % (host_os[1], host_os[0]))),
TR(TD(T('Services')), TD(svc_cnt), _class="success"),
TR(TD(T('Vulnerabilities')), TD(vuln_cnt), _class="error"),
TR(TD(T('Accounts')), TD(acct_cnt), _class="warning"),
_class="table table-condensed",
))
return resp
示例8: refs_edit
def refs_edit():
record = db.t_host_os_refs(request.args(0)) or redirect(URL('default', 'error', vars={'msg': T('OS Reference record not found')}))
form=crud.update(db.t_host_os_refs,record,next='refs_edit/[id]',
ondelete=lambda form: redirect(URL('refs_list')))
response.title = "%s :: OS for Host %s" % (settings.title, host_title_maker(db.t_hosts(record.f_hosts_id)))
return dict(form=form)
示例9: edit
def edit():
record = db.t_host_notes(request.args(0)) or redirect(URL('default', 'error', vars={'msg': T('Note record not found')}))
response.title = "%s :: Update Host Note :: %s" % (settings.title, host_title_maker(db.t_hosts[record.f_hosts_id]))
form=crud.update(db.t_host_notes,record,next='edit/[id]',
ondelete=lambda form: redirect(URL('list')))
return dict(form=form)
示例10: by_host
def by_host():
"""
Returns a list of services + serviceinfo based upon an host identifier
(id, ipv4, ipv6)
"""
record = get_host_record(request.args(0))
if record is None:
redirect(URL("default", "error", vars={"msg": T("Host record not found")}))
response.title = "%s :: Accounts for %s" % (settings.title, host_title_maker(record))
query = db.t_services.f_hosts_id == record.id
if request.extension == "json":
aaData = []
rows = db(query).select(
db.t_accounts.ALL, db.t_services.ALL, left=db.t_services.on(db.t_accounts.f_services_id == db.t_services.id)
)
for r in rows:
if r.t_accounts.f_compromised == True:
comprdiv = (
'<div class="acct_compromised" name="row_id" id="%s"><span class="icon-check"></span></div>'
% r.t_accounts.id
)
else:
comprdiv = '<div class="acct_uncompromised" name="row_id" id="%s"/>' % r.t_accounts.id
aaData.append(
{
"0": A(
"edit",
_target="accounts_update_%s" % (r.t_accounts.id),
_href=URL("accounts", "edit", args=[r.t_accounts.id], extension="html"),
).xml(),
"1": comprdiv,
"2": A(
"%s/%s" % (r.t_services.f_proto, r.t_services.f_number),
_target="services_edit_%s" % (r.t_services.id),
_href=URL("services", "edit", args=[r.t_services.id], extension="html"),
).xml(),
"3": A(
r.t_accounts.f_username,
_target="accounts_username_%s" % (r.t_accounts.f_username),
_href=URL(
"accounts", "by_username", vars={"username": r.t_accounts.f_username}, extension="html"
),
).xml(),
"4": r.t_accounts.f_fullname,
"5": r.t_accounts.f_password,
"6": r.t_accounts.f_hash1_type,
"7": r.t_accounts.f_hash1,
"8": r.t_accounts.f_hash2_type,
"9": r.t_accounts.f_hash2,
"10": r.t_accounts.f_uid,
"11": r.t_accounts.f_gid,
"12": r.t_accounts.f_lockout,
"13": r.t_accounts.f_duration,
"14": r.t_accounts.f_source,
"15": r.t_accounts.f_level,
"16": r.t_accounts.f_description,
"DT_RowId": r.t_accounts.id,
}
)
result = {"sEcho": request.vars.sEcho, "iTotalRecords": len(aaData), "aaData": aaData}
return result
form = TABLE(
THEAD(
TR(
TH(T(""), _width="5%"),
TH(T("Compr"), _width="5%"),
TH(T("Port")),
TH(T("Username")),
TH(T("Fullname")),
TH(T("Password")),
TH(T("Hash 1 Type")),
TH(T("Hash 1")),
TH(T("Hash 2 Type")),
TH(T("Hash 2")),
TH(T("UID")),
TH(T("GID")),
TH(T("Lockout")),
TH(T("Duration")),
TH(T("Source")),
TH(T("Level")),
TH(T("Description")),
)
),
_class="datatable",
_id="accounttable",
_style="width:100%",
)
add = AddModal(
db.t_accounts,
"Add",
"Add",
"Add Account",
# fields=[],
cmd="accounttable.fnReloadAjax();",
#.........这里部分代码省略.........
示例11: purge_data
def purge_data():
# Purges all the data except user tables
response.title = "%s :: Database Purge" % (settings.title)
users = db(db.auth_user).select()
userlist = []
for user in users:
userlist.append( [ user.id, user.username ] )
hosts = db(db.t_hosts).select()
hostlist = []
for host in hosts:
hostlist.append( [ host.id, host_title_maker(host) ] )
ag_rows = db(db.t_hosts).select(db.t_hosts.f_asset_group, distinct=True).as_list()
asset_groups = []
for ag in ag_rows:
asset_groups.append(ag['f_asset_group'])
form = SQLFORM.factory(
Field('host', type='list:integer', label=T('Delete a host'), requires=IS_EMPTY_OR(IS_IN_SET(hostlist))),
Field('engineer', type='list:integer', label=T('Hosts by user'), requires=IS_EMPTY_OR(IS_IN_SET(userlist))),
Field('asset_group', type='string', label=T('Asset Group'), requires=IS_EMPTY_OR(IS_IN_SET(asset_groups))),
Field('all_data', type='boolean', label=T('Truncate all tables')),
Field('are_you_sure', type='boolean', label=T('Are you sure?'), requires=IS_NOT_EMPTY(error_message='ARE YOU SURE?!?!')),
)
if form.accepts(request.vars, session):
if not form.vars.are_you_sure:
form.errors.are_you_sure = 'ARE YOU SURE?'
else:
if form.vars.all_data:
db.t_hosts.truncate(mode="CASCADE")
db.t_services.truncate(mode="CASCADE")
db.t_os.truncate(mode="CASCADE")
db.t_host_os_refs.truncate(mode="CASCADE")
db.t_apps.truncate(mode="CASCADE")
db.t_services_apps_refs.truncate(mode="CASCADE")
db.t_service_vulns.truncate(mode="CASCADE")
db.t_service_info.truncate(mode="CASCADE")
db.t_accounts.truncate(mode="CASCADE")
db.t_host_notes.truncate(mode="CASCADE")
db.t_evidence.truncate(mode="CASCADE")
db.t_snmp.truncate(mode="CASCADE")
db.commit()
response.flash = 'All data purged'
elif form.vars.host:
host_id = form.vars.host
del db.t_hosts[host_id]
response.flash = "Host %s purged" % (form.vars.host)
elif form.vars.engineer:
# TODO: Test this
delcnt = db(db.t_hosts.f_engineer == form.vars.engineer).delete()
db.commit()
response.flash = "Hosts owned by %s purged (%d records)" % (form.vars.engineer, delcnt)
elif form.vars.asset_group:
delcnt = db(db.t_hosts.f_asset_group == form.vars.asset_group).delete()
db.commit()
response.flash = "Asset group %s purged (%d records)" % (form.vars.asset_group, delcnt)
elif form.errors:
response.flash = 'Error in form'
return dict(
form=form,
err404=get_oreally_404(request.folder),
)
示例12: by_host
def by_host():
"""
Returns a list of services + serviceinfo based upon an host identifier
(id, ipaddr)
"""
record = get_host_record(request.args(0))
if record is None:
redirect(URL('default', 'error', vars={'msg': T('Host record not found')}))
response.title = "%s :: Accounts for %s" % (settings.title, host_title_maker(record))
query = (db.t_services.f_hosts_id == record.id)
if request.extension == "json":
aaData = []
rows = db(query).select(db.t_accounts.ALL, db.t_services.ALL, left=db.t_services.on(db.t_accounts.f_services_id==db.t_services.id))
for r in rows:
if r.t_accounts.f_compromised == True:
comprdiv = '<div class="acct_compromised" name="row_id" id="%s"><span class="icon-check"></span></div>' % r.t_accounts.id
else:
comprdiv = '<div class="acct_uncompromised" name="row_id" id="%s"/>' % r.t_accounts.id
aaData.append({
'0': A("edit", _target="accounts_update_%s" % (r.t_accounts.id), _href=URL('accounts', 'edit', args=[r.t_accounts.id], extension='html')).xml(),
'1': comprdiv,
'2': A("%s/%s" % (r.t_services.f_proto, r.t_services.f_number), _target="services_edit_%s" % (r.t_services.id), _href=URL('services', 'edit', args=[r.t_services.id], extension='html')).xml(),
'3': A(r.t_accounts.f_username, _target="accounts_username_%s" % (r.t_accounts.f_username), _href=URL('accounts', 'by_username', vars={'username': r.t_accounts.f_username}, extension='html')).xml(),
'4': r.t_accounts.f_fullname,
'5': r.t_accounts.f_password,
'6': r.t_accounts.f_hash1_type,
'7': r.t_accounts.f_hash1,
'8': r.t_accounts.f_hash2_type,
'9': r.t_accounts.f_hash2,
'10': r.t_accounts.f_uid,
'11': r.t_accounts.f_gid,
'12': r.t_accounts.f_lockout,
'13': r.t_accounts.f_duration,
'14': r.t_accounts.f_source,
'15': r.t_accounts.f_level,
'16': r.t_accounts.f_description,
'DT_RowId': r.t_accounts.id,
} )
result = { 'sEcho': request.vars.sEcho,
'iTotalRecords': len(aaData),
'aaData': aaData,
}
return result
form = TABLE(THEAD(TR(TH(T(''), _width="5%"),
TH(T('Compr'), _width="5%"),
TH(T('Port')),
TH(T('Username')),
TH(T('Fullname')),
TH(T('Password')),
TH(T('Hash 1 Type')),
TH(T('Hash 1')),
TH(T('Hash 2 Type')),
TH(T('Hash 2')),
TH(T('UID')),
TH(T('GID')),
TH(T('Lockout')),
TH(T('Duration')),
TH(T('Source')),
TH(T('Level')),
TH(T('Description')),
) ),
_class="datatable",
_id="accounttable",
_style="width:100%")
add = AddModal(
db.t_accounts, 'Add', 'Add', 'Add Account',
#fields=[],
cmd='accounttable.fnReloadAjax();'
)
services = db(db.t_services.f_hosts_id == record.id).select(cache=(cache.ram,30))
svc_set = []
for svc in services:
svc_set.append([svc.id, "%s :: %s/%s" % (host_title_maker(db.t_hosts[svc.f_hosts_id]), svc.f_proto, svc.f_number)])
db.t_accounts.f_services_id.requires = IS_IN_SET(svc_set)
db.t_accounts.id.comment = add.create()
return dict(form=form, host=record, add=add)
示例13: list
def list():
"""
Returns a list of evidence based on a host (id, ipv4, ipv6) or all
"""
import os, string
if request.args(0) is not None:
record = get_host_record(request.args(0))
if record is None:
redirect(URL('default', 'error', vars={'msg': T('Host record not found')}))
response.title = "%s :: Evidence for host %s" % (settings.title, host_title_maker(record))
else:
response.title = "%s :: Evidence listing" % (settings.title)
record = None
aaData = []
if request.extension == "json":
if record is None:
rows = db(db.t_evidence).select(db.t_evidence.id,
db.t_evidence.f_hosts_id,
db.t_evidence.f_type,
db.t_evidence.f_other_type,
db.t_evidence.f_text,
db.t_evidence.f_filename,
db.t_evidence.f_evidence,
db.t_evidence.f_data.len()+1)
else:
rows = db(db.t_evidence.f_hosts_id == record.id).select(db.t_evidence.id,
db.t_evidence.f_hosts_id,
db.t_evidence.f_type,
db.t_evidence.f_other_type,
db.t_evidence.f_text,
db.t_evidence.f_filename,
db.t_evidence.f_evidence,
db.t_evidence.f_data.len()+1)
for r in rows:
atxt = {}
cnt = 0
atxt[cnt] = A('edit', _target="evidence_edit_%s" % (r.t_evidence.id), _href=URL('edit', extension='html', args=r.t_evidence.id)).xml()
cnt += 1
if record is None:
atxt[cnt] = host_a_maker(r.t_evidence.f_hosts_id).xml()
cnt += 1
if r.t_evidence.f_other_type:
atxt[cnt] = "Other: %s" % (r.t_evidence.f_other_type)
else:
atxt[cnt] = r.t_evidence.f_type
cnt += 1
atxt[cnt] = r.t_evidence.f_text
cnt += 1
if r.t_evidence.f_filename is not None:
if string.lower(os.path.splitext(r.t_evidence.f_filename)[1]) in ('.png', '.jpeg', '.jpg', '.gif'):
atxt[cnt] = A(IMG(_src=URL('download', args=[r.t_evidence.f_evidence]), _width="50%", _height="20%"),
_href=URL('download', args=[r.t_evidence.f_evidence]),
_target="evidence_image_%s" % (r.t_evidence.id), _id="evidence_image").xml()
cnt += 1
atxt[cnt] = "%sb" % (r._extra['(LENGTH(t_evidence.f_data) + 1)'])
cnt += 1
else:
atxt[cnt] = A(r.t_evidence.f_filename, _target="evidence_other_%s" % (r.t_evidence.id), _id="evidence_other",
_href=URL('download', args=[r.t_evidence.f_evidence])).xml()
cnt += 1
atxt[cnt] = "%sb" % (r._extra['(LENGTH(t_evidence.f_data) + 1)'])
cnt += 1
else:
atxt[cnt] = r.t_evidence.f_filename
cnt += 1
atxt['DT_RowId'] = r.t_evidence.id
aaData.append(atxt)
return { 'sEcho': request.vars.sEcho,
'iTotalRecords': len(aaData),
'aaData': aaData,
}
if record:
th_rows = (TH(T(''), _width="5%"),
TH(T('Type')),
TH(T('Text')),
TH(T('Evidence')),
TH(T('File Size')),
)
else:
th_rows = (TH(T(''), _width="5%"),
TH(T('Host')),
TH(T('Type')),
TH(T('Text')),
TH(T('Evidence'), _width="35%"),
TH(T('File Size')),
)
evidence = TABLE(THEAD(TR(th_rows)),
_class="datatable",
_id="evidencetable",
_style="width:100%")
return dict(evidence=evidence, host=record)
示例14: list
def list():
"""
Returns a list of evidence based on a host (id, ipv4, ipv6) or all
"""
import os, string
if request.args(0) is not None:
record = get_host_record(request.args(0))
if record is None:
redirect(URL("default", "error", vars={"msg": T("Host record not found")}))
response.title = "%s :: Evidence for host %s" % (settings.title, host_title_maker(record))
else:
response.title = "%s :: Evidence listing" % (settings.title)
record = None
aaData = []
if request.extension == "json":
if record is None:
rows = db(db.t_evidence).select(
db.t_evidence.id,
db.t_evidence.f_hosts_id,
db.t_evidence.f_type,
db.t_evidence.f_other_type,
db.t_evidence.f_text,
db.t_evidence.f_filename,
db.t_evidence.f_evidence,
db.t_evidence.f_data.len() + 1,
)
else:
rows = db(db.t_evidence.f_hosts_id == record.id).select(
db.t_evidence.id,
db.t_evidence.f_hosts_id,
db.t_evidence.f_type,
db.t_evidence.f_other_type,
db.t_evidence.f_text,
db.t_evidence.f_filename,
db.t_evidence.f_evidence,
db.t_evidence.f_data.len() + 1,
)
for r in rows:
atxt = {}
cnt = 0
atxt[cnt] = A(
"edit",
_target="evidence_edit_%s" % (r.t_evidence.id),
_href=URL("edit", extension="html", args=r.t_evidence.id),
).xml()
cnt += 1
if record is None:
atxt[cnt] = host_a_maker(r.t_evidence.f_hosts_id).xml()
cnt += 1
if r.t_evidence.f_other_type:
atxt[cnt] = "Other: %s" % (r.t_evidence.f_other_type)
else:
atxt[cnt] = r.t_evidence.f_type
cnt += 1
atxt[cnt] = r.t_evidence.f_text
cnt += 1
if r.t_evidence.f_filename is not None:
if string.lower(os.path.splitext(r.t_evidence.f_filename)[1]) in (".png", ".jpeg", ".jpg", ".gif"):
atxt[cnt] = A(
IMG(_src=URL("download", args=[r.t_evidence.f_evidence]), _width="50%", _height="20%"),
_href=URL("download", args=[r.t_evidence.f_evidence]),
_target="evidence_image_%s" % (r.t_evidence.id),
_id="evidence_image",
).xml()
cnt += 1
atxt[cnt] = "%sb" % (r._extra["(LENGTH(t_evidence.f_data) + 1)"])
cnt += 1
else:
atxt[cnt] = A(
r.t_evidence.f_filename,
_target="evidence_other_%s" % (r.t_evidence.id),
_id="evidence_other",
_href=URL("download", args=[r.t_evidence.f_evidence]),
).xml()
cnt += 1
atxt[cnt] = "%sb" % (r._extra["(LENGTH(t_evidence.f_data) + 1)"])
cnt += 1
else:
atxt[cnt] = r.t_evidence.f_filename
cnt += 1
atxt["DT_RowId"] = r.t_evidence.id
aaData.append(atxt)
return {"sEcho": request.vars.sEcho, "iTotalRecords": len(aaData), "aaData": aaData}
if record:
th_rows = (TH(T(""), _width="5%"), TH(T("Type")), TH(T("Text")), TH(T("Evidence")), TH(T("File Size")))
else:
th_rows = (
TH(T(""), _width="5%"),
TH(T("Host")),
TH(T("Type")),
TH(T("Text")),
TH(T("Evidence"), _width="35%"),
TH(T("File Size")),
)
#.........这里部分代码省略.........
示例15: read
def read():
record = db.t_snmp(request.args(0)) or redirect(URL('default', 'error', vars={'msg': T('SNMP record not found')}))
response.title = "%s :: SNMP :: %s" % (settings.title, host_title_maker(db.t_hosts[record.f_hosts_id]))
form=crud.read(db.t_snmp,record)
return dict(form=form)