Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Bash Script To Display Your Ip, Script to display your ip
m3th
post May 16 2005, 10:28 PM
Post #1


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 1
Joined: 16-May 05
Member No.: 5,124



If your behind a router , and like me too lazy to open a browser and find a site that displays your ip , heres a simple Bash script (Bash is a shell in linux, main shell in Slackware Linux)

Open a text editor , copy and paste the following:

CODE

#! /bin/bash

exip=`lynx -dump http://www.whatismyip.com | head -n 2`
echo "$exip"


Save the txt ( for the sake of agrument we will refer the file as ip.sh)
From console type:
chmod a+x ip.sh
Now run the script like so:
./ip.sh (which will display something like the following)
Your IP Is XX.XXX.XXX.XX
Done!

I will explain what we just did in the script.

!# /bin/bash <- Tells what shell we using, this line is always here but /bin/bash may be changed, depending on your system

exip=`lynx -dump http://www.whatismyip.com | head -n 2` <- We setup a variable and run some console commands, lynx is a txt mode browser the we send it to head, which takes only the first to lines.

echo "$exip" <- We echo the content of exip variable to screen

chmoding to a+x just makes the file executable..

I know there a billion ways to do this, but it gets job done ...
Go to the top of the page
 
+Quote Post
moonwitch
post May 27 2005, 08:17 AM
Post #2


Demonic Enforcer
Group Icon

Group: [HOSTED]
Posts: 597
Joined: 2-March 05
From: Belgium
Member No.: 2,861



You could/should also include links instead of lynx. Usually links is installed, for lynx you have to select individual packages, which not everyone does. (I do but that's not the point tongue.gif)

In any way, Links looks better than lynx. And the speed of both is the same smile.gif

It's not a very long tutorial but it's nice.
Go to the top of the page
 
+Quote Post
jet
post May 27 2005, 08:39 AM
Post #3


Advanced Member
Group Icon

Group: Members
Posts: 140
Joined: 24-April 05
From: Australia
Member No.: 4,289



Nice tutorial.. Though my IP changes every once in a while and I've never had to know it for anything. But if we ever get stuck in linux and need to know .. smile.gif
Go to the top of the page
 
+Quote Post
OldSkuBoi
post May 27 2005, 08:14 PM
Post #4


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 27
Joined: 22-May 05
Member No.: 5,334



lol nice tuturial. I would use it but, my ip stays the same. Been the same ip for like over 1 year. Maybe i should reset my ip.
Go to the top of the page
 
+Quote Post
saneax
post Sep 2 2005, 06:42 AM
Post #5


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 72
Joined: 1-September 05
Member No.: 8,237



nice script..I find it usefull.. good work!
Go to the top of the page
 
+Quote Post
SiriusRo
post Dec 11 2007, 04:35 AM
Post #6


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 14
Joined: 11-December 07
Member No.: 26,812



Does this display my ip address or the person who is looking at the script's ip address, or does it show everyone my ip address
Go to the top of the page
 
+Quote Post
toby
post Dec 11 2007, 01:18 PM
Post #7


Premium Member
Group Icon

Group: Members
Posts: 422
Joined: 29-September 06
Member No.: 16,228



Bash is non-windows Command Prompt.

Nice idea, I'm surprised it works.
Go to the top of the page
 
+Quote Post
ethergeek
post Dec 11 2007, 05:13 PM
Post #8


Premium Member
Group Icon

Group: [HOSTED]
Posts: 393
Joined: 9-March 07
From: Tucson, AZ
Member No.: 20,794



QUOTE(moonwitch @ May 27 2005, 01:17 AM) *
You could/should also include links instead of lynx. Usually links is installed, for lynx you have to select individual packages, which not everyone does. (I do but that's not the point tongue.gif)

In any way, Links looks better than lynx. And the speed of both is the same smile.gif

It's not a very long tutorial but it's nice.


Why lynx? wget is more common on unix based default installs these days than lynx or links or elinks (or any other text browser for that matter).
Go to the top of the page
 
+Quote Post
Feedbacker
post Apr 21 2008, 02:10 PM
Post #9


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



Null password at Freewebs
Bash Script To Display Your Ip

I accidentally pressed Enter key without assigning a new password in my freewebs.Com site. Now they say my password is "null".

Any help available to recover my site?

-reply by Cherian
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How To Save A Image In Pdf File And Download It?(10)
  2. Very Simple Login-script(18)
  3. A Simple Register Script(1)
  4. Volume Control icon disappeared(6)
  5. Myspace Gold Script(1)
  6. Question About Asp Now() Function(6)
  7. Running Vba Script In Excel(5)
  8. Attack Script In Php(5)
  9. Disable Display Properties Tabs(2)
  10. Rpg For (php)wml Script Text Based(1)
  11. Free Login Script(1)
  12. Looking For Script(1)
  13. Php Login Script(0)
  14. Create And Import JavaScript Modules For A Large Script(2)
  15. Script Request(2)
  1. Love Script(3)
  2. Need Help With A PHP - MySQL Registration Script(11)
  3. Coppermine Random Image Script(6)
  4. Php Script To Download File From Another Site(9)
  5. Help Needed To Create Windows Startup Script!(4)
  6. How Can I Create A "number Of Visitors" Script(8)
  7. How To Make A Text Based Online Game Script ?(22)
  8. PHP: Writing A Generic Login And Register Script(13)
  9. Finishing The Look Of Your Newly Install Web Script(2)
  10. Live Messenger Display Pic Problem(5)
  11. Proxy And Network Drive Script(2)
  12. PHP Tutorial: Form Verification And Simple Validation(11)
  13. Windows XP Logon Script(11)
  14. Mysql Script Help(3)
  15. Make A Script Run Even If No User Is Online(6)


 



- Lo-Fi Version Time is now: 7th July 2008 - 02:03 AM