From 0bc97e71fe6cbeaf21b82ef96fdbdd79a3e00cdd Mon Sep 17 00:00:00 2001 From: tieshagr Date: Thu, 6 Mar 2025 14:58:38 +0300 Subject: [PATCH] beta 0.3 --- src/my_app | Bin 76232 -> 0 bytes src/my_check_params.cpp | 44 ++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 22 deletions(-) delete mode 100755 src/my_app diff --git a/src/my_app b/src/my_app deleted file mode 100755 index 8d68b8b54e69c0a4b77d471b54463553b451ba0c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 76232 zcmeHt4Rl<^m1cFfYzt$IYz&y6;Ai82F}SUk1pdJ!lI6Cn_)n4KtRd_^J#{}z9rvHR zpKJ-UK>>ExldxF?J_DHm>oA#(&0!}_CYzYq*@;7#94BFCoj|hAOhVd%?06P-*TmTw z>tMO}yYsMZ!>I?7W%@yVA0%odIb{~fw#rc1GHAuy7*XGG|FVYvgNVJFKCRnoJlu$Rtfv2o z8slxR5$Clv^f%Us=i4>>^wb#FGr+6G|18p`TKo^zz&~AMyvu9oe^4XNjvD$ut%1|p zvheX=V>SGLz6PJP>@2?%$amGiY2U5J+fSfhjkjayUnh@D6$JcMHp3=i8`+@LaPCkX=Wy^Yh0(dmgI zF0$Qx`6<=HGk~)*4ePtzR2EY|UGq`~k^`PQm8lc0k~OhjeOy1=)(BrklGDF^U6Cs~? zNcfpfEHtEKCgvo?jw0qWvc|T(!CYn^ng+1FVNGOm)1EXe#kM5+um=;^ZLy@gV%?j2 znz8xqNbgIe<94^3A4*}*rJXsp8(ZXVdzX_)GOS%N%`#bR*jS#}avd8}Kb!znv?yuc zrL8>WB+{~ZSAy2$LoQ3XsaPt@i|hz<`ZGC?4Y(eBVN7ZAHr3g{5cUEFhj}j^yYo&u z;@(5zKny*I126R^@u~;nj`nuDIo!zFckXOk-)Tp}&8%Zf=X!{MTf)svx~SK~O%Wm5 zP2tF@Qnk57+_LCQNq-^!zYfnEb$B+K35ja-e+I9W*Jq)n9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z>Gwn(hgtu@=JX`E=BerD)`E-G=B9ynkrA>`*^x& zj8s+j^bI0iaeN3b^-qep)cYXneKvuLxl(m1llaiPV#;2=ZcsPZ@&|s#N_zgaW;02QCyYcc%jbD}Tq4{cjRG8|0 z)M06_^pqDRtCGHlr`%Ka>UY>tX>ZAik;}T2zbdW(21H|0_Ub*PLl;GleZB#!epNZs zXFs(Ph2iQN_QE@3bI?w{RR8LCkku3zt~31q)IZg)Lgqn@G#eElOJ)CIA1=HK8)_n1 z<*u&UC;K0jMBR+WetcB_YF*Rs>ne8LzCeND`WQ{FcB%dqM9Z_9{qn^^^G2V6Ph|fG D%2N;8 diff --git a/src/my_check_params.cpp b/src/my_check_params.cpp index ac479f0..e45634d 100644 --- a/src/my_check_params.cpp +++ b/src/my_check_params.cpp @@ -14,7 +14,8 @@ // -10 - Пользователь выбрал тип атаки порт сканнинг, но не ввел нужные параметры // -20 - Пользователь выбрал тип атаки флуд, но не ввел нужные параметры // -100 - неизвестная ошибка -// -101 - неизвестная опция, следует предложить вызвать флаг помощи +// -101 - неизвестная опция или потерян аргумент, следует предложить вызвать флаг помощи +// -600 - пользователь ввел токен, но не id или наоборот // Какие-то еще коды? int my_check_params(int argc, char** argv) { @@ -60,20 +61,20 @@ int my_check_params(int argc, char** argv) { opts.telegram_token = optarg; break; case 'h': - std::cout << "Usage: " << argv[0] << " [options]\n" - << "Required:\n" - << " -a, --attack TYPE Type of attack (scan|flood)\n" - << " -d, --domain DOMAIN Target domain\n" - << " -i, --ip IP Target IP\n" - << " -p, --port PORT Port. Required only for flood type!\n" - << "Optional:\n" - << " -l, --log FILE Log file\n" - << " -t, --telegram ID Telegram ID\n" - << " -b, --token TOKEN Telegram bot token\n"; + // std::cout << "Usage: " << argv[0] << " [options]\n" + // << "Required:\n" + // << " -a, --attack TYPE Type of attack (scan|flood)\n" + // << " -d, --domain DOMAIN Target domain\n" + // << " -i, --ip IP Target IP\n" + // << " -p, --port PORT Port. Required only for flood type!\n" + // << "Optional:\n" + // << " -l, --log FILE Log file\n" + // << " -t, --telegram ID Telegram ID\n" + // << " -b, --token TOKEN Telegram bot token\n"; status = 0; break; case '?': - std::cerr << "Unknown option!\n.--help for info\n"; + // std::cerr << "Unknown option!\n.--help for info\n"; status = -101; break; default: @@ -84,34 +85,33 @@ int my_check_params(int argc, char** argv) { // Проверка обязательных параметров - if (status != 0) + if (status != 0 && status != -101) { if (opts.attack_type != "flood" && opts.attack_type != "scan") { - std::cerr << "Error: Missing required parameters!\n--help for more info\n"; + // std::cerr << "Error: Missing required parameters!\n--help for more info\n"; status = -1; } else if (opts.attack_type == "scan" && (opts.domain.empty() || opts.ip.empty())) { - std::cerr << "Error: Missing required parameters!\n--help for more info\n"; + // std::cerr << "Error: Missing required parameters!\n--help for more info\n"; status = -10; } else if (opts.attack_type == "flood" && (opts.domain.empty() || opts.ip.empty() || opts.port.empty())) { - std::cerr << "Error: Missing required parameters!\n--help for more info\n"; + // std::cerr << "Error: Missing required parameters!\n--help for more info\n"; status = -20; } + else if ((!opts.telegram_id.empty() && opts.telegram_token.empty()) || (opts.telegram_id.empty() && !opts.telegram_token.empty())) { + status = -600; + } else if (opts.attack_type == "scan" && !opts.domain.empty() && !opts.ip.empty()) { - std::cerr << "Error: Missing required parameters!\n--help for more info\n"; + // std::cerr << "Error: Missing required parameters!\n--help for more info\n"; status = 1; } else if (opts.attack_type == "flood" && !opts.domain.empty() && !opts.ip.empty() && !opts.port.empty()) { - std::cerr << "Error: Missing required parameters!\n--help for more info\n"; + // std::cerr << "Error: Missing required parameters!\n--help for more info\n"; status = 2; } // Какие-то еще коды? } - - - - return status; } \ No newline at end of file