Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 15 additions & 6 deletions bin/sic
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
termcolor
passlib
10 changes: 8 additions & 2 deletions sic/decrypter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 )
Expand Down