def push(): logging.info("[+]Inside shivapushtodb Module") notify = server.shivaconf.getboolean('notification', 'enabled') exeSql = shivadbconfig.dbconnect() attachpath = server.shivaconf.get('analyzer', 'attachpath') inlinepath = server.shivaconf.get('analyzer', 'inlinepath') truncate = ['truncate attachments','truncate links', 'truncate sensors', 'truncate spam'] for query in truncate: try: exeSql.execute(query) except Exception, e: logging.critical("[-] Error (shivapushtodb) truncate %s" % str(e)) if notify is True: shivanotifyerrors.notifydeveloper("[-] Error (Module shivapushtodb.py) - truncate %s" % e)
def push(): logging.info("[+]Inside shivapushtodb Module") notify = server.shivaconf.getboolean('notification', 'enabled') exeSql = shivadbconfig.dbconnect() attachpath = server.shivaconf.get('analyzer', 'attachpath') inlinepath = server.shivaconf.get('analyzer', 'inlinepath') truncate = [ 'truncate attachments', 'truncate links', 'truncate sensors', 'truncate spam' ] for query in truncate: try: exeSql.execute(query) except Exception, e: logging.critical("[-] Error (shivapushtodb) truncate %s" % str(e)) if notify is True: shivanotifyerrors.notifydeveloper( "[-] Error (Module shivapushtodb.py) - truncate %s" % e)
shivanotifyerrors.notifydeveloper("[-] Error (Module shivamaindb.py) - checkRelayDate %s" % e) if len(mainDb.fetchall()) >= 1: update_relay = "UPDATE `relay` SET `lastRelayed` = '" + str(mailFields['relayTime']) + "', totalRelayed = totalRelayed + '" + str(mailFields['relayCounter']) + "' WHERE `spam_id` = '" + str(mainid) + "' AND `date` = '" + str(relayDate) + "'" try: mainDb.execute(update_relay) except mdb.Error, e: logging.error("[-] Error (Module shivamaindb.py) - update_relay %s" % e) if notify is True: shivanotifyerrors.notifydeveloper("[-] Error (Module shivamaindb.py) - update_relay %s" % e) else: insert_relay = "INSERT INTO `relay`(`date`, `firstRelayed`, `lastRelayed`, `totalRelayed`, `spam_id`, `sensorID`) VALUES ('" + str(relayDate) + "', '" + str(mailFields['relayTime']) + "', '" + str(mailFields['relayTime']) + "', '" + str(mailFields['relayCounter']) + "', '" + str(mainid) + "', '" + str(mailFields['sensorID']) + "')" try: mainDb.execute(insert_relay) except mdb.Error, e: logging.error("[-] Error (Module shivamaindb.py) - insert_relay %s" % e) if notify is True: shivanotifyerrors.notifydeveloper("[-] Error (Module shivamaindb.py) - insert_relay %s" % e) if __name__ == '__main__': tempDb = shivadbconfig.dbconnect() mainDb = shivadbconfig.dbconnectmain() notify = server.shivaconf.getboolean('notification', 'enabled') phishing_report = server.shivaconf.getboolean('analyzer', 'send_phishing_report') # time.sleep(200) # Giving time to hpfeeds module to complete the task. logging.basicConfig(filename='logs/maindb.log',level=logging.DEBUG,format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') main()