Home page logo
/
Intro Reference Guide Book Install Guide
Download Changelog Zenmap GUI Docs
Bug Reports OS Detection Propaganda Related Projects
In the Movies In the News

Sponsors


Library formulas

Formula functions for various calculations.

The library lets scripts to use common mathematical functions to compute percentages, averages, entropy, randomness and other calculations. Scripts that generate statistics and metrics can also make use of this library.

Copyright© Same as Nmap--See http://nmap.org/book/man-legal.html

Source: http://nmap.org/svn/nselib/formulas.lua

Functions

calcPwdEntropy (value)

Calculate the entropy of a password.

looksRandom (data)

Checks whether a sample looks random



Functions

calcPwdEntropy (value)

Calculate the entropy of a password.

A random password's information entropy, H, is given by the formula: H = L * (logN) / (log2), where N is the number of possible symbols and L is the number of symbols in the password. Based on https://en.wikipedia.org/wiki/Password_strength

Parameters

  • value: The password to check

Return value:

The entropy in bits
looksRandom (data)

Checks whether a sample looks random

Because our sample is so small (only 16 bytes), do a chi-square goodness of fit test across groups of 2, 4, and 8 bits. If using only 8 bits, for example, any sample whose bytes are all different would pass the test. Using 2 bits will tend to catch things like pure ASCII, where one out of every four samples never has its high bit set.

Parameters

  • data: The data to check

Return value:

True if the data appears to be random, false otherwise

Nmap Site Navigation

Intro Reference Guide Book Install Guide
Download Changelog Zenmap GUI Docs
Bug Reports OS Detection Propaganda Related Projects
In the Movies In the News
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]