On 26/01/11, Nabil Servais (nabil.serv...@gmail.com) wrote:
> I try to implements bacula protocol in python.
>
> I have some difficulites about the digest challenge. And I'm not an expert in
> C.
>
> My code : http://pastebin.com/pX9HdC1q
I haven't had a chance to look at your code, but the results for the md5
hashes in Bacula's catalogues are base64 encoded. You may find the
attachment helpful.
Regards
Rory
--
Rory Campbell-Lange
r...@campbell-lange.net
Campbell-Lange Workshop
www.campbell-lange.net
0207 6311 555
3 Tottenham Street London W1T 2AF
Registered in England No. 04551928
#!/usr/bin/python
'''
Author : Rory Campbell-Lange
Started : 2 October 2010
For : Campbell-Lange Workshop Ltd
Bacula MD5 sum checker.
This calculates the base64 md5 of a file.
'''
import hashlib
import base64
import sys
import os
class BaculaMd5(object):
def __init__(self, file):
self.file = file
self.md5 = None
self.md5b64 = None
self.process()
def process(self):
hash = hashlib.md5() # also possible : SHA1, SHA224, SHA256, SHA384, and SHA512
for l in open(self.file):
hash.update(l)
self.md5 = hash.digest()
b64 = base64.encodestring(self.md5)
# Take off the trailing '=' signs as bacula does not use them
# http://support.microsoft.com/kb/191239 suggests trailing = signs should be
# used for RFC 1521 compliance
# wierdly, a newline seems to be added to be encodedstring too, so this also
# needs to be stripped off.
self.md5b64 = b64.strip().rstrip('=')
return self.md5b64
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel