22 lines
No EOL
1,018 B
Text
22 lines
No EOL
1,018 B
Text
from sys import argv
|
|
import sqlite3
|
|
conn = sqlite3.connect("/home/sweebotirc/sbirc.db")
|
|
database = conn.cursor()
|
|
if argv[2] == "full":
|
|
if len(argv) == 5:
|
|
if argv[3] == argv[2]:
|
|
print(argv[1] + ": You wanna give yourself permissions!?")
|
|
else:
|
|
perms = getperms(argv[3])
|
|
if perms != "":
|
|
database.execute("UPDATE users SET perms = '" + perms + "," + argv[4] + "' WHERE username = '" + argv[3] + "';")
|
|
print(argv[1] + ": Successfully appended '" + argv[4] + "' to the permissions of " + argv[3])
|
|
else:
|
|
database.execute("INSERT INTO users (username, perms) VALUES ('" + argv[3] + "', '" + argv[4] + "');")
|
|
print(argv[1] + ": Successfully created permissions of " + argv[3] + " and set it to '" + argv[4] + "'")
|
|
else:
|
|
print(argv[1] + ": This command takes 2 arguments, only got " + str(len(argv) - 3) + ".")
|
|
else:
|
|
print(argv[1]+": Permission denied")
|
|
conn.commit()
|
|
conn.close() |