# ag_gen: Attack Graph Generation System

## Installation

### Submodules

This repository includes submodules. Please use `git clone --recurse-submodules` with the appropriate link for this repo. This will initialize and update all submodules in this repo.

### Dependencies

Run the `deps.sh` command to install necessary dependencies.
This script supports debian based systems and Mac OSX (with homebrew)

### PostgreSQL

#### Create a user

Use the createuser and createdb scripts to create the necessary account and database in PostgreSQL.

    createuser -d -l -P ag_gen
    createdb -O ag_gen ag_gen

#### Populate the database

Use the `db_manage.sh` utility to populate the database (this will overwrite anything in the `ag_gen` database).
An example use of this is:

    ./db_manage.sh -d ag_gen

#### Add PSQL users and alter permissions
Log in to the Postgres user

	sudo su postgres

Then connect to the PSQL terminal
	
	psql

Now create the user and adjust permissions
	
	CREATE USER ag_gen;
	ALTER USER ag_gen WITH SUPERUSER;
	ALTER USER ag_gen WITH login;
	ALTER USER ag_gen WITH ENCRYPTED PASSWORD '8PZQc79NUZ3FjqSB';

Repeat, using root and your local user name in place of the ag gen user.
Note, if you change the password, be sure to change the passwords in the config.ini files.

## Building

This application uses CMake to build.

    cd build
	./build.sh


## Configuration

RAGE uses an ini-style configuration, located in config.ini.

- name: name of the database
- host: IP or hostname of the database server
- port: port number of the database server
- username: database user name
- password (optional): database password

## Running

Edit the run script to your liking, then just execute the script
	
	./run.sh

## Contributing

### Editorconfig

When contributing code, please install the "editorconfig" plugin for your text editor.

- Adds extra newline to end of file if not already there.
- Removes whitespace at end of lines
- Automatically sets indentation to tabs set to 4 spaces

## In Case of Compilation Errors

1.) Make sure all dependencies are installed

- Check the error messages to see if something is missing.

2.) Remove CMakeCache.txt

- If you are running in a different user, then the directories may be different than those in the cache file.
- If packages were updated on the local system, the cache may now be incorrect. Removing this file will usually clear up any errors.

=======
# ag_gen

C++ Attack Graph Generation
>>>>>>> 64be5b8cb4634d7857f4a593a3e5abf0fe968819
