Article delegate-en/4474 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
[Reference:<_A4472@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: NAT odst available to scripts on DeleGate
28 May 2009 09:07:48 GMT feedback@delegate.org (Yutaka Sato)
The DeleGate Project


Hi,

In message <_A4472@delegate-en.ML_> on 05/28/09(11:30:57)
you =?ISO-8859-1?Q?Guilherme_V=EAnere?= <pniiqbdyi-j73qrjk4emlr.ml@ml.delegate.org> wrote:
 |I'm afraid I need to bother you a little more. As I explained before,

Questions on advanced usages of DeleGate, as yours, are very helpful
and welcome.
But those in anonymous mails are treated in low priority.
Although I don't like to know personal information of a user, but
generic attributes especially the nationality of him/her, or where
he/she is, are helpful to understand the question and to make answer.

 |I'm trying to use DeleGate as a generic proxy on a machine i'm
 |configuring to study malware behaviour. As such, I'm redirecting all
 |traffic to any external IP to my gateway address, where I receive the
 |connection with DeleGate. I'm using NAT with iptables on Linux to do
 |the redirection.
 |
 |But when DeleGate run my script (with XCOM=script.pl or
 |XFIL=script.pl) I want to have access to the original IP:PORT. I
 |tought the best way to have access to those values would be by
 |environment variables, so I looked at src/filter.c, and found the code
 |where you create the variables, and tried to add the following code
 |there:
...
 |+	sprintf(env,"ORIG_DST1=%s",Origdst_Host); putenv(stralloc(env));
 |+	sprintf(env,"ORIG_PORT1=%d",Origdst_Port); putenv(stralloc(env));
...
 |It create the variables but they are empty. I'm pretty sure there is
 |something else I need to do to make this work, but i can't figure it
 |out.

Those values in Origdst_XXXX is filled only if "odst.-" is used
somewhere in configuration parameters, or the option

 -Eao

is specified.  So just add "-Eao" to your command line options for DeleGate.
I'll add environment variable "ORIGINAL_SERVER_NAME" and
"ORIGINAL_SERVER_PORT" as the enclosed patch in the next release.

Cheers,
Yutaka
--
  9 9   Yutaka Sato <y.sato@delegate.org> http://delegate.org/y.sato/
 ( ~ )  National Institute of Advanced Industrial Science and Technology
_<   >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan
Do the more with the less -- B. Fuller

*** dist/src/delegate9.9.4-pre3/src/filter.c	Sat Jan  3 12:18:29 2009
--- ./src/filter.c	Thu May 28 17:53:50 2009
***************
*** 1427,1434 ****
--- 1427,1439 ----
  	sprintf(env,"SERVER_NAME=%s",host); putenv(stralloc(env));
  	sprintf(env,"SERVER_PORT=%d",port); putenv(stralloc(env));
  	}
  
+ 	if( lORIGDST() ){
+ 	sprintf(env,"ORIGINAL_SERVER_NAME=%s",Origdst_Host); putenv(stralloc(env));
+ 	sprintf(env,"ORIGINAL_SERVER_PORT=%d",Origdst_Port); putenv(stralloc(env));
+ 	}
+ 
  	serv = DST_HOST;
  	sprintf(env,"SERVER_HOST=%s",serv); putenv(stralloc(env));
  	if( addr = gethostaddr(serv) )
  	{

  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V