Skip to content

Commit

Permalink
Fix libnss path
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessandroZ committed Feb 24, 2015
1 parent 9144ae0 commit 5b9cbdf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
49 changes: 28 additions & 21 deletions Linux/src/softwares/browsers/mozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,7 @@ class Mozilla():
def __init__(self):

self.credentials_categorie = None
self.dll_NotFound = False

# tested on different system, the location seems to not change
path = "/usr/lib/x86_64-linux-gnu/libnss3.so"
try:
self.libnss = CDLL(path)
except:
self.dll_NotFound = True

self.libnss = None
self.slot = None

self.username = SECItem()
Expand All @@ -97,8 +89,6 @@ def __init__(self):
self.number_toStop = None

def __del__(self):
if self.dll_NotFound == False:
self.libnss.NSS_Shutdown()
self.libnss = None

self.username = None
Expand Down Expand Up @@ -134,12 +124,25 @@ def manage_advanced_options(self):
self.toCheck = ['b', 'd']
self.number_toStop = 3

def initialize_libnss(self, profile):
if self.libnss.NSS_Init(profile)!=0:
print_debug('ERROR', 'Could not initialize the NSS library\n')
return False
return True

def initialize_libnss(self, list_libnss, profile):
for lib in list_libnss:
try:
self.libnss = CDLL(lib)
if self.libnss.NSS_Init(profile) == 0:
return True
except:
pass
return False

def found_libnss(self):
directory = '/usr/lib/'
list_libnss = []
for root, dirs, files in os.walk(directory):
for file in files:
if file == 'libnss3.so':
list_libnss.append(root + os.sep + file)
return list_libnss

def decrypt(self, software_name, credentials):
pwdFound = []
for host, user, passw in credentials:
Expand Down Expand Up @@ -299,7 +302,7 @@ def found_masterpassword(self):
except:
pass
print_debug('WARNING', 'No password has been found using the brute force attack')

# ------------------------------ End of Master Password Functions ------------------------------

# main function
Expand All @@ -318,8 +321,10 @@ def retrieve_password(self):
# print the title
Header().title_debug(software_name)

list_libnss = self.found_libnss()

# Check if the libnss could be initialized well
if self.dll_NotFound:
if not list_libnss:
print_debug('ERROR', 'The libnss have not been initialized because the libnss3.so has not been found')

#Check if mozilla folder has been found
Expand All @@ -340,7 +345,7 @@ def retrieve_password(self):
for profile in profile_list:
print_debug('INFO', 'Profile path found: %s' % profile)

if self.initialize_libnss(profile):
if self.initialize_libnss(list_libnss, profile):
masterPwd = self.is_masterpasswd_set()
if masterPwd:
print_debug('WARNING', 'A masterpassword is used !!')
Expand All @@ -354,7 +359,7 @@ def retrieve_password(self):
credentials = SqliteDatabase(profile)

if not database_find:
print_debug('ERROR', 'Couldn\'t find credentials file (logins.json or signons.sqlite)')
print_debug('INFO', 'No credentials file found (logins.json or signons.sqlite) - or empty content')

try:
# decrypt passwords on the db
Expand All @@ -367,6 +372,8 @@ def retrieve_password(self):
self.save_db(profile)

self.libnss.NSS_Shutdown()
else:
print_debug('ERROR', 'Could not initialize the NSS library\n')

# print the results
print_output(software_name, pwdFound)
2 changes: 1 addition & 1 deletion Linux/src/softwares/chats/pidgin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class Pidgin():

# if pidgin is started, use the api to retrieve all passwords
def check_if_pidgin_started(self):
bus = dbus.SessionBus()
try:
bus = dbus.SessionBus()
purple = bus.get_object("im.pidgin.purple.PurpleService","/im/pidgin/purple/PurpleObject","im.pidgin.purple.PurpleInterface")
acc = purple.PurpleAccountsGetAllActive()

Expand Down
Binary file modified Linux/standalone/LaZagne
Binary file not shown.

0 comments on commit 5b9cbdf

Please sign in to comment.