marktuna Posted June 16, 2013 Report Share Posted June 16, 2013 It's really easy to click the little '-' button accidentally in the BitTorrent Sync interface which immediately deletes the shared folder. How can I recover the keys that I used for that folder? I have distributed the read-only key but not the read-write key, so I don't have a copy of it.Feature request: confirmation dialog before deleting a folder from Sync. Quote Link to comment Share on other sites More sharing options...
GreatMarko Posted June 16, 2013 Report Share Posted June 16, 2013 If you're quick, you can recover lost keys from the backup "sync.dat.old" file (found in %AppData%\BitTorrent Sync on Windows)If you open this file in a standard text editor, whilst it will look very messy, search for the phrase "secret32:" - each folder you were sharing will have it's key within this following context:....<folder path will be here>6:secret32:<folder secret will be here>15:......this will only work if you're quick though and do this immediately after you inadvertently remove a folder from Sync, as the "sync.dat.old" file is an automated backup of the main "sync.dat" file, and is therefore updated at regular intervals!I agree with you though, there should really be a confirmation dialog before you remove a folder from Sync! Quote Link to comment Share on other sites More sharing options...
marktuna Posted June 17, 2013 Author Report Share Posted June 17, 2013 Thank you, I'll try that. Quote Link to comment Share on other sites More sharing options...
19feet Posted June 18, 2013 Report Share Posted June 18, 2013 You can get the key (secret) from the other sync device you used before for sharing the same folder. When there is no other sync device you don't need the old key (secret) and you can create a new one. Quote Link to comment Share on other sites More sharing options...
LazyWolf Posted July 4, 2013 Report Share Posted July 4, 2013 I had an issue while testing out a newer version of btsync and had forgotten to backup the config files beforehand, then when I went back to the version my other devices were using it would not start up. I saw that I could recover the secrets and paths from sync.dat.old so I copied it and wrote a quick little python script to help me.If anyone uses a unix type os I hope this script will save you some time, it is made to search /home/username/.sync and your current directory first.#!/usr/bin/python"""This is a quick little script I made to parse out the key and path pairs from BTSync's config."""# Importsfrom sys import exitfrom os import getenvfrom os.path import exists,abspath# G Varspwd = abspath('.')+"/" # sets the current directroydefaultDirs = ((getenv("HOME")+"/.sync/sync.dat", getenv("HOME")+"/.sync/sync.dat.old"), (pwd + "sync.dat", pwd + "sync.dat.old"))#\sync = "" # Dont touch!syncOld = "" # Dont touch!bigData = [] # Dont touch!# Fnsdef __sortData(): global bigData f0 = open(sync, "r") data = f0.read().split(":") f0.close() del f0 f1 = open(syncOld, "r") tmp = f1.read().split(":") f1.close() del f1 tmpLen = len(tmp) for i in range(0, tmpLen): data.append(tmp[i]) del tmp, tmpLen dataLen = len(data) for i in range(0, dataLen): curLine = data[i]# if curLine.find("path") != -1 and data[i+3][-2:] == '15': bigData.append({'path':data[i+1][:-1],'secret':data[i+3][:-2]}) if curLine.find("path") != -1 and data[i+3][-1:] == '7': bigData.append({'path':data[i+1][:-1],'secret':data[i+3][:-1]}) elif curLine.find("path") != -1 and data[i+3][-2:] == '15': bigData.append({'path':data[i+1][:-1],'secret':data[i+3][:-2]}) del data, dataLen, curLine return 0 # end of sortDatadef __setPaths(): global sync, syncOld for i in range(0, len(defaultDirs)): if exists(defaultDirs[i][0]) and exists(defaultDirs[i][1]): sync = defaultDirs[i][0] syncOld = defaultDirs[i][1] break if sync == '' or syncOld == "": return None else: return 0 # end of setPath fndef __printData(): print "------" input = bigData inputLen = len(input) if inputLen == 0: return None for i in range(0, inputLen): print "Secret: " + input[i]['secret'] print " Path: " + input[i]['path'] if i != (inputLen-1): print "---" print "------" del input, inputLen # end of printData dn# Maindef main(): # Look for sync.dat and sync.day.old file if __setPaths() == None: print "There was an error finding the sync.dat files!" exit(1) # Read both files and put them together if __sortData() == None: print "There was an error sorting the data!" exit(1) # print data to screen __printData() # end of main fnif __name__ == "__main__": main()Edit 1: -=:Updated 07/04/13 - to work with 1.1.27:=-Edit 2: -=:Updated 07/22/13 - to work with 1.1.42:=- Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.