Script to send your public IP address

56 views
Skip to first unread message

Ahmed Aden

unread,
Sep 24, 2013, 8:35:42 PM9/24/13
to bla...@hacdc.org
Wondering if anybody has an easier way to do this.

Does anybody have a script handy to determine what your public IP address would be and email it to you on a regular basis?

Graham Christensen

unread,
Sep 24, 2013, 9:05:40 PM9/24/13
to Bla...@hacdc.org
Do you have a specific interest in emailing it to you? `curl icanhazip.com` is sufficient for me.

Graham

-- 
Graham Christensen
Sent with Sparrow

On Tuesday, September 24, 2013 at 7:35 PM, Ahmed Aden wrote:

Wondering if anybody has an easier way to do this.

Does anybody have a script handy to determine what your public IP address would be and email it to you on a regular basis?

--
--
--
Support HacDC by becoming a member. Learn more and join us here: http://hacdc.org/membership/
--
You received this message because you are subscribed to the HacDC "Blabber" group.
To post to this group, send email to Bla...@hacdc.org
To unsubscribe from this group, send email to
Blabber+u...@hacdc.org
For more options, visit this group at
http://groups.google.com/a/hacdc.org/group/Blabber
 

To unsubscribe from this group and stop receiving emails from it, send an email to Blabber+u...@hacdc.org.

Alberto Gaitan

unread,
Sep 24, 2013, 9:28:29 PM9/24/13
to Bla...@hacdc.org

Do you want it to email you only if it changes, or periodically, regardless?

On Sep 24, 2013 8:35 PM, "Ahmed Aden" <ahme...@gmail.com> wrote:
Wondering if anybody has an easier way to do this.

Does anybody have a script handy to determine what your public IP address would be and email it to you on a regular basis?

--

Ahmed Aden

unread,
Sep 24, 2013, 9:28:39 PM9/24/13
to Bla...@hacdc.org
Well it would be a remote system so I wouldn't know how to get to it if the IP address changes.  It doesn't have to be e-mail, but I'd like to be updated if the IP changes on the remote system I want to access.

Ahmed Aden

unread,
Sep 24, 2013, 9:29:38 PM9/24/13
to Bla...@hacdc.org
Either way.  I figured it would be easier to do it periodically regardless.

Alberto Gaitan

unread,
Sep 24, 2013, 9:31:32 PM9/24/13
to Bla...@hacdc.org

I just finished a Python script that does this. Does the subject machine have sendmail?

Ahmed Aden

unread,
Sep 24, 2013, 9:33:50 PM9/24/13
to Bla...@hacdc.org
I could get it installed.

ITechGeek

unread,
Sep 24, 2013, 9:40:15 PM9/24/13
to HacDC
Is this machine a VPS, colo, etc. or something on a normal home Internet connection (I know Cox does in this area, I think Comcast does as well)?  A lot of home providers block outbound port 25 (smtp) and force you through their SMTP servers..

-----------------------------------------------------------------------------------------------
-ITG (ITechGeek)
I...@ITechGeek.Com
https://itg.nu/
GPG Keys: https://itg.nu/contact/gpg-key
Preferred GPG Key: Fingerprint: AB46B7E363DA7E04ABFA57852AA9910A DCB1191A
Google Voice: +1-703-493-0128 / Twitter: ITechGeek / Facebook: http://fb.me/Jbwa.Net

Alberto Gaitan

unread,
Sep 24, 2013, 9:40:36 PM9/24/13
to Bla...@hacdc.org

I can send you what I have later tonight. Have you considered a dynamic DNS service? If you're not picky about the domain name, there are free solutions. I've used http://freedns.afraid.org. The script I'll send actually updates the ddns record, but can be adapted to just email you when it changes. What OS is the machine running?

ITechGeek

unread,
Sep 24, 2013, 9:41:26 PM9/24/13
to HacDC
Also if you can run sendmail from the machine, all outgoing msgs will have the IP of the sending machine in the headers.

-----------------------------------------------------------------------------------------------
-ITG (ITechGeek)
I...@ITechGeek.Com
https://itg.nu/
GPG Keys: https://itg.nu/contact/gpg-key
Preferred GPG Key: Fingerprint: AB46B7E363DA7E04ABFA57852AA9910A DCB1191A
Google Voice: +1-703-493-0128 / Twitter: ITechGeek / Facebook: http://fb.me/Jbwa.Net


Ahmed Aden

unread,
Sep 24, 2013, 9:55:02 PM9/24/13
to Bla...@hacdc.org
Alberto,

- The machine is running Linux (Debian).
- I'll look into the dynamic DNS service.  In fact, if the hostname is being regularly updated that's all I need.

