diff --git a/README.md b/README.md index 04bf45c..d3409aa 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,5 @@ Dump a SIC database to its original XML format: ## Copyright This software is copyright of [Simone 'evilsocket' Margaritelli](http://www.evilsocket.net) and licensed under GPL3. + +The SafeInCloud.db file resides on the following location: https://safeincloud.uservoice.com/knowledgebase/articles/424490-where-is-the-cloud-database-located diff --git a/bin/sic b/bin/sic index 46d46a8..c0e9277 100755 --- a/bin/sic +++ b/bin/sic @@ -26,6 +26,10 @@ from termcolor import colored from xml.dom.minidom import parseString from sic.decrypter import Decrypter from sic.entry import Entry +try: + input = raw_input +except NameError: + pass def matches( query, card ): try: @@ -56,9 +60,9 @@ config_file = os.path.join( expanduser("~"), '.sic' ) if not os.path.isfile(config_file): ok = False while ok is False: - db_path = raw_input( "Configuration file not found, please enter the path of your SiC database: " ) + db_path = input( "Configuration file not found, please enter the path of your SiC database: " ) if not os.path.isfile(db_path): - print "%s does not exist!" % db_path + print( "%s does not exist!" % db_path) else: ok = True @@ -86,14 +90,19 @@ for node in xml.getElementsByTagName('card'): for entry in entries: if entry.matches(search): notes = None - print colored( "%s\n" % entry.title, 'green', attrs=['bold'] ) - for title, field in entry.fields.iteritems(): + print( colored( "%s\n" % entry.title, 'green', attrs=['bold'] )) + try: + entry_items = entry.fields.iteritems() + except AttributeError: + entry_items = entry.fields.items() + + for title, field in entry_items: if field.type == 'notes': notes = field else: - print "%-25s: %s" % ( colored( title, 'grey', attrs=['bold'] ), field.value ) + print( "%-25s: %s" % ( colored( title, 'grey', attrs=['bold'] ), field.value )) if notes is not None: - print "%-25s:\n\n%s" % ( colored( 'Notes', 'grey', attrs=['bold'] ), notes.value ) + print( "%-25s:\n\n%s" % ( colored( 'Notes', 'grey', attrs=['bold'] ), notes.value )) print diff --git a/requirements.txt b/requirements.txt index e69de29..6091a8b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,2 @@ +termcolor +passlib diff --git a/sic/decrypter.py b/sic/decrypter.py index e5bce5e..e688084 100644 --- a/sic/decrypter.py +++ b/sic/decrypter.py @@ -17,7 +17,10 @@ # or write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import struct -import StringIO +try: + from StringIO import StringIO ## for Python 2 +except ImportError: + from io import BytesIO ## for Python 3 import zlib from Crypto.Cipher import AES @@ -63,7 +66,10 @@ def decrypt( self ): salt2 = self.__read_bytearray() block = self.__read_bytearray() decr = cipher.decrypt(block) - sub_fd = StringIO.StringIO(decr) + try: + sub_fd = BytesIO(decr) + except NameError: + sub_fd = StringIO(decr) iv2 = self.__read_bytearray( sub_fd ) pass2 = self.__read_bytearray( sub_fd ) check = self.__read_bytearray( sub_fd )