コード例 #1
0
 def index_template(self):
     title='SHIVA honeypot: mainpage'
     start = 0
     count = 10
     overview_list=backend_operations.get_overview(start,count)
     learning_overview_list=backend_operations.get_learning_overview(5)
     
     total_mails = backend_operations.get_mail_count()
     today_mails = backend_operations.get_mail_count_for_date(datetime.date.today(), datetime.date.today() + datetime.timedelta(days=1))
     
     uptime_str = 'uknown'
     uptime = time.time() - self.startup_time if self.startup_time else 0
     if uptime > 0:
         days, remainder = divmod(uptime, 24 * 60 * 60)
         hours, remainder = divmod(remainder, 60 * 60)
         minutes, _ = divmod(remainder, 60) 
         uptime_str = "{:.0f} days {:.0f} hours {:.0f} minutes".format(days,hours,minutes)
     
     
     template = Template('<%include file="index.html"/>', lookup=self.template_lookup, output_encoding='utf-8', encoding_errors='replace')
     return template.render(title=title, overview_list=overview_list, start=start,count=count,report_overview=learning_overview_list, uptime=uptime_str, total_mails=total_mails, today_mails=today_mails)
コード例 #2
0
 def learning(self):
     return self.learning_template(backend_operations.get_learning_overview())