forked from guitmz/ratticdb-insert-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ratticdb-insert.py
28 lines (19 loc) · 995 Bytes
/
ratticdb-insert.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 2014 copyright Guilherme Thomazi ([email protected])
# Released under the GPL v2
import os, pymysql
conn = pymysql.connect(host='rattic_server_ip', port=3306, user='ratticdb_user', passwd='ratticdb_password', db='ratticdb_name')
cur = conn.cursor()
def add(title, username, password, description, group_id, url):
query_insert = """
insert into cred_cred(title, username, password, description, group_id, is_deleted, url, latest_id, created, iconname, descriptionmarkdown, modified, attachment, attachment_name)
values ('%s', '%s', '%s', '%s', %d, 0, '%s', NULL, NOW(), 'Key.png', 0, NOW(), '', NULL);""" % (title, username, password, description, group_id, url)
cur.execute(query_insert)
title = raw_input("title: ")
username = raw_input("username: ")
password = raw_input("password: ")
description = raw_input("description: ")
group_id = raw_input("group_id: ")
url = raw_input("url: ")
add(title, username, password, description, int(group_id), url)
cur.close()
conn.close()