예제 #1
0
def pump_db():
    print('Populating Database')
    db.create_all()

    admin = User(username="******", password=random_password())
    operator = User(username="******", password=random_password())
    db.session.add(admin)
    db.session.add(operator)

    owner = Owner(name='DVGAUser')
    db.session.add(owner)

    paste = Paste()
    paste.title = random_title()
    paste.content = "My First Paste"
    paste.public = False
    paste.owner_id = owner.id
    paste.owner = owner
    paste.ip_addr = '127.0.0.1'
    paste.user_agent = 'User-Agent not set'
    db.session.add(paste)

    for _ in range(0, 10):
        owner = Owner(name=random_owner())
        paste = Paste()
        paste.title = random_title()
        paste.content = random_content()
        paste.public = True
        paste.owner_id = owner.id
        paste.owner = owner
        paste.ip_addr = random_address()
        paste.user_agent = random_useragent()

        db.session.add(owner)
        db.session.add(paste)

    mode = ServerMode()
    mode.hardened = False
    db.session.add(mode)

    db.session.commit()

    print('done')
예제 #2
0
def pump_db():
  print('Populating Database')
  db.create_all()
  admin = User(username="******", password=random_password())
  owner = Owner(name='DVGAUser')
  audit = Audit()
  paste = Paste()
  paste.title = random_title()
  paste.content = "My First Paste"
  paste.public = False
  paste.owner_id = owner.id
  paste.owner = owner
  paste.ip_addr = '127.0.0.1'
  paste.user_agent = 'User-Agent not set'
  audit.gqloperation = 'CreatePaste'
  db.session.add(admin)
  db.session.add(owner)
  db.session.add(paste)
  db.session.add(audit)

  for _ in range(0, 10 ):
    owner = Owner(name=random_owner())
    paste = Paste()
    paste.title = random_title()
    paste.content = random_content()
    paste.public = True
    paste.owner_id = owner.id
    paste.owner = owner
    paste.ip_addr = random_address()
    paste.user_agent = random_useragent()

    db.session.add(owner)
    db.session.add(paste)

  db.session.commit()

  print('done')