- from flask import Flask, render_template, send_from_directory
- import os
- import socket
- import cPickle
- app = Flask(__name__)
- def dir_check(addr):
- if not os.path.exists('/home/pronto/scripts/flask/static/IPs/'+addr):
- os.makedirs('/home/pronto/scripts/flask/static/IPs/'+addr)
- def scapy_svg(addr):
- if os.path.isfile('/home/pronto/scripts/flask/static/IPs/'+addr+'/trace.svg'):
- return (addr, "http://vps2.pronto185.com/static/IPs/"+addr+"/trace.svg")
- @app.route('/newfail')
- def newfail2():
- ip_list=cPickle.load(open("/home/pronto/logs/ssh_fails.dict.p", "rb"))
- svg_list=[]
- for a in ip_list:
- dir_check(a['IP'])
- svgcheck=scapy_svg(a['IP'])
- if svgcheck:
- svg_list.append(svgcheck)
- return render_template('new2.html', ip_list=ip_list, svg_list=svg_list)
Untitled
Posted by Anonymous on Sat 8th Dec 2012 00:35
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.