Page 1 of 1

Torch via PHP API

Posted: Tue Jun 02, 2009 7:17 pm
by Taisa
Hello. I hope someone will be able to help me. I need to use torch to get client src ip address connecting to the webserver (behind NAT). So far i used simple ssh2_exec to get all stuff that I needed. Unfortunately with torch i get no output. I thought if I use some API I`ll get what I need... But now I`m stuck. I`m not familiar with any kind of API, i`ve tried to use write('tool/torch','=interface=ether2') with no luck - I mean - api is reading the output no end. How to stop command exec for example after 2 seconds? Is it possible? I`ve tried write('/cancel') - no luck... Is it even possible to get any output by this command? Tested on MT 3.17. Thanks in advance 4 all replies.

Re: Torch via PHP API

Posted: Wed Jun 03, 2009 12:35 pm
by Chupaka
Unfortunately, /torch is still not working via API =(

We're waiting and waiting...

Re: Torch via PHP API

Posted: Wed Jun 03, 2009 10:33 pm
by Taisa
Holy shit, thanks for reply. At least I know its impossible... Hmm maybe someone knows how to make it... I have a router under control MT 3.17. Network is routed - static routing (different subnet for main routers and different subnet in each ap for clients) Now each client see only gateway, that of course knows all routes to subnets. On router works NAT.. Now I have a standalone webserver in my network). I`d like redirect specific clients (those not paying) to the serwer where they could see notice... The problem is, that if they connect with the webserver, script that works on it, responsible for displaying the message doesn`t know, who`s acctually looking the page, because client address is NATed on router... First I thought - when client connect to the webserver -script will connect to the router and will check using command /ip firewall connection who`s connected to the server.. Unfortunately it didn`t work (don`t know why) because those connections isn`t shown in ip firewall... at least not on the router. When I`ll check on MT 2.9.51 (some ap between router and the webserver) I see all those connections - of course as src-adddress I see router address. Maybe someone knows a workaround.

Re: Torch via PHP API

Posted: Wed Jun 03, 2009 11:41 pm
by Chupaka
it's toooooooo complicated... =)

why do you need to use src-NAT? you need onlu dst-NAT to redirect users' requests to your webserver

Re: Torch via PHP API

Posted: Thu Jun 04, 2009 12:44 am
by Taisa
Yeah, you`re right... I`ll give an example - client 192.168.1.20--(AP) 192.168.252.20----192.168.252.1(ether-lan)-ROUTER--88.xx.(ether WAN)---Webserver (88.xxx)
So... NAT complicates everything. I`d like to know (true) client IP connected to the webserver - in that case it would be 192.168.1.20. Because of NAT I`ll get 88.xx,xx,... I hope all is clear now :-) That`s why I`ve tried to use torch or connection tracking... With no luck so far :-(

Re: Torch via PHP API

Posted: Thu Jun 04, 2009 12:49 pm
by Chupaka
well, maybe you may use WebProxy, and on your website, read 'X-Forwarded-For' header entry

Re: Torch via PHP API

Posted: Sun Feb 27, 2011 12:51 pm
by eugenevdm
Unfortunately, /torch is still not working via API =(

We're waiting and waiting...
Any update? I'm looking for API sample code that torches, any language will do.