def __init__(self, conn_parameters=None): self._tables = {} self._foreign_keys = [] self._session = base.Session()
def __init__(self): # self.connection = psycopg2.connect(database='postgres', user='******', # password='******', host='localhost') self.session = base.Session()
# Get the target entry # target = GetTarget(sidetrackIp) if target == None: prints("Invalid Sidetrack IP") doSysExit(1) # # Get a SIDETRACK implant # implant = base.GetImplant("SIDETRACK") # # Assign the implant and target to a session # session = base.Session(target, implant) session.name = 'sidetrack' # # Get the necessary commands for connection establishment # connect = session.GetCommand("connect") done = session.GetCommand("done") timediff = session.GetCommand("timediff") rrm = session.GetCommand("redirrm") lrm = base.sessionDict['me'].GetCommand("redirrm") if timeoffset != 0: result = timediff.run(timeoffset) prints(result[1])
from datetime import date import base from film import Film from cinema import Cinema from session import Session # 1 - drop all data base.Base.metadata.drop_all(base.engine) # 2 - generate database schema base.Base.metadata.create_all(base.engine) # 3 - create a new session session = base.Session() # 4 - create films #bourne_identity = Film("The Bourne Identity", 2002, "Action", 119) #furious_7 = Film("Furious 7", 2015, "Action", 137) #pain_and_gain = Film("Pain & Gain", 2013, "Comedy", 129) #session.add(bourne_identity) #session.add(furious_7) #session.add(pain_and_gain) #c1 = Cinema("123", "123") #session.add(c1) #Cinema cinema1 = Cinema("Kiev", "Velyka Vasylkivska Street, 19") cinema2 = Cinema("October", "Konstantinovskaya Street, 26") cinema3 = Cinema("Torch", "Mykola Bazhana Avenue, 3")