I update my code, I think I manage to use the same algorithms of
bacula for the challenge but result between my code and bconsole is a
bite different. I don't understand why.

For example :

challenge send by the server :
<2014017250.1296136483@eole-laptop-dir>

and the response of bconsole:

dg5j55++v+1Dx//+i7+YMC

Result with my script :

dg5j5pe+v+1DxPD+i76YMg

What's wrong and where?

On Wed, Jan 26, 2011 at 16:14, Rory Campbell-Lange
<r...@campbell-lange.net> wrote:
> 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
>
import socket
import hmac
import base64

server = ('127.0.0.1', 9101)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(server)
s.send("\x00\x00\x00\x1aHello *UserAgent* calling\n")
data = s.recv(1024)
print data
challenge = '<'+ data[1:].split('<')[1].split('>')[0] + '>'
print challenge
passwd = 'b489c90f3ee5b3ca86365e1bae27186e'
hm = hmac.new(passwd, challenge)
rep = base64.encodestring(hm.digest())
rep = rep.strip().rstrip('=')
print rep
s.send("\x00\x00\x00"+ rep+"\x00" )
data = s.recv(1024)
print data

------------------------------------------------------------------------------
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

Reply via email to