![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MPAA Sets Up Fake Site to Catch Pirates - Slashdot | iBot | UNIX and Linux RSS News | 0 | 07-07-2007 05:10 PM |
| system Fake IPs | ppass | SUN Solaris | 2 | 04-26-2005 09:33 AM |
| Static | wojtyla | High Level Programming | 6 | 02-25-2005 07:57 AM |
| Fake System32 Folder | Kimm | Linux | 2 | 08-23-2004 07:25 AM |
| Static IP | IP Networking | 7 | 05-18-2003 04:33 PM | |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
I'm working on a script that runs on remote hosts and sends their dynamic IP address' to a server (which of course has statics).
All the client computers run linux (as does the server). basically... the idea was: 1) Host a webpage on the server with a php script that displays only the IP address of the client. I accomplished this with code: <?php echo $_SERVER['REMOTE_ADDR']; ?> 2) run a script (in a cron job) that queries the the server for its current IP, then checks it against the the last known IP. If its changed, it sends the updated IP address to the server. (the use the lynx domain.com/ip --dump command to get my public IP) -- So... I have two questions. (maybe more)... 1) What do you guys think the best solution is to get the IP and hostname back to the server? I have shell access to all computers, so I thought scp at first... but a few of the computers have users I don't necessarily trust, so I really didn't want to use scp in a script... 2) I also would like to make a url forward to that computer... How can I for example: "ssh user@domain.com/remote1" and have the php script (or any kind of script) redirect (...route) me to the remote hosts IP? This is something I've been working on for a while... I realize it may not be the most elegant approach, but its what I came up with after much, much deliberation. So any Ideas... experinces... advise will be greatly appreciated! Btw, This might be the first time I've ever posted an actual question about linux or anything for that matter. I can always find the answers I need by searching and reading... even if it takes weeks to figure out one little thing. So I wouldn't ask If I felt I could just google it and find the answers. Last edited by heith; 02-21-2007 at 10:01 PM. Reason: add icon so I would draw your attention :) |
| Forum Sponsor | ||
|
|
|
||||
|
The Script...
ok, I don't think I explained it well enough.
I think it will be easier if I just paste the script... then you can pick it apart. Code:
#!/bin/bash BASEDIR=~/scripts/fsip ##The name of the folder you keep all your text files NEWIP=$BASEDIR/newip ##Location of the text file that will store the address of the CLIENT SERVER=example.com ##Name of the server that hosts the IP RHOME=/home/fsip/ ##Target Directory on the server (the location of the SERVER script) GETIP=example2.com/ip ##The server[s] that send back the Clients public IP. (calls a webpage with this php code: <?php echo $_SERVER['REMOTE_ADDR']; ?>) PUBIP=`lynx -dump $GETIP` ##Getting the CLIENT's current ip address (of course this requires lynx... elinks should work too) #----------------------------------------------------------------------------------------------- if [ "$PUBIP" != "$NEWIP" ]; then echo $PUBIP > $NEWIP scp $NEWIP $SERVER:$RHOME/`hostname`-ip.txt fi If anyone cares... (which I doubt because no one took the time to respond) I came up with a better solution with the help of a php guru. If you interested in a fake static IP, email me. Last edited by heith; 03-02-2007 at 06:41 AM. Reason: typo |
||||
| Google UNIX.COM |