Page 1 of 1

Get IP address for form.

Posted: Wed Mar 07, 2007 4:23 pm
by nouse4anick
Here is what I have in a web page on my computer:

Code: Select all

<form method="post" action="https://www.wlan.wwu.edu/login.pl" enctype="application/x-www-form-urlencoded" name="bluesocket_u" class="nospace">
<input name="_FORM_SUBMIT" value="1" type="hidden">
<input name="which_form" value="reg" type="hidden">
<input name="destination" value="http://www.google.com/?" type="hidden">
<input name="source" value="140.160.131.111" type="hidden">
<input name="error" value="" type="hidden">
.........
what I need is some bit of code to grab the current ip address from my computer, and replace the 'source' value. I checked javascript and it didn't have what i needed. The CGI code that I found had to be run on the server, the php and perl code also appeared to be server side.

in short what i'm looking for is something like this:

Code: Select all

<form method="post" action="https://www.wlan.wwu.edu/login.pl" enctype="application/x-www-form-urlencoded" name="bluesocket_u" class="nospace">
<input name="_FORM_SUBMIT" value="1" type="hidden">
<input name="which_form" value="reg" type="hidden">
<input name="destination" value="http://www.google.com/?" type="hidden">
<------ some code here that will grab the ip address of my wifi card then print it out formated like this; ----->
<input name="source" value="xxx.xxx.xxx.xxx" type="hidden">
<input name="error" value="" type="hidden">
....
Thanks for any help you guys can give me!
Art
:bow:

Posted: Wed Mar 07, 2007 6:10 pm
by RobertGonzalez
Is that even possible? And you want this to be done in a browser?

Posted: Wed Mar 07, 2007 6:36 pm
by nouse4anick
Everah wrote:Is that even possible? And you want this to be done in a browser?
should be, it should be able to be done with any inline scripting language.

the only other option is to code the output of the post by hand and make a c or python program that gets the ip addy, inserts it, and then transmits it. but why do that when most of it is done for me in the browser?

Posted: Thu Mar 08, 2007 2:52 am
by mikeq
So you are saying that it can be done, but you dont know how to do it.

Well if you dont know how to do it, how on earth are you so confident that it can be done?

Posted: Thu Mar 08, 2007 3:30 am
by nouse4anick
mikeq wrote:So you are saying that it can be done, but you dont know how to do it.

Well if you dont know how to do it, how on earth are you so confident that it can be done?
Considering python, c, java, php, and perl all have functions to return ip addresses, I'm pretty sure what I'm asking for is not impossible. What I am unsure of is how to embed one of those functions into a html file for client side execution.

Now, it might be easier to do a bit of fancy coding and send the data from the post to the intended site addy, in which case any sites that have such info is always welcome. But I'll take just about anything I can get right now.

Posted: Thu Mar 08, 2007 8:03 am
by feyd
In Javascript, it's impossible.

Posted: Thu Mar 08, 2007 12:16 pm
by nouse4anick
feyd wrote:In Javascript, it's impossible.
notice I didn't include that in my list =b

Posted: Thu Mar 08, 2007 12:45 pm
by feyd
There are no other client-side scripting languages that can come close to being guaranteed there.

Posted: Thu Mar 08, 2007 1:18 pm
by nouse4anick
feyd wrote:There are no other client-side scripting languages that can come close to being guaranteed there.
then do you have a suggestion as to how I can encode the data packet to make it look like it was submitted by a web browser?

Posted: Thu Mar 08, 2007 1:41 pm
by nickvd
What are you aiming to accomplish.


Us knowing what you want to do may help us determine if there are any other ways of accomplishing the same task.

Posted: Thu Mar 08, 2007 2:57 pm
by nouse4anick
nickvd wrote:What are you aiming to accomplish.


Us knowing what you want to do may help us determine if there are any other ways of accomplishing the same task.
The above markup is basically ripped from a login page for my school's wifi network. What I want to have happen is when my laptop gets it's ip addy from the network at school, it automatically sends the the post message with the current ip addy to log me in to the network.

I see 3 ways to accomplish this: write a small program that outputs the html page with the code and execute the file (open it in fire fox), write client side code in the html file to grab and print the ip address, or write a program that builds the string and sends it to the address...

So thats what I'm trying to do. If anyone has a webpage for making the output string of the post option and sending it please post it, or on how to grab the ip addy client side, please post it.