예제 #1
0
 def test_DBI_connect(self):
     
     logger.info("test_dbi_connect")
     dburl = DbURL()        
     db = pgdb.connect(dburl.pguser,host=dburl.pghost,database=dburl.pgdb)
     curs = db.cursor()        
     curs.execute("COMMIT")
     curs.execute("BEGIN")
     curs.execute("DROP TABLE IF EXISTS jge ")
     curs.execute("CREATE TABLE jge ( a int )")
     curs.execute("DROP TABLE jge")
     db.commit()  
예제 #2
0
    def test_DBI_connect(self):

        logger.info("test_dbi_connect")
        dburl = DbURL()
        db = pgdb.connect(dburl.pguser, host=dburl.pghost, database=dburl.pgdb)
        curs = db.cursor()
        curs.execute("COMMIT")
        curs.execute("BEGIN")
        curs.execute("DROP TABLE IF EXISTS jge ")
        curs.execute("CREATE TABLE jge ( a int )")
        curs.execute("DROP TABLE jge")
        db.commit()
예제 #3
0
 def setupConnection(self,name):
     logger.info(name)
     dburl = DbURL()
     dsn=str(dburl) + "::"
     db = pgdb.connect(dsn=dsn)
     return db
예제 #4
0
 def setupConnection(self, name):
     logger.info(name)
     dburl = DbURL()
     dsn = str(dburl) + "::"
     db = pgdb.connect(dsn=dsn)
     return db
예제 #5
0
    cur.execute(
        "SELECT * FROM hosts INNER JOIN antiMalwareHosts ON hosts.hostID = antiMalwareHosts.hostID WHERE antiMalwareHosts.AntiMalwareManualScanState = 3 OR antiMalwareHosts.AntiMalwareScheduledScanState = 3;"
    )

    for HostID in cur.fetchall():
        listID.append(HostID)

    conn.close()


def deleteJobSchedScan(conn):
    cur = conn.cursor()

    for iD in listID:
        cur.execute(
            "UPDATE antiMalwareHosts SET AntiMalwareScheduledScanState = 0 WHERE AntiMalwareHostID = "
            + iD)

    conn.close()


print("Delete Pending Schedule Scan Jobs")
dbConnect = pgdb.connect(host=hostname,
                         user=username,
                         password=password,
                         database=database)
sleep(1)
doInsertDatatoBuffer(dbConnect)
sleep(3)
deleteJobSchedScan(dbConnect)
sys.exit()