Snort mailing list archives
RE: Snort -> Mysql formatting IP addresses
From: "Nelson, Ben" <bnelson () rightnow com>
Date: Thu, 16 Oct 2003 11:56:31 -0600
Here's a python function that does it, maybe you can extrapolate from this how to write what you need in perl: #----------- long2ip - START ---------------------------------------- def long2ip( LongAddress ): # Right shift each number by the different octet boundaries and # then bitwise 'and' it with 256 Octet1 = ( LongAddress >> 24 ) & 0xFF Octet2 = ( LongAddress >> 16 ) & 0xFF Octet3 = ( LongAddress >> 8 ) & 0xFF Octet4 = LongAddress & 0xFF DottedDecimalNotation = "%s.%s.%s.%s" % ( Octet1, Octet2, Octet3, Octet4 ) return DottedDecimalNotation #----------- long2ip - END ------------------------------------------ --Ben
-----Original Message----- From: FWAdmin [mailto:FWAdmin () nbpower com] Sent: Thursday, October 16, 2003 11:15 AM To: Snort-Users Subject: [Snort-users] Snort -> Mysql formatting IP addresses Hey all. I have a problem with the way MySQL / ACID stores IP addresses from Snort. It stores them in the database in a 10 digit integer format, but I need to convert that to a real 4 octet IP address. What is the mathematics used to do the conversion? Does anyone have a perl script that will do this? Thanks -Jason ------------------------- This e-mail communication (including any or all attachments) is intended only for the use of the person or entity to which it is addressed and may contain confidential and/or privileged material. If you are not the intended recipient of this e-mail, any use, review, retransmission, distribution, dissemination, copying, printing, or other use of, or taking of any action in reliance upon this e-mail, is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete the original and any copy of this e-mail and any printout thereof, immediately. Your co-operation is appreciated. Le present courriel (y compris toute piece jointe) s'adresse uniquement a son destinataire, qu'il soit une personne ou un organisme, et pourrait comporter des renseignements privilegies ou confidentiels. Si vous n'etes pas le destinataire du courriel, il est interdit d'utiliser, de revoir, de retransmettre, de distribuer, de disseminer, de copier ou d'imprimer ce courriel, d'agir en vous y fiant ou de vous en servir de toute autre facon. Si vous avez recu le present courriel par erreur, priere de communiquer avec l'expediteur et d'eliminer l'original du courriel, ainsi que toute copie electronique ou imprimee de celui-ci, immediatement. Nous sommes reconnaissants de votre collaboration. ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Snort-users mailing list Snort-users () lists sourceforge net Go to this URL to change user options or unsubscribe: https://lists.sourceforge.net/lists/listinfo/snort-users Snort-users list archive: http://www.geocrawler.com/redir-sf.php3?list=snort-users
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Snort-users mailing list Snort-users () lists sourceforge net Go to this URL to change user options or unsubscribe: https://lists.sourceforge.net/lists/listinfo/snort-users Snort-users list archive: http://www.geocrawler.com/redir-sf.php3?list=snort-users
Current thread:
- RE: Snort -> Mysql formatting IP addresses Jacob Roberts (Oct 16)
- <Possible follow-ups>
- RE: Snort -> Mysql formatting IP addresses Nelson, Ben (Oct 16)
- Snort -> Mysql formatting IP addresses FWAdmin (Oct 16)
- RE: Snort -> Mysql formatting IP addresses Nelson, Ben (Oct 16)
- RE: Snort -> Mysql formatting IP addresses Dusty Hall (Oct 16)
- RE: Snort -> Mysql formatting IP addresses Hutchinson, Andrew (Oct 16)
- RE: Snort -> Mysql formatting IP addresses Steve Halligan (Oct 17)