Created
August 17, 2022 21:26
-
-
Save pierew/8bdb0ae2cf2fc7e4de00d39a88c7dc0f to your computer and use it in GitHub Desktop.
recover-nextcloud-vcards
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db = pymysql.connect(host="localhost",user="root",password="****",database="nextcloud",cursorclass=pymysql.cursors.DictCursor) | |
with db: | |
with db.cursor() as cursor: | |
sql = "SELECT carddata,uri FROM oc_cards WHERE addressbookid='5';" | |
cursor.execute(sql) | |
result = cursor.fetchall() | |
for item in result: | |
vcard = open("/tmp/restored_vcards/"+item["uri"],"w") | |
vcard.write(item["carddata"].decode("utf-8")) | |
vcard.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment