I want to save data (username, file name, Hex_format) in sqlite of the remote server
using python.
import socket
import urllib
import urllib2
import paramiko
import sqlite3
username = "e100075"
filename = "screenshot.png"
Hex_format = "FSGDSFDSSFGRSSCD"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('hostname', username="username", password="password")
print "Connect to server...."
try:
db = sqlite3.connect('screenshoter.db')
cursor = db.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS users(id INTEGER PRIMARY KEY, userid TEXT, activity_id TEXT, date_time TEXT, screenshot_filename TEXT, screenshot_md5 TEXT,
num_clicks INT, num_of_mouse_movements INT, num_pause INT );''')
cursor.execute("insert into users (userid,screenshot_filename,screenshot_md5) values (?, ?, ?)",(username, filename, Hex_format))
db.commit()
except Exception as e:
db.rollback()
raise e
finally:
db.close()
ssh.close()
after starting this program. The above information is only saved in my local db, not in my remote sqlite db server. how can i access the sqlite3 db remote server? where is any other way to continue.
Anand source
share