Skip to content

Latest commit

 

History

History

python

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
fko python module version 1.0
==============================

This module is essentially a Python wrapper for the Firewall Knock
Operator library, "libfko".  See the "libfko" documentation for
additional information on the functionality provided by "libfko"
and usage overview.

Before attempting to build this module, libfko needs to be installed on
the system.

To build and install the module:

   * Build with "python setup.py build"
   * Install with "python setup.py install"


Simple usage example:

#!/usr/bin/python
#
# Import the Fko class and all constants.
#
from fko import *

# Create an Fko instance with an empty context.
#
fko = Fko()

# Set the HMAC digest algorithm
#
fko.hmac_type(FKO_HMAC_SHA256)

# Set the SPA message (Note: Access request is default if not specified).
#
fko.spa_message("0.0.0.0,tcp/22")

# Create the final SPA data message string.
#
fko.spa_data_final("mypassword", "myhmackey")

# print the spa message.
#
print fko.spa_data()

(prints something like this):
/m4fc/3OGd1IOchWM8o/yUvoa8TdbsRgU0zrp4UWuese9DIcHl09pZ3ukrNy/2OZAH3gnRH186YVMQEB1qfx23xVMq3IXx/fBwxgLBIqNdii2yWGqUVlxw83tfiP/p3Fmr7AeM1mev62xpE8R5vdACNxIDMM51lmYKh6JtEMoHrXXFAIRqbwCXJvlTEQij4vlZ4KfhMpnxxiiUciDWB11mbVDGSsQqKU9MQ

# To decode SPA data:
#
fko = Fko("/m4fc/3OGd1IOchWM8o/yUvoa8TdbsRgU0zrp4UWuese9DIcHl09pZ3ukrNy/2OZAH3gnRH186YVMQEB1qfx23xVMq3IXx/fBwxgLBIqNdii2yWGqUVlxw83tfiP/p3Fmr7AeM1mev62xpE8R5vdACNxIDMM51lmYKh6JtEMoHrXXFAIRqbwCXJvlTEQij4vlZ4KfhMpnxxiiUciDWB11mbVDGSsQqKU9MQ", "mypassword", "myhmackey")

# Print some of the data:
#
print "Version:", fko.version()
print "Timestamp:", fko.timestamp()
print "Username:", fko.username()
print "Digest Type (value):", fko.digest_type()
print "Digest Type (string):", fko.digest_type_str()
print "Digest:", fko.spa_digest()
print "SPA Message:", fko.spa_message()