Skip to content

Commit

Permalink
configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lomasterrrr committed Feb 10, 2025
1 parent 4d81dbe commit d0431c8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 12 deletions.
25 changes: 21 additions & 4 deletions nescadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ NESCAPORT *NESCATARGET::get_real_port(size_t id)
void NESCATARGET::add_service(NESCAPORT *port, int service,
struct timeval tstamp1, struct timeval tstamp2)
{
NESCASERVICE res;
NESCASERVICE res={};

res.rtt.tstamp1=tstamp1;
res.rtt.tstamp2=tstamp2;
Expand Down Expand Up @@ -338,9 +338,11 @@ void NESCATARGET::add_info_service(NESCAPORT *port, int service,
NESCASERVICE *_service=nullptr;
NESCAINFO i={};

for (auto &s:port->services)
for (auto /* dont touch & */&s:port->services)
if (s.service==service)
_service=&s;
if (!_service)
return;

i.info=info;
i.type=type;
Expand Down Expand Up @@ -1267,12 +1269,27 @@ void NESCAOPTS::set_badsum_flag(void) { this->badsum_flag=1; }
bool NESCAOPTS::check_badsum_flag(void) { return this->badsum_flag; }



/*
* -cfg <cfg_param>
*/
void NESCAOPTS::set_cfg_flag(void) { this->cfg_flag=1; }
void NESCAOPTS::set_cfg_param(const std::string &cfg_param) { this->cfg_param=cfg_param; }
void NESCAOPTS::set_cfg_param(const std::string &cfg_param)
{
std::string newpath;
size_t i;
bool t;
for (i=t=0;i<cfg_param.length();i++) {
if (cfg_param.at(i)=='-'&&cfg_param.at(i+1)=='-') {
newpath="resources/config/";
t=1;
i+=2;
}
if (t) newpath+=cfg_param[i];
}
if (newpath.empty())
newpath=cfg_param;
this->cfg_param=newpath;
}
std::string NESCAOPTS::get_cfg_param(void) { return this->cfg_param; }
bool NESCAOPTS::check_cfg_flag(void) { return this->cfg_flag; }

Expand Down
2 changes: 1 addition & 1 deletion nescaprint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ void NESCAPRINT::usage(int argc, char **argv)
-dhex <hexseq> - append a custom data to packet
-dstr <str> - append a custom ASCII data to packets
-ttl <num> - set Time To Live, (TTL)
-win <num> - set your TCP window siz, default 1024
-win <num> - set your TCP window size, default 1024
-ackn <num> - set TCP acknowledgment number
-off <flag1[/flag2]...,> - set fragmentation OFFset: df,mf,rf
-ipopt <hex> - set ip options to packet
Expand Down
13 changes: 6 additions & 7 deletions nescaservices.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ void send_http(struct http_request *r, NESCADATA *ncsdata, NESCATARGET *target,
struct timeval s, e;
size_t pos;

pos=0;
dns=ncsdata->rawtargets.getdns(target->get_mainip());
if (!dns.empty())
http_add_hdr(r, "Host", dns.c_str());
Expand All @@ -313,16 +312,16 @@ void send_http(struct http_request *r, NESCADATA *ncsdata, NESCATARGET *target,
gettimeofday(&s, NULL);
http_qprc_pkt(target->get_mainip().c_str(), port, timeout, r, &response, resbuf, HTTP_BUFLEN);
res=(char*)resbuf;
gettimeofday(&e, NULL);

target->add_service(target->get_real_port(pos), S_HTTP, s, e);
for (pos=0;pos<target->get_num_port();pos++)
if (target->get_port(pos).port==port)
break;

if (!res.empty())
target->add_service(target->get_real_port(pos), S_HTTP, s, e);
http_qprc_redirect(response.hdr, resbuf, redirect, HTTP_BUFLEN);
if (!std::string(redirect).empty()) {

for (pos=0;pos<target->get_num_port();pos++)
if (target->get_port(pos).port==port)
break;
gettimeofday(&e, NULL);
target->add_info_service(target->get_real_port(pos),
S_HTTP, (char*)redirect, "redirect");

Expand Down
8 changes: 8 additions & 0 deletions resources/config/a.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'gmax'=2000;
'gplus'=500;
'gmin'=555;
'pe'=1;
'syn'=1;
'maxfds'=350;
's'=http:80,81,8080,8081,ftp:21,20;
'dlen'=33;
11 changes: 11 additions & 0 deletions resources/config/j.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'gmax'=2000;
'gplus'=500;
'gmin'=555;
'all-ping'=1;
'syn'=1;
'xmas'=1;
'fin'=1;
'null'=1;
'window'=1;
'maxfds'=30;
's'=http:80,81,8080,8081,ftp:21,20;

0 comments on commit d0431c8

Please sign in to comment.