ITechGeek,

It's actually just a Linux PC (running Cisco virtual routers connected to actual Cisco switches) . The ISP is CLEAR service....maybe a Sprint hotspot down the road.  I don't know if they block outbound SMTP but it's a possibility.

shawn wilson

unread,
Sep 24, 2013, 10:15:45 PM9/24/13
to Bla...@hacdc.org
I agree with doing it wit a dynamic dns provider as well.

On Tue, Sep 24, 2013 at 9:55 PM, Ahmed Aden <ahme...@gmail.com> wrote:

>
> It's actually just a Linux PC (running Cisco virtual routers connected to
> actual Cisco switches) . The ISP is CLEAR service....maybe a Sprint hotspot
> down the road. I don't know if they block outbound SMTP but it's a
> possibility.
>

Clear is resetting your IP? I hope you're wrong about that - it's one
of the things I like best about Clear. I think they do - any provider
that doesn't and I see their users (or software they've downloaded)
doing dumb shit to our mail server.

The other option is to go through a 6to4 (which should be or you could
get to be a static ip).

Ahmed Aden

unread,
Sep 24, 2013, 10:57:51 PM9/24/13
to Bla...@hacdc.org
I don't know if CLEAR is re-setting IPs or not, but I don't want to find out I can't access the server when I need to.

On another note, if you go to clear.com now, it redirects you to Sprint now. I was on the fence about an unlimited 3G hotspot and I may be SOL now.

Ben Mendis

unread,
Sep 24, 2013, 11:42:00 PM9/24/13
to HacDC Public Discussion
I've been using no-ip.com for dynamic dns for years and it has always been reliable. They have updater clients for at least Windows and Linux.

ITechGeek

unread,
Sep 25, 2013, 1:35:48 AM9/25/13
to HacDC
Most ISPs don't reset your IP as long as your equipment stays online.

Only time mine changes is when my cable modem is off for an extended period of time or I change (or reflash) my router.  I think at one point I ended up having the same Comcast IP for over a yr (An UPS is always useful).

6to4 wouldn't be a static because your IPv4 address is in sections 2 & 3 of a 6to4 address.  Although he.net has a tunnel broker service which is 6in4 which is kind of like an unencrypted VPN (note router either needs to be compatible w/ their system as an endpoint or allow protocol 41 through to one of your systems to act as an endpoint).  If you are using a Clear issued modem, it problem doesn't have the capability of being an endpoint itself (I haven't seen one yet that does), I haven't tried 6in4 on Clear and haven't researched their support of protocol 41.

Another option would be a service like Hamachi since seems to have scaled down what they allow for free, but it use to have the nickname "The Gamers VPN" cause everyone on it is on the same Class A (Currently 25/8).  Although if it's just you connecting to one computer from another, it would work if you are allowed to install software.

Another option would be to set-up an email account on Clear (or any other service that allows authenticated SMTP on something other than port 25 which is most services) and set-up a script that sends via authenticated SMTP through a company's regular SMTP server.

Another option if you have access to a web server running somewhere w/ a static IP, have a crontab wget or curl connected to a specific page on a webserver which will log that IP to a txt file (this would probably be my option).  Specific language of the page depends on what your server will run and your preferences.  If your server supports a language you don't know, just ask on here.  crontab and wget or curl are probably already on the machine if it runs Linux (or are easy to install).

If you don't already have webspace that you can set-up a script such as that, I know http://freeshell.org/ offers Perl, Python, and PHP access (maybe more)


-----------------------------------------------------------------------------------------------
-ITG (ITechGeek)
I...@ITechGeek.Com
https://itg.nu/
GPG Keys: https://itg.nu/contact/gpg-key
Preferred GPG Key: Fingerprint: AB46B7E363DA7E04ABFA57852AA9910A DCB1191A
Google Voice: +1-703-493-0128 / Twitter: ITechGeek / Facebook: http://fb.me/Jbwa.Net


Shawn Wilson

unread,
Sep 25, 2013, 5:30:26 AM9/25/13
to Bla...@hacdc.org, Ahmed Aden


Ahmed Aden <ahme...@gmail.com> wrote:
>I don't know if CLEAR is re-setting IPs or not, but I don't want to
>find out I can't access the server when I need to.
>

I'll vouch for Clear on this. I've had the same ip since I've had the service (3~4 years). Through storms, Clear outages, and me outages it had stayed static.

I imagine I could release and renew (somehow) and get a new ip but as my ip is in a number of machines to allow me in, this would cause me work so I'm not testing it.
Reply all
Reply to author
Forward
0 new messages