How to speak HTTP (test web page via telnet)?


Let’s say you’re debugging a problem and you need to test the home page of a site http://WWW.DOMAIN.NAME/

* From a Terminal or Command prompt, do this:

telnet WWW.DOMAIN.NAME 80

* then type:

GET / HTTP/1.0

* then press the Enter(return) key twice!

* it will then spit back the html for that particular url — in this case the “/” just means the home page.

* if you only want to see the HTTP headers and not the whole html of that page, then:

HEAD / HTTP/1.0

* another example?  let’s say you want to test a different page whose URL is http://WWW.DOMAIN.NAME/contact.html.  Then:

GET /contact.html

here’s an example session:

++++++++++++++++++++

~/ $ telnet downtownweb.com 80
Trying 96.44.179.35...
Connected to downtownweb.com (96.44.179.35).
Escape character is '^]'.
HEAD /contact.html HTTP/1.0

HTTP/1.1 200 OK
Server: nginx/1.0.11
Date: Sun, 22 Jan 2012 06:16:28 GMT
Content-Type: text/html
Connection: close
Cache-Control: max-age=3600
Expires: Sun, 22 Jan 2012 07:16:28 GMT
Vary: Accept-Encoding,User-Agent

++++++++++++++++++++

 

P.S. that’s it for now.  i’ll try to show advanced stuff later.

P.P.S. If you’re familiar with the cURL utility — using the HEAD method is the same as running:

curl -I http://WWW.DOMAIN.NAME

No Comments

How to see open/inactive connections on your computer/server? (BSD, Linux, OS X)

To see what network/internet connections are open to your computer OR on your server, run this command from a Terminal:

netstat -anpt

And if you have root or sudo access, then run netstat -anptu if you also want to see the users listed.

Example: to see a list of all open connections from a single username IP address –

netstat -anptu | grep USERNAME

OR from a single IP address –

netstat -anptu | grep IP

Thanks to my coworker for showing me these additional switches and the searching for IP address example on netstat!  I already knew about `netstat -an` and `netstat -rn`.

No Comments

How to speak IMAP? (for testing/debugging problems)

Sometimes you’re not sure where the problem lies with checking email via IMAP in your favorite program such as Thunderbird or Apple Mail or Outlook.

So to see whether it’s a problem with the software you need to speak IMAP directly to your server.

Open a Terminal or Command prompt and run these commands.  **Replace the parts with []‘s with your info AND leave out the brackets!**

+++++++++

telnet [IMAP SERVER NAME] 143

a login [EMAIL@DOMAIN] [PASSWORD]

a list “” “*”

a select inbox

a logout

+++++++++

 

here’s an example:

~~~~~~~~~~~~~~~~~

~/www/ $ telnet mail.sciencefun.net 143
Trying 67.20.121.71…
Connected to sciencefun.net (67.20.121.71).
Escape character is ‘^]’.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
a login test@sciencefun.net dr0wss@p!
a OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS QUOTA] Logged in
a list “” “*”
* LIST (\HasChildren) “.” “INBOX”
* LIST (\HasNoChildren) “.” “INBOX.Sent”
* LIST (\HasNoChildren) “.” “INBOX.Junk”
* LIST (\HasNoChildren) “.” “INBOX.Drafts”
* LIST (\HasNoChildren) “.” “INBOX.Trash”
a OK List completed.
a select INBOX
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $Junk NonJunk $label1 $label4 $label2 $NotJunk)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft $Junk NonJunk $label1 $label4 $label2 $NotJunk \*)] Flags permitted.
* 289 EXISTS
* 0 RECENT
* OK [UNSEEN 170] First unseen.
* OK [UIDVALIDITY 1278944964] UIDs valid
* OK [UIDNEXT 305] Predicted next UID
* OK [HIGHESTMODSEQ 283] Highest
a OK [READ-WRITE] Select completed.
a logout
* BYE Logging out
a OK Logout completed.
Connection closed by foreign host.

~~~~~~~~~~~~~~~~~

P.S. I must research how to retrieve a list of emails and how to retrieve a single email.  Reply if you know how already!

No Comments

How to speak SMTP?

Sometimes when you’re having trouble sending email and none of your troubleshooting has worked so far, you need to connect to your outgoing email server and speak the language to it that your email program speaks when it sends an email:

 

