Movatterモバイル変換


[0]ホーム

URL:


Home page logo
nmap-dev logo

Nmap Developmentmailing list archives

PreviousBy DateNext
PreviousBy ThreadNext

[RFC] Lua bindings for OpenSSL md5 and sha1 hash functions


From: "Thomas Buchanan" <TBuchanan () thecompassgrp net>
Date: Wed, 5 Dec 2007 11:39:51 -0600

Hello,So, I was working on another NSE script recently, and needed the abilityto calculate SHA1 hashes.  I did a Google search, and found Lua bindingsagainst the OpenSSL library for MD5 and SHA1 hashes[1].  Using that codeas a starting point, I created a new NSE library called openssl, whichincludes two functions, digest_md5() and digest_sha1().These two functions take a string as the primary argument, and anoptional boolean value for a second.  By default, they return the hexrepresentation of MD5 or SHA1 digest calculated from the string.  If thesecond boolean argument is true, they return the raw 16 or 20 digitdigests.Attached is a small archive which contains the code for the NSE library,and a small test script that demonstrates usage.  I've also attached apatch to Makefile.in to compile the library.Example output from included test script:Host script results:|  Hash test: MD5 and SHA1 hashes of IP address 192.168.128.1|  MD5: bb22aeb2bcb0e41c3a8b0468abf14bbc|  SHA1: 3c7207e8da6aad45263a0263c78bb0ec36e9e188|  MD5 raw: ."......:..h..K.|_ SHA1 raw: <r...j.E&:.c....6...Quick instructions for testing the patch:cd to nmap source tree (svn checkout or nmap-4.23RC3)$ tar jxf /path/to/lua-openssl.tar.bz2$ patch -p1 < /path/to/lua-openssl-Makefile.patch$ ./configure --with-openssl (other config args).. make, etc.This library requires HAVE_OPENSSL to be defined.  I haven't tested iton Windows at all, but my understanding is that the Windows build systemdoesn't currently build against OpenSSL.  Does anyone have any pointersfor compiling under Windows with OpenSSL?Since Nmap is currently in feature freeze, I'm certainly not suggestingthis be included at the moment, but I thought I'd put it out there tosee if there was any interest, and to get feedback and comments.  I'mnot too familiar with the OpenSSL library, or Lua bindings, but ifthere's interest in exposing other functions to Lua/NSE, I'd be happy tolook into it.Thanks,Thomasby the way, I found a convenient way to calculate md5 [2] and sha1 [3]hash values online.[1]http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/[2]http://people.eku.edu/styere/Encrypt/JS-MD5.html[3]http://people.eku.edu/styere/Encrypt/JS-SHA1.html

Attachment:lua-openssl.tar.bz2
Description: lua-openssl.tar.bz2

Attachment:lua-openssl-Makefile.patch
Description: lua-openssl-Makefile.patch

_______________________________________________Sent through the nmap-dev mailing listhttp://cgi.insecure.org/mailman/listinfo/nmap-devArchived athttp://SecLists.Org

PreviousBy DateNext
PreviousBy ThreadNext

Current thread:


[8]ページ先頭

©2009-2025 Movatter.jp