From 6f24e0354ab54efb92af1d8a3977ee284ff163fb Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Thu, 6 Nov 2014 11:44:39 +0100 Subject: [PATCH] Added --version --- src/main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index df4e6ce..f6baad4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,7 @@ using namespace std; struct option opts[] = { {"src-ip", 1, NULL, 0}, + {"version", 0, NULL, 1}, {"sport", 1, NULL, 2}, {"dport", 1, NULL, 3}, {"txid", 1, NULL, 4}, @@ -112,8 +113,6 @@ int main(int argc, char* argv[]) vector tokens; uint32_t upstream = 0; - cout << "\nDines " << PACKAGE_VERSION << " - The definitive DNS packet forger.\n\n"; - if (argc == 1) { usage(argv[0]); return 1; @@ -139,6 +138,11 @@ int main(int argc, char* argv[]) } break; + case 1: // version + cout << string(PACKAGE_VERSION) << "\n"; + return 0; + break; + case 2: // sport if (optarg[0] == 'F') { p.fuzzSport(); @@ -263,7 +267,6 @@ int main(int argc, char* argv[]) return 0; default: - cout << "Unknown option: " << optarg << endl; return 1; } } @@ -272,6 +275,8 @@ int main(int argc, char* argv[]) return 2; } + cout << "\nDines " << PACKAGE_VERSION << " - The definitive DNS packet forger.\n\n"; + #ifndef DEBUG try { #endif