pastebin - collaborative debugging tool
kpaste.net RSS


Untitled
Posted by Anonymous on Sat 8th Dec 2012 00:35
raw | new post

  1. from flask import Flask, render_template, send_from_directory
  2. import os
  3. import socket
  4. import cPickle
  5. app = Flask(__name__)
  6. def dir_check(addr):
  7.     if not os.path.exists('/home/pronto/scripts/flask/static/IPs/'+addr):
  8.         os.makedirs('/home/pronto/scripts/flask/static/IPs/'+addr)
  9. def scapy_svg(addr):
  10.     if os.path.isfile('/home/pronto/scripts/flask/static/IPs/'+addr+'/trace.svg'):
  11.         return (addr, "http://vps2.pronto185.com/static/IPs/"+addr+"/trace.svg")
  12.  
  13.  
  14.  
  15. @app.route('/newfail')
  16. def newfail2():
  17.     ip_list=cPickle.load(open("/home/pronto/logs/ssh_fails.dict.p", "rb"))
  18.     svg_list=[]
  19.     for a in ip_list:
  20.         dir_check(a['IP'])
  21.         svgcheck=scapy_svg(a['IP'])
  22.         if svgcheck:
  23.             svg_list.append(svgcheck)
  24.     return render_template('new2.html', ip_list=ip_list, svg_list=svg_list)

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at