To test outgoing SMTP email, you first need to “base64 encode” these two things:
#1 – your full email address
#2 – your email password

SMTP authentication uses base64 encoding.
Here’s one tool to do that at:
http://www.opinionatedgeek.com/dotnet/tools/base64encode/
Go ahead and do that for both the full email address and the email password and save the output.

Then open up a terminal or a command prompt on your computer.

+++Below is what you will type from it.
Anywhere it has words in all CAPS you will replace that with your domain name for example.
And you will press the Enter key after each line
NOTE also — the lines or words below that are inside of brackets []‘s are just instructions; you do not type those.  But you type everything else.  +++++++++++

telnet mail.DOMAIN.COM 25

ehlo DOMAIN.COM

auth login

[paste in your email address encoded in base64.  Below is an example]
ZW1pbHlAY29tbMNuaXR5Y2h1cmZoZ3JvdXAuY29t

[paste in your password encoded in base64.  Below is an example]
YmBzZAJhbCd=

mail from: YOURADDRESS@DOMAIN.COM

rcpt to: OTHERADDRESS@DOMAIN2.COM

data

From: YOURADDRESS@DOMAIN.COM
To: OTHERADDRESS@DOMAIN2.COM
Subject: test of SMTP

this is a test message
. [type a single dot and then press enter]

quit
+++ end of telnet commands +++

P.S. some outgoing servers will have you use a different port number such as 587 or 26.  Above we used port 25.

1 Comment

Protect your site against hackers!

wow, just came across this report:

http://blog.imperva.com/2011/09/sql-injection-by-the-numbers.html

Just a good reminder of how persistent the hackers(crackers) are.

,

No Comments

How to stop links from opening a new window?

  1. in Firefox, type in the URL of about:config
  2. If it gives you a little warning click yes or “I’ll be careful” or whatever it says.
  3. Search for “browser.link.open”
  4. You’ll see 2 lines that start with that.
  5. Double click “browser.link.open_newwindow” and change it’s number to 3 if it is not already.  Then click Ok.
  6. Double click “browser.link.open_newwindow.restriction” and change it’s number to 0 if it is not already.  Then click Ok.

That’s it. 60 second fix! :)   No more annoying windows popping up cluttering your taskbar/list of windows.  Only tabs to see all at once — much more efficient! :)

No Comments

Are any of your friends/acquaintances relatives?

Check it out via https://apps.facebook.com/relativefinder/

Don’t know what I’m talkin’ bout?!!!   See http://news.byu.edu/archive11-aug-relativefinder.aspx

No Comments

Hurricane charts / maps?

For my peeps along the east coast, get the latest from the NOAA(National Oceanic and Atmospheric Administration)’s NHC(National Hurricane Center):

www.nhc.noaa.gov

No Comments

a death row killer had a change of heart?

Wow, if you haven’t seen this yet, check out this 2 part series in yesterday and today’s Deseret News about Ronnie Gardner who was executed on death row last year, June 2010:

Part #1 — http://www.deseretnews.com/article/700152336/The-weight-of-guilt-Executed-killer-Ronnie-Lee-Gardners-remorse.html

Part #2 — http://www.deseretnews.com/article/700152498/LDS-bishop-recounts-Ronnie-Lee-Gardners-final-days-before-execution.html

(Tip: click on the “PRINT” link above the Page: 1 2 3 … to see it all on one page instead of having to click through the sub-pages one at a time.)

They preface with it:

“a two-part series about notorious murderer Ronnie Lee Gardner and the gradual change of heart he experienced in the final years of his life as he reached out to Dan Bradshaw, a Salt Lake City banker who served as an LDS prison bishop. Bradshaw told his story to Deseret News writer Doug Robinson because he thought it contained a valuable message about people’s ability to examine themselves and make changes in their lives, even in a hard case such as Gardner’s.”

All i can say is wow, this story will make you cringe at times but also cry later on.    There is some pretty strong statements in there — makes you think and feel.  I don’t want to say anything else so as not to give away any more of the story.

I’m glad the Bishop told his story about Ronnie.  Thank you.

No Comments

national map viewer

Suhwheeeeet! Make and print your own topo maps for hikes, trips, etc. Most excellent!

http://viewer.nationalmap.gov

, , ,

No Comments