Nmap Development mailing list archives

Re: [NSE + NSELib] Netbios and SMB [stable!]


From: Ron <ron () skullsecurity net>
Date: Sat, 04 Oct 2008 20:48:08 -0500

Sven Klemm wrote:
Sven Klemm wrote:
I added support for encryption and decryption to the openssl bindings.
Here are the signatures of all the new functions:

openssl.md2( string message )
openssl.md4( string message )
openssl.md5( string message )
openssl.sha1( string message )
openssl.ripemd160( string message )
openssl.digest( string algorithm, string message )
openssl.hmac( string algorithm, string key, string message )
openssl.encrypt( string algorithm, string key, string iv, string data,
bool padding = false )
openssl.decrypt( string algorithm, string key, string iv, string data,
bool padding = false )
openssl.supported_ciphers()
openssl.supported_digests()

The algorithm parameter is a string like "md5", "sha256", "des",
"blowfish", etc. openssl.supported_ciphers() and
openssl.supported_digests() return the list of supported algorithms.

Hey Sven,

I got the MD4() stuff working, and it's working well. But I'm having a
problem with the DES(), and it's probably my own fault for not knowing
OpenSSL well enough. I'm trying to encrypt the string "KGS!@#$%" using
the key "part1" (which is a 7-character string). But it's returning
'nil'. Am I doing this wrong, and/or is there a way to tell what I'm
doing incorrectly?

The 7-character string should have the parity bits set and become a
8-character key, which is used to encrypt the constant string. That's
how I understand it to work, anyways.

Here's the relevant code:
    return openssl.encrypt("DES-ECB", part1, nil, "KGS!@#$%", false)

Thanks!
Ron

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: