def search(body): db = database() results = list() leaks = db.getLeaks(body['search'],body['searchby']) for leak in leaks: results.append({'id':leak.id,'email':leak.email,'username':leak.username,'password':leak.password,'database':leak.database}) return results
def massInsert(body, request, response): leaks = str(body['leakmass']).replace("'b", "").split('\\n') count = len(leaks) db = database() thread = threading.Thread(target=db.saveMassLeaks, args=(leaks, )) thread.start() message = 'You have loaded %d new leaks the process to register will happen in bakground!' % count return "<script>alert('%s');document.location = '/'</script>" % message
def singleInsert(body): checks = ['username','password','email','database'] for c in checks: if c not in body: return False db = database() db.insertLeak(username=body['username'],email=body['email'],password=body['password'],database=body['database']) message = 'New leak created for e-mail %s' % body['email'] return {'message':message}
def index(): template = get_template('index.html') db = database() totalLeaks = len(db.getAll()) lastLeaks = db.lastEntries() return template.render({'total': totalLeaks, 'leaks': lastLeaks})
def deleteLeak(leakid): db = database() db.deleteLeak(int(leakid)) message = 'leak deleted' return "<script>alert('%s');document.location = '/'</script>" % message
def updatePassword(body): db = database() totalupdates = db.updatePassword(body['password-old'], body['password-new']) message = '%d passwords were updated!' % totalupdates return {"message": message}