The Local Security Check Automation Framework is a tool to generate NVT's
based on the advisories published by *nix Operating System vendors. The 
following features are currently supported,

- Auto generation of NASL scripts based on vendor advisories
- Integration into Mantis bug tracker to report all the generated scripts
  for further QA processes.
- Sanity testing of the generated NASL scripts

Currently it supports NVT generation for,
All flavours of,
- SUSE
- Fedora
- RedHat
- CentOS
- Debian
- Ubuntu
- Mandriva
- Gentoo
- Solaris

Support for other Operating Systems is underway. This can be achieved by
implementing a parser for that particular vendor advisory and interfacing
with the framework.

##############################################################################
 Package Structure
##############################################################################

|-- LSCGenerator.py: Main class
|-- common
|   |-- __init__.py
|   |-- generate_script.py - NVT generator
|   |-- record_id.py - Script ID management
|   `-- utils.py - utility functions
|-- lsc.conf - Configuration file
|-- lsc_unit_test.py - Unit Test runner
|-- parser
|   |-- __init__.py
|   |-- fedora.py - Fedora advisory parser 
|   `-- suse.py - SUSE advisory parser
|   |-- centos.py - CentOS advisory parser
|   |-- debian.py - Debian advisory parser
|   |-- mandriva.py - Mandriva advisory parser
|   |-- redhat.py - RedHat advisory parser
|   `-- ubuntu.py - Ubunutu advisory parser
|   `-- gentoo.py - Gentoo advisory parser
|   '-- solaris.py - Solaris advisory parser 
|-- report
|   |-- __init__.py
|   `-- mantisreporter.py - Report the tasks in Mantis
|-- templates - NVT skeleton
|   |-- Fedora.template - Fedora NVT skeleton code 
|   `-- Suse.template - SUSE NVT skeleton code
|   |-- CentOS.template - CentOS NVT skeleton code 
|   |-- Debian.template  - Debian NVT skeleton code
|   |-- Mandriva.template - Mandriva NVT skeleton code
|   |-- RedHat.template - RedHat NVT skeleton code
|   `-- Ubuntu.template - Ubuntu NVT skeleton code
|   `-- Gentoo.template - Gentoo NVT skeleton code
|   '-- Solaris.template - Solaris NVT skeleton code
`-- test - Unit and sanity testing
    |-- __init__.py
    `-- sanity_test.py - Sanity test module
    `-- unit_test - Unit test modules
        |-- __init__.py
        |-- test_centos.py
        |-- test_debian.py
        |-- test_fedora.py
        |-- test_generate_script.py
        |-- test_lscgenerator.py
        |-- test_mandriva.py
        |-- test_mantisreporter.py
        |-- test_record_id.py
        |-- test_redhat.py
        |-- test_sanity_test.py
        |-- test_suse.py
        |-- test_ubuntu.py
        |-- test_utils.py
		|-- test_solaris.py
	|-- test_gentoo.py
        `-- work - Workspace for unit test
            |-- input
            `-- output


############################################################################
 Dependencies
############################################################################
1. MySQLdb (Optional) - Interface for Python and MySQL. This is being used for
   integrating into Mantis Bug Tracker to report all the generated scripts as
   tasks in Mantis. It can be downloaded from,
   http://sourceforge.net/projects/mysql-python
   Follow the instructions as in the package to install.

2. PyUnit (Optional) - Perform Unit Testing. It can be downloaded from,
   http://sourceforge.net/projects/pyunit/
   Follow the instructions as in the package to install.

#############################################################################
 How to run?
#############################################################################

LSCGenerator:
1. Update lsc.conf. Refer to the inline documentation for lsc.conf
2. chmod +x ./LSCGenerator.py
   (only once to make the script executable)
3. Run $ ./LSCGenerator.py
   (it may take a long time, please add paramter --verbose to watch progress)
   The NVT's will be generated and saved to the specified folder in under
   build_dir in lsc.conf
4. Additionally,
   - ./LSCGenerator --help provides necessary help to run the tool
   - ./LSCGenerator --sanity performs sanity test only
   - ./LSCGenerator --verbose runs in Debug mode

Unit Test:
1. chmod +x lsc_unit_test.py
   (only once to make the script executable)
2. Run ./lsc_unit_test

##############################################################################
 How to implement a new parser?
##############################################################################

1. Register the new module in LSCGenerator updating _object_map dictionary,
   (PARSER_MODULE, CONFIG_SECTION).
   PARSER_MODULE - module that implements parser 
   CONFIG_SECTION - Configuration section in lsc.conf for the corresponding OS. 

2. Implement the parser as described in __init__.py of parser package.

3. Develop the NVT code skeleton template and add to template package

4. Create a config section in lsc.conf with the mandatory config parameters


###############################################################################
 Issue Log
###############################################################################
Suse Parser:
- It is assumed that RPM names and versions for both 64-bit and 32-bit are same,
  if versions are different, generated checks may fail.
- Due to unavailability of Licenses for all SUSE enterprise versions,
  gather_package_list.nasl hasn't been enhanced to support licensed SUSE
  versions. Hence the generated scripts for those versions do not work.
- Some SUSE advisories require login credentials, those aren't considered for 
  generation

##############################################################################
 Revision Log
##############################################################################
Revision 1.0:
- LSC Generator framework with parser for OpenSUSE

Revision 1.1:
- Parser for all versions of SUSE including SUSE Enterprise
- Integration with Mantis for task management purpose
- Sanity testing of the generated NASL plugins
- Unit test modules
- Bug fixes and enhancements

Revision 1.2:
- Parser for all versions of Fedora
- Parser for EL and AS versions of RedHat
- Parser for all versions of CentOS

Revision 1.3:
- Parser for all versions of Ubuntu
- Parser for all versions of Debian

Revision 1.4:
- Parser for all versions of Mandriva

Revision 1.5:
- Parser for all versions of Gentoo

Revision 1.6
- Parser for all versions of Solaris
- Fixed issues in Gentoo parser
