New arg "use_postgres"

This commit is contained in:
BuildTools 2021-09-23 14:21:57 -05:00
parent ffd0c1f136
commit cf90d2ab2b

View File

@ -374,6 +374,7 @@ void print_usage() {
std::cout << "\t-x\tExploit pattern file used for generation" << std::endl; std::cout << "\t-x\tExploit pattern file used for generation" << std::endl;
std::cout << "\t-r\tUse redis for generation" << std::endl; std::cout << "\t-r\tUse redis for generation" << std::endl;
std::cout << "\t-h\tThis help menu." << std::endl; std::cout << "\t-h\tThis help menu." << std::endl;
std::cout << "\t-p\tUse PostgreSQL" << std::endl;
} }
inline bool file_exists(const std::string &name) { inline bool file_exists(const std::string &name) {
@ -416,6 +417,7 @@ int main(int argc, char *argv[]) {
bool no_cycles = false; bool no_cycles = false;
bool batch_process = false; bool batch_process = false;
bool use_redis = false; bool use_redis = false;
bool use_postgres = false;
int opt; int opt;
while ((opt = getopt(argc, argv, "rb:g:dhc:n:x:t:q:")) != -1) { while ((opt = getopt(argc, argv, "rb:g:dhc:n:x:t:q:")) != -1) {
@ -452,6 +454,9 @@ int main(int argc, char *argv[]) {
case 'q': case 'q':
init_qsize = atoi(optarg); init_qsize = atoi(optarg);
break; break;
case 'p':
use_postgres = true;
break;
case '?': case '?':
if (optopt == 'c') if (optopt == 'c')
fprintf(stderr, "Option -%c requires an argument.\n", optopt); fprintf(stderr, "Option -%c requires an argument.\n", optopt);
@ -532,7 +537,8 @@ int main(int argc, char *argv[]) {
int batch_size = 0; int batch_size = 0;
if (batch_process) if (batch_process)
batch_size = std::stoi(opt_batch); batch_size = std::stoi(opt_batch);
/*
if (use_postgres) {
std::cout << "Importing Models and Exploits into Database: "; std::cout << "Importing Models and Exploits into Database: ";
import_models(parsednm, parsedxp); //directly use the strings parsednm and parsedxp as SQL commands import_models(parsednm, parsedxp); //directly use the strings parsednm and parsedxp as SQL commands
gettimeofday(&tf3,NULL); gettimeofday(&tf3,NULL);
@ -540,7 +546,8 @@ int main(int argc, char *argv[]) {
std::cout << "Done\n"; std::cout << "Done\n";
printf("------>The time to load .nm and .xp into the database took %lf ms.<------\n",tdiff3); printf("------>The time to load .nm and .xp into the database took %lf ms.<------\n",tdiff3);
printf("\n"); printf("\n");
*/ }
//------------------------------------------ //------------------------------------------
//program block 3: //program block 3:
//------------------------------------------ //------------------------------------------