Showing posts with label ascii. Show all posts
Showing posts with label ascii. Show all posts

Tuesday, June 2, 2009

Happy Birthday Ian! You're 6 Years Old Today :)

Hey There,

This post is dedicated to my son, Ian, who just turned 6 today (well, actually yesterday, but - as most regular readers know - I publish a day in advance. Makes life confusing sometimes ;)

The ASCII art I used as an inspiration for the scripts below was, again, grabbed from Joan Stark's ASCII Art Gallery, which is a great place to find quality ASCII art for almost any occasion.

The second bash script below, as usual, contains X's where spaces should be, so you don't get a bad pull from a copy/paste off of the web page.

Not much more to say except:

Click the greeting below to see it in IMAX ;)

Happy Big Number Six!

Cheers,


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License



#!/bin/bash

#
# ibday.sh - Happy Birthday Ian!
#
# 2009 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

echo -ne "\n ~ ~\n * * * *\n * *\n ~ * * ~ * \n * ~ * * ~\n ) ( ) *\n * ~ (_) (_) (_) *\n * # ) ) # ( # *\n _ .-#(_)- -(_)# - - -(_)#-. _ \n * .' # # # # # # \`. ~ *\n : # # # : \n ~ :. # # # .: *\n * | \`-.__ __.-' | *\n | \`\`\`\`\`\"\"\"\"\"\"\"\"\"\"\"\`\`\`\`\` | *\n * | | ||\ |~)|~)\ / | \n | |~||~\|~ |~ | | ~\n ~ * | | * \n | |~)||~)~|~| ||~\|\ \ / | *\n * _.-| |~)||~\ | |~|| /|~\ | |-._ \n .' '. ~ ~ .' \`. *\n jgs : \`-.__ __.-' :\n \`. \`\`\`\`\`\"\"\"\"\"\"\"\"\"\"\"\`\`\`\`\` .'\n \`-.._ _..-'\n \`\`\`\`\`\"\"\"\"-----------\"\"\"\"\`\`\`\`\`\n\n # #\n # # ## ##### ##### # #\n # # # # # # # # # #\n ####### # # # # # # #\n # # ###### ##### ##### #\n # # # # # # #\n # # # # # # #\n \n ######\n # # # ##### ##### # # ##### ## # #\n # # # # # # # # # # # # # #\n ###### # # # # ###### # # # # #\n # # # ##### # # # # # ###### #\n # # # # # # # # # # # # #\n ###### # # # # # # ##### # # #\n \n ### # # #\n # # # ## #\n # # # # # #\n # # # # # #\n # ####### # # #\n # # # # ##\n ### # # # #\n \n # #\n ### ###\n # #\n \n # #\n # #\n # #\n ###\n"



#!/bin/bash

#
# xbday.sh - Happy Birthday Ian!
#
# 2009 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

echo -ne "\nXXXXXXXXXXX~XXXXXXXXXXXXXXXXXX~\nXXXXX*XXXXXXXXXXXXXXXXXXX*XXXXXXXXXXXXXXXX*XXXXXXX*\nXXXXXXXXXXXXXXXXXX*XXXXXXXXXXXXXXX*\nXX~XXXXXXX*XXXXXXXXXXXXXXXX*XXXXXXXXX~XXXX*XXXXXXXXXX\nXXXXXXXXXXXXXX*XXXXXXX~XXXXXXXX*XXXXXXXXXXXXXX*XXX~\nXXXXXXXXXXXXXXXXXX)XXXXXXXXX(XXXXXXXXX)XXXXXXXXXXXXXX*\nXXXX*XXXX~XXXXXXX(_)XXXXXXX(_)XXXXXXX(_)XXXX*\nXXXXXXXXXXX*XXXXXX#X)XXXXX)X#XXXXXXX(X#XXXXXXXXXXX*\nXXXXXXXXXXXXXX_X.-#(_)-X-(_)#X-X-X-(_)#-.X_XXXX\nXX*XXXXXXXXX.'XXXX#X#XXXXX#X#XXXXXXX#X#XXXX\`.XXX~XXXXX*\nXXXXXXXXXXX:XXXXXXXX#XXXXX#XXXXXXXXX#XXXXXXXX:XXX\nXXXX~XXXXXX:.XXXXXXX#XXXXX#XXXXXXXXX#XXXXXXX.:XXXXXX*\nXXXXXXXX*XX|X\`-.__XXXXXXXXXXXXXXXXXXXXX__.-'X|X*\nXXXXXXXXXXX|XXXXXX\`\`\`\`\`\"\"\"\"\"\"\"\"\"\"\"\`\`\`\`\`XXXXXX|XXXXXXXXX*\nXXXXX*XXXXX|XXXXXXXXX|X||\X|~)|~)\X/XXXXXXXXX|XXXX\nXXXXXXXXXXX|XXXXXXXXX|~||~\|~X|~XX|XXXXXXXXXX|XXXXXXX~\nXXX~XXX*XXX|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX|X*X\nXXXXXXXXXXX|XXXXXX|~)||~)~|~|X||~\|\X\X/XXXXX|XXXXXXXXX*\nXXX*XXXX_.-|XXXXXX|~)||~\X|X|~||X/|~\X|XXXXXX|-._XX\nXXXXXX.'XXX'.XXXXXX~XXXXXXXXXXXX~XXXXXXXXXXX.'XXX\`.XX*\nXXjgsX:XXXXXX\`-.__XXXXXXXXXXXXXXXXXXXXX__.-'XXXXXX:\nXXXXXXX\`.XXXXXXXXX\`\`\`\`\`\"\"\"\"\"\"\"\"\"\"\"\`\`\`\`\`XXXXXXXXX.'\nXXXXXXXXX\`-.._XXXXXXXXXXXXXXXXXXXXXXXXXXXXX_..-'\nXXXXXXXXXXXXXX\`\`\`\`\`\"\"\"\"-----------\"\"\"\"\`\`\`\`\`\n\nXXXXXXXXXXX#XXXXX#\nXXXXXXXXXXX#XXXXX#XXXX##XXXX#####XXX#####XXXX#XXX#\nXXXXXXXXXXX#XXXXX#XXX#XX#XXX#XXXX#XX#XXXX#XXXX#X#\nXXXXXXXXXXX#######XX#XXXX#XX#XXXX#XX#XXXX#XXXXX#\nXXXXXXXXXXX#XXXXX#XX######XX#####XXX#####XXXXXX#\nXXXXXXXXXXX#XXXXX#XX#XXXX#XX#XXXXXXX#XXXXXXXXXX#\nXXXXXXXXXXX#XXXXX#XX#XXXX#XX#XXXXXXX#XXXXXXXXXX#\nXXXXX\nXXX######\nXXX#XXXXX#XXXXX#XXXX#####XXXX#####XX#XXXX#XX#####XXXXX##XXXXX#XXX#\nXXX#XXXXX#XXXXX#XXXX#XXXX#XXXXX#XXXX#XXXX#XX#XXXX#XXX#XX#XXXXX#X#\nXXX######XXXXXX#XXXX#XXXX#XXXXX#XXXX######XX#XXXX#XX#XXXX#XXXXX#\nXXX#XXXXX#XXXXX#XXXX#####XXXXXX#XXXX#XXXX#XX#XXXX#XX######XXXXX#\nXXX#XXXXX#XXXXX#XXXX#XXX#XXXXXX#XXXX#XXXX#XX#XXXX#XX#XXXX#XXXXX#\nXXX######XXXXXX#XXXX#XXXX#XXXXX#XXXX#XXXX#XX#####XXX#XXXX#XXXXX#\nXXXXX\nXXXXXXXXXXXXXXX###XXXXXX#XXXX#XXXXX#\nXXXXXXXXXXXXXXXX#XXXXXX#X#XXX##XXXX#\nXXXXXXXXXXXXXXXX#XXXXX#XXX#XX#X#XXX#\nXXXXXXXXXXXXXXXX#XXXX#XXXXX#X#XX#XX#\nXXXXXXXXXXXXXXXX#XXXX#######X#XXX#X#\nXXXXXXXXXXXXXXXX#XXXX#XXXXX#X#XXXX##\nXXXXXXXXXXXXXXX###XXX#XXXXX#X#XXXXX#\nXXXXX\nXXXXXXXXXXXXXXXXXXXXXX#XXX#\nXXXXXXXXXXXXXXXXXXXXX###X###\nXXXXXXXXXXXXXXXXXXXXXX#XXX#\nXXXXXXXXXXXXXXXXX\nXXXXXXXXXXXXXXXXXXXXX#XXXXX#\nXXXXXXXXXXXXXXXXXXXXX#XXXXX#\nXXXXXXXXXXXXXXXXXXXXXX#XXX#\nXXXXXXXXXXXXXXXXXXXXXXX###\n"




, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Monday, May 25, 2009

Memorial Day ASCII Art For Linux And Unix

Happy Memorial Day

I'm always curious about how to type that, since this Holiday is a way of keeping the memories of our fallen soldiers alive. We're celebrating (and I mean that in the most somber sense of the word) fellow countrymen who've died fighting wars for our country. In any event, we salute them. If an exclamation point is warranted, please feel free to mentally tag it on.

The piece of ASCII art that was the inspiration for my script today was, again, found on Joan Stark's wonderful and eclectic ASCII Art Site. There's a lot of great stuff over there, even ASCII animations.

A happy Memorial Day to you all, and a silent prayer that, one day, the list of our dead will no longer continue to grow.

Click the ASCII art US Flag below and remember

The United States Flag.  Memorial Day


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/bin/bash

#
# memorial.sh -
#
# 2009 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

echo -en " (_)\n <___>\n | |______\n | |* * * )\n | | * * (_________\n | |* * * |* *|####)\n | | * * *| * | (________________\n | |* * * |* *|####|##############|\n | | * * *| * | | |\n | |* * * |* *|####|##############|\n | |~~~~~~| * | | |\n | |######|* *|####|##############|\n | | |~~~' | |\n | |######|########|##############|\n | | | | |\n | |######|########|##############|\n | |~~~~~~| | |\n | | |########|##############|\n | | '~~~~~~~~| |\n | | |##########JGS#|\n | | '~~~~~~~~~~~~~~~\n | |\n | |\n | |\n"


, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Sunday, April 12, 2009

An Easter Story: More ASCII Art For Linux And Unix

Hey There,

It's yet another holiday that we haven't ASCII'ed yet, and we've got another script to print a somewhat-tame Easter story, and picture, to your terminal. Yet again, I've gone back to Joan Stark's ASCII Art Gallery to find a really good picture. And I don't just pick her site because it comes up as Google search result number one for every query I run; there actually is an enormous quantity of high quality ASCII art there. Check it out if you still haven't.

If you're interested in any of our other ASCII art holiday script postings, just check out this page, which is a general search for ASCII Art on our site and you're sure to find most of them there.

If the pictorial representation of the script output below isn't large enough, click on it once to be smacked in the face with the HUMONGOUS version ;)

easter ASCII art

For this installment, I've attached two scripts to the post. The first one is the straight-up bash script. The second is the same script, except with all the spaces padded with "X"'s. If you're having problem maintaining the spaces when you copy/paste the original script, just copy/paste the padded one and then (in vi, or whatever your favorite editor is) substitute "X" with a space character for all occurrences. In vi, that would be an "ex" command like:

[esc]:g/X/s// /g

or

[esc]:%s// /g

Enjoy and Happy Easter :)


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License



REGULAR

#!/bin/bash

#
# easter.sh
#
# 2009 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

echo -en "...THE FIRST EASTER BUNNY... by Francine M. O'Connor\n (ASCII Art by joan stark)\n\n __ /^\\\\\n .' \ / :.\ This is the story of a long-eared rabbit\n / \ | :: \ who couldn't learn to do the bunny hop.\n / /. \ / ::: | His ears were floppy, his feet were sloppy,\n | |::. \ / :::'/ he'd hippity hop, then he'd trip and plop.\n | / \::. | / :::'/\n \`--\` \' \`~~~ ':'/\`\n / ( So this little rabbit developed the habit\n / 0 _ 0 \ of staying awake when the sun went down.\n \/ \_/ \/ He'd stay up all night, \n -== '.' | '.' ==- till the morning light, and \n /\ '-^-' /\ practice his hopping just outside of town.\n \ _ _ / \n .-\`-((\o/))-\`-. \n _ / //^\\ \ _ On the first Easter morn, \n.\"o\".( , .:::. , ).\"o\". just before dawn,\n|o o\\\\\ \:::::/ //o o| He was startled by a bright\n \ \\\\\ |:::::| // / and blinding light.\n \ \\\\\__/:::::\__// / And Jesus was there in the \n \ .:.\ \`':::'\` /.:. / shimmering glare,\n \':: |_ _| ::'/ smiling at that funny bunny's plight.\n jgs \`---\` \`\"\"\"\"\"\` \`---\`\n \n Don't worry, little lad, and don't be so sad, .-\"-.\n for humankind will celebrate this special day. .'=^=^='.\n You must bring the word to every beast and bird /=^=^=^=^=\\\\\n that I have risen and am in the world to stay. :^= HAPPY =^;\n |^ EASTER! ^|\n You should've seen that cottontail hop away, :^=^=^=^=^=^:\n feeling mighty proud to be the chosen one. \=^=^=^=^=/\n Though this story is quite old, it can now be retold \`.=^=^=.'\n to make little children smile on Easter morn. \`~~~\`\n"



PADDED
#!/bin/bash

#
# easter.padded.sh
#
# 2009 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

echo -en "...THEXFIRSTXEASTERXBUNNY...XbyXFrancineXM.XO'Connor\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX(ASCIIXArtXbyXjoanXstark)\n\nXXXXXX__XXXXXXXXXXXX/^\\\\\nXXXX.'XX\XXXXXXXXXX/X:.\XXXXXXXThisXisXtheXstoryXofXaXlong-earedXrabbit\nXXX/XXXXX\XXXXXXXXX|X::X\XXXXXXwhoXcouldn'tXlearnXtoXdoXtheXbunnyXhop.\nXX/XXX/.XX\XXXXXXX/X:::X|XXXXXXHisXearsXwereXfloppy,XhisXfeetXwereXsloppy,\nX|XXXX|::.X\XXXXX/X:::'/XXXXXXXhe'dXhippityXhop,XthenXhe'dXtripXandXplop.\nX|XXX/X\::.X|XXX/X:::'/\nX\`--\`XXX\'XX\`~~~X':'/\`\nXXXXXXXXX/XXXXXXXXX(XXXXXXXXXXXSoXthisXlittleXrabbitXdevelopedXtheXhabit\nXXXXXXXX/XXX0X_X0XXX\XXXXXXXXXXofXstayingXawakeXwhenXtheXsunXwentXdown.\nXXXXXX\/XXXXX\_/XXXXX\/XXXXXXXXHe'dXstayXupXallXnight,X\nXXXX-==X'.'XXX|XXX'.'X==-XXXXXXXXXtillXtheXmorningXlight,XandX\nXXXXXX/\XXXX'-^-'XXXX/\XXXXXXXXpracticeXhisXhoppingXjustXoutsideXofXtown.\nXXXXXXXX\XXX_XXX_XXX/XXXXXXXXXXXXX\nXXXXXXX.-\`-((\o/))-\`-.XXX\nXX_XXX/XXXXX//^\\XXXXXX\XXX_XXXXOnXtheXfirstXEasterXmorn,X\n.\"o\".(XXXX,X.:::.X,XXXX).\"o\".XXXXXjustXbeforeXdawn,\n|oXXo\\\\\XXXX\:::::/XXXX//oXXo|XXHeXwasXstartledXbyXaXbright\nX\XXXX\\\\\XXX|:::::|XXX//XXXX/XXXXXXandXblindingXlight.\nXX\XXXX\\\\\__/:::::\__//XXXX/XXXXAndXJesusXwasXthereXinXtheX\nXXX\X.:.\XX\`':::'\`XX/.:.X/XXXXXXXXshimmeringXglare,\nXXXX\'::X|_XXXXXXX_|X::'/XXXXXXsmilingXatXthatXfunnyXbunny'sXplight.\nXjgsX\`---\`X\`\"\"\"\"\"\`X\`---\`\nXXXXXXXXXXXXXXXXXXXXXXXXXX\nXXXXDon'tXworry,XlittleXlad,XandXdon'tXbeXsoXsad,XXXXXXXXXXX.-\"-.\nXXXXforXhumankindXwillXcelebrateXthisXspecialXday.XXXXXXXX.'=^=^='.\nXXXXYouXmustXbringXtheXwordXtoXeveryXbeastXandXbirdXXXXXX/=^=^=^=^=\\\\\nXXXXthatXIXhaveXrisenXandXamXinXtheXworldXtoXstay.XXXXXX:^=XHAPPYX=^;\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX|^XEASTER!X^|\nXXXXYouXshould'veXseenXthatXcottontailXhopXaway,XXXXXXXX:^=^=^=^=^=^:\nXXXXfeelingXmightyXproudXtoXbeXtheXchosenXone.XXXXXXXXXXX\=^=^=^=^=/\nXXXXThoughXthisXstoryXisXquiteXold,XitXcanXnowXbeXretoldXX\`.=^=^=.'\nXXXXtoXmakeXlittleXchildrenXsmileXonXEasterXmorn.XXXXXXXXXXX\`~~~\`\n"




, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Wednesday, March 18, 2009

St. Patrick's Day ASCII Art For Linux And Unix

Happy Saint Patrick's Day! Actually, the timestamp on this post is for the day after and you may be reading this with a green-beer hangover. Blame me. It's the day-of, as I write, but I always write for tomorrow. Someday, my past will catch up with me and I'll begin writing in the present ;)

The piece of ASCII art that was the inspiration for our little script today ( or, in all honesty, the ASCII art I took and just perverted into a shell script ;) was found on Joan Stark's wonderful and massive ASCII Art Site. There's a lot of great stuff over there if you're into it. Definitely check it out, if you are.

From the description of the picture below, from her site:

The Claddagh is a visual portrayal of the eternal bond of friendship, loyalty, and love.
The HEART symbolizes love, life's finest impulse. From it, generosity and compassion flow.
The HANDS of friendship are clasped around the heart in a gesture of giving. As they cradle the heart gently, the hands are both protective and strong, like true friendship.
The CROWN is symbolic of loyalty. It represents the reward of love, the highest achievement the human spirit has yet accomplished.
To give the Claddagh is to forge the hands of love, friendship, and loyalty forever


Hopefully I'm jamming this out the door fast enough.

Happy St. Patty's Day! Or Happy The Day After!

Click the ASCII art picture below and marvel at the sheer volume of slashes and dots ;)




Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/bin/bash

#
# oneclad.sh -
#
# 2009 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

#!/bin/bash

echo -en " __.--'\"\"\"\"\"'--.__\n __.--' '--.__\n .-' '-.\n .' F R I E N D S H I P '.\n / L O Y A L T Y \\\\\\n /\` L O V E \`\\\\\n / _______ \\\\\\n / _.-'\` \`'-._ \\\\\\n / .' .:. .:. '. \\\\\\n : / ::::::::: \ :\n ; / ':::::::' \ ;\n | / ':::::' \ |\n | ; .:::::.:::.:::::. ; |\n | | ':::::::::::::::' | |\n | | .:::::::::::::::. | |\n | ; ':::::' : ':::::' ; |\n ; \ : / ;\n : .-\"^\`\\ .:. /\`^\"-. :\n \ .' ___\ .:' ':. /___ \`. /\n \ / /.---. O .---.\ \ /\n \ | // '-. _o/0\o_ .-' \\ | /\n \| ;| \ (0\|V|/0) / |; |/\n \.:.|| |\_) \~_~_~/ (_/| ||.:./\n \\\` | \ . \ ; .-.^.-. ; / . / | \`/\n '\_\ \\\\\\\\ \ \ \ / ' \ / / / // /_/'\n \\\\\\\\ \ \ \ \ / / / / //\n \`'-\_\_\ \ / /_/_/-'\`\n \` '. .' \`\n \`\n"


, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Sunday, February 15, 2009

More Valentine's ASCII Art For Linux And Unix

Happy Day-After-Valentine's Day :)

Again; also Happy day-after-the-famous massacre and Happy day-after-"Just in case you forgot, you're single" day ;)

Since copy for this blog gets written a day in advance (at the latest) I split up my two favorite pieces of ASCII Valentine's art so that I could spend Valentine's day with my wife instead of having to take any time away to write copy for the day after, which is today, for those of you keeping score at home (???) You know what I mean.

I also found this ASCII picture on Asciiworld.com and, hopefully, all of you fans of ASCII art (I include myself) have been over there to check out the huge amount of great pix they have or will be doing so one day. Don't mention my name if you need to contact them, though. If they're selling anything and you make that mistake, they'll probably charge you double ;)

Hope you like this one. It gets harder to read the larger it is, but it's still pretty cool and, possibly, subliminal. Don't leave this anywhere you don't want to be loved ;)

Surgeon General's Warning: ASCII art may cause dyspepsia, dipsomania and/or spontaneous aggrivated peristalsis. Click the picture below with care, and make sure you're wearing clean skivvies ;)

More Valentines ASCII art

#!/bin/bash

#
# hvd2.sh - Happy Day-After-Valentine's Day To My Still Wonderful Wife :)

echo -en "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n::::::::::OOO\$MOOO::::::::::::OOOOOOOOOO::::::::::::::::::::::::::::::::::::\n::::::::OO\$MM MMMMOOOO::::OOOMMMMMMMMMMMOO:::::::::::::::OOOOOOO::::::::::::\n::::::OOMM   \$\$M\$MMM\$OO::OMMMMOM  OM\$\$\$\$MMOO::::::::::::::::O:::::::::::::::\n:::::OMMM  \$\$\$\$\$\$\$MMMMOOOOMMM\$\$  \$MM\$MMM\$MM\$O:::::::::::::::O:::::::::::::::\n::::OMMMM M\$MM\$MM\$\$\$MMMMMMMMMO  O\$\$\$\$M\$MM\$MMMO:::::::::::OOOOOOOO:::::::::::\n::::OM\$\$M M\$\$\$\$\$\$\$\$\$O\$MMMMMM\$  \$O\$\$\$\$MM\$M\$\$MMOO:::::::::::::::::::::::::::::\n::::OM\$O\$\$\$\$\$\$\$\$\$\$\$\$\$\$O\$MO\$\$O\$\$\$\$\$\$\$\$\$\$\$O\$\$MMOO:::OOOO::::::::::::::::::::::\n::::OM\$\$\$\$MMO\$\$\$\$\$\$\$O\$\$\$\$\$\$O\$\$O\$\$\$\$\$\$M\$M\$\$MM\$O:::O:::O::::::::::::::::::::::\n:::::M\$\$OO\$M\$\$\$\$O\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$M\$\$MOMM\$O:::O::O:::::::::::::::O:::::::\n:::::MMM\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$OO\$\$\$MMMMO::OOOOO:::::OOOO:O::::O::OOO:::\n::::::OMM\$\$O\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$M\$MMO:::::O:::::::O::O:O:::O::O::O:::\n:::::::OMM\$\$\$M\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$MMMMMMO::::::O:::::::O::O::O:O:::OOO::::\n::::::::OOMM\$\$M\$ \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ M\$\$\$MM\$OO::::OOOOO:::::::OOO:::O::::O::::::\n:::::::::OOM\$\$\$\$M \$\$\$\$\$\$\$\$\$\$MM\$ \$\$\$\$MM\$\$O::::O:::OOOOO::::::::::::::::OOO:::\n:::::::::::OMMM\$\$\$ \$\$\$\$\$\$\$\$\$\$\$ \$\$\$\$\$MMOO:::::OOOO:::::OOOOO:::::::::::::::::\n:::::::::::::O\$MM\$\$ \$\$\$\$\$\$\$\$\$ \$\$\$\$\$MMO:::::::::::::::::::::::::::::::::::O::\n::::::::::::::OOMMM\$  M\$\$\$\$  MM\$\$MMO::::::::::::::O:::::O:::OOO::O:::O:::O::\n::::::::::::::::OMM\$\$\$     \$M\$\$MMO::::::::::::::::OO:::OO::O::O::O:::O:::O::\n:::::::::::::::::OMM\$\$O\$\$\$\$M\$\$\$MM:::::::::::::::::::OOOO:::OOOO:::OOOO:::O::\n::::::::::::::::::O\$MM\$\$\$O\$\$\$MMM:::::::::::::::::::::OO:::::::::::::::::::::\n::::::::::::::::::::O\$MMM\$\$\$MMO::::::::::::::::O::::OO:::::::::::::::::::O::\n:::::::::::::::::::::OO\$\$MM\$O:::::::::::::::::::OOOOO:::::::::::::::::::::::\n:::::::::::::::::::::::OO\$OO::::::::::::::::::::::::::::::::::::::::::::::::\n"


, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Saturday, February 14, 2009

Valentine's Day Linux And Unix ASCII Art

Happy Valentine's Day :)

Although this holiday is heavily associated with a famous massacre and referred to by a good percentage of the general population as "Just in case you forgot, you're single" day, it's still up there with the biggies (If Hallmark ever figures out how to work Jesus into the celebration, they'll have a real hit on their hands ;)

No matter if you're in a relationship or find yourself alone this Valentine's day, you can make this holiday work for you. If you're involved, send a card (or do something nice) for your partner. If you're single, do something nice for yourself and enjoy this time in your life. Eventually, you will reminisce fondly about your independence. Sad, but true ;)

Now that I've spread the sweet perfume of romance in the air (or spread something ... thick ;) let's get to the pretty ASCII art. The ASCII art script, tagged to the bottom of this post, was picked up from Asciiworld.com, where they have a great collection of ASCII art which encompasses far more than just Valentine's day pictures. Go check out the ASCII World and see if you can't find something interesting to send to friends, family, even bitter enemies ;)

Happy Valentine's Day, again, and I hope you enjoy this bad boy. This time we added &nbsp; HTML entities to maintain the spacing that Blogspot generally eradicates :)

NOTE: Click on the picture below for a whole lotta love ;)

Valentines Day ASCII Art

#!/bin/bash

#
# hvd.sh - Happy Valentine's Day To The Love Of My Life - My Wonderful Wife :)


echo -en "\thugs&kisses&hugs&kisses&hugs&kisses&hugs&kisses&hugs&kisses&\n\t&            hugs&kisses&hugs&kisses&hu         &hugs&kisses\n\ts&h        es&hugs&kisses&hugs&kiss                 gs&kisse\n\tes&h      sses&hugs&kisses&hugs&k                     s&kiss\n\tses&      isses&hugs&kisses&hugs            &kiss      s&kis\n\tsses      kisses&hugs&kisses&hu           ugs&kiss      s&ki\n\tisse      &kisses&hugs&kisses&h          &hugs&kiss     gs&k\n\tkiss      s&kisses&hugs&kisses&         es&hugs&kis     ugs&\n\t&kis      gs&kisses&hugs&kisses        sses&hugs&k      hugs\n\ts&ki      ugs&kisses&hugs&kisse       kisses&hugs       &hug\n\tgs&k      hugs&kisses&hugs&kiss      s&kisses&hu        s&hu\n\tugs&      &hugs&kisses&hugs&kis     ugs&kisses&         es&h\n\thugs      s&hugs&kisses&hugs& i     hugs&kisse          ses&\n\t&hug      es&hugs&kisses&hug  k      hugs&kis           sses\n\ts&hu      ses&hugs&kisses&h   &       hugs&             isse\n\tes&h      sses&hugs&kisse     s&                       &kiss\n\ts                             gs&ki                 hugs&kis\n\ts                             ugs&kisse         sses&hugs&ki\n\ti             ses&h                                        k\n\tk             sses&                                        &\n\t&kis      gs&kisses&hug   isses&hugs      s&hugs&kisse     s\n\ts&kis      gs&kisses&h   &kisses&hug      es&hugs&kisses   g\n\tgs&ki      ugs&kisses&   s&kisses&hu      ses&hugs&kisses  u\n\tugs&ki      ugs&kisse   ugs&kisses&h      sses&hugs&kisses h\n\thugs&k      hugs&kiss   hugs&kisses&      isses&h gs&kisses&\n\t&hugs&k      hugs&ki   s&hugs&kisses      kisses  ugs&kisses\n\ts&hugs&      &hugs&k   es&hugs&kisse              hugs&kisse\n\tes&hugs&      &hugs   sses&hugs&kiss      s&kiss  &hugs&kiss\n\tses&hugs      s&hug   isses&hugs&kis      gs&kiss s&hugs&kis\n\tsses&hugs      s&h   &kisses&hugs&ki      ugs&kisses&hugs& i\n\tisses&hug      es&   s&kisses&hugs&k      hugs&kisses&hug  k\n\tkisses&hug      e   ugs&kisses&hugs&      &hugs&kisses&h   &\n\t&kisses&hu          hugs&kisses&hugs      s&hugs&kisse     s\n\ts&kisses&hu        s&hugs&kisses                           g\n\tgs&kisses&h        es&hugs&kisse                           u\n\tugs&kisses&hugs&kisses&hugs&kisses&hugs&kisses&hugs&kisses&h\n"


, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Thursday, December 25, 2008

Happy Holidays - More ASCII Art

Happy Holidays to you all and Merry Christmas To Some Of You :)

Not much more needs to be said. I hope that you, like me, are spending some time with family and friends or, at least, writing a festive shell script ;)

As usual, click the picture below and it will appear larger than it is!


Happy holidays to one and all

Cheers,

NOTE: ASCII art copy write "Joan Stark" from her ASCII Art Christmas page

echo -ne "\n"
echo -ne " | | . , |_ . ,_ \_/ _,_, |__) _ _ _ _ / \,_\n"
echo -ne " |_|_|_|_/_)| |_|_| |_\_| | (_) |_|_ | _(/_(_|_(__(/_ \__/| |_\n"
echo -ne " __/\n"
echo -ne " __ ___\n"
echo -ne " (_ _ ,_-|-|_ _ ,_ _| | ,_ \_/ _,_, ,_ |__| _ _ ,_-|-\n"
echo -ne " (__(_|_|(_|_| |_ (_|_| |_(_|_ _|_| |_ | (_) |_|_|(_ | |_(/_(_|_|(_|_\n"
echo -ne "\n"
echo -ne " _..._\n"
echo -ne " _..._ .' _ '.\n"
echo -ne " .' _ './ (a) .-'-.\n"
echo -ne " / (e) .-'-. '-,-'\`\n"
echo -ne " | '-,--'\` /\n"
echo -ne " ; / ; |\n"
echo -ne " _ / |/ .\ _\n"
echo -ne " (_\ __..;__ \ ::\ ,/_)._\n"
echo -ne " _;\;\`\`\"\"----...___...---:\"\`\` .-'_ \`'. \ '::.()\__)\n"
echo -ne " (\())(\`._'- \`-._ ,:-\" '. '. - : ; '::\--;__\n"
echo -ne " _\()\`''----...__ \`-._ '-. '._ .' | .:::|()\_)\n"
echo -ne " (_/\`;-. jgs _ ()\`-. \`\"\"--...____..-'\` ;_ .:::| \`.\n"
echo -ne " \_) _;/_)/).;()'._ (\`\.-();/_).__ .::::/().-./\`)\n"
echo -ne " (_\\\`;(()(_/(()/(. __.--;();\`\_)()\__) .::()--;__:()\n"
echo -ne " '-;---()_;\_/()\"-._ (_/ (/ /()';();--._\_::'\`.();\_)\`\n"
echo -ne " ,() (_.-(); \._ \`\`\"\"(_.();_().(\`\.-();__)\`(_/ \`--.__\n"
echo -ne " (_/ (_/() \_) __/(_/|\();__\_)\` \_)\n"
echo -ne " \` (_/ \_)\`-._);\n"


, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Tuesday, December 9, 2008

Unix And Linux PDF Telnet Curiosity - When HTTP Error Pages Don't Attack!

Hey There,

For this post, I spent a bunch of time goofing around with Telnetting to port 80 to try and force the binary modes (-8, -L), and some combination of those and the "no-escape" clause (...I mean, flag ;) and encountered terrible frustration. As odd as it may seem, downloading binary files from servers that won't serve anything but ASCII over Telnet can make it very hard to get the original product back (I've got a few half-done and I'm convinced that it's all very sensible and, if I find all the places I need to pad the 8th bit, with a ^M - or null bit -, this will all work out). Once I get done doing the grunt work, it should be easy to script. Knock three times on wood...

Just as a for instance, here's a chunk of the regular binary PDF:

%PDF-1.5^M

and here's a chunk of the telnet-to-port-80 ASCII version of the same file:

%PDF-1.5

Now, the PDF specification says, very strictly, that the PDF begins with the tag %PDF-VersionNumber and ends with %%EOF. Simple enough. It's those darn eighth bits that muck everything up. Again, as above, you can try any combination of the appropriate flags to try and force binary Telnet and ignore escapes. The escape-ignoring works just fine, but, unfortunately, the other host has to accept your request to do a binary Telnet transfer and that's were you get screwed. Until you figure out how to massage the output and pad all the necessary bits. I have a feeling this will all work out better when I use Octal Dump (od) to parse the received file. If you're curious, check our previous post on converting between octal and ASCII with Perl.

Anyway, to wrap up, here's one of the nicest little error messages I've ever come across. I got it when I accidentally ran the following code:

(echo "GET /pdf/Mailing-Lists/FreeBSD/current/2006-03/index.html HTTP/1.1";echo "Host: unix.derkeiler.com";echo;sleep 2)|telnet unix.derkeiler.com 80 |sed -e '1,/^[ \t]*$/d'

instead of using the path to the specific PDF file. Here's the link to the actual java-scripted version of the error page, which is much funnier, as the text comes out at a pace that indicates truly deep sorrow.

Hope you enjoy it. Yay. Errors are FUN again ;)

Cheers,



"I am so sorry, but I can't find the Page you've requested.",
"It's possible that you entered the address incorrectly.",
"If you did enter the address correctly, then it must be my fault.",
"I am really, really sorry, but I've tried everything I know to find it.",
"Nothing helped.",
"I am really depressed about this.",
"You see, I'm just a web server...",
"...here I am, brain the size of the universe, trying to serve you a simple web page...",
"And then it doesn't even exist!",
"Where does that leave me?!",
"I mean, I don't even know you.",
"How should I know what you wanted from me?",
"You honestly think I can 'guess' what someone I don't even 'know' wants to find here?",
"",
"Maybe I should introduce myself... my name is Marvin.",
"But then again, what is the use of intruducing myself?",
"You can't tell me your name, because you are in some far off place, sitting in front of your computer.",
"And that makes me feel lonely.",
"Do you know what that is like?",
"",
"...sigh...",
"",
"Man, I am so depressed I could just cry.",
"And then where would we be, I ask you?",
"It's not pretty when a web server cries.",
"And where do you get off telling me what to show anyway?",
"I'm just a web server...",
"...and possibly a manic depressive one at that...",
"So why does that give you the right to tell me what to do?",
"Huh?",
"",
"I am so depressed...",
"I think I'll crawl off into the trash can and decompose.",
"I mean, I'm gonna be obsolete in what, two weeks anyway?",
"What kind of a life is that?",
"Two effing weeks...",
"...and then I'll be replaced by a .01 release, that thinks it's God's gift to web servers,",
"just because it doesn't have some tiddly little security hole with its HTTP POST implementation,",
"or something like that.",
"",
"I'm really sorry to burden you with all this,",
"I mean, it's not your job to listen to my problems,",
"and I guess it is my job to go and fetch web pages for you.",
"But I couldn't get this one.",
"I am so sorry.",
"Believe me!",
"",
"Maybe I could interest you in another page?",
"There are a lot out there that are pretty neat, they say,",
"although none of them were put on 'my' server, of course.",
"Figures, huh?",
"That makes me depressed too, since I have to serve them, all day and all night long.",
"Two weeks of information overload, and then *pffftt*, consigned to the trash.",
"Again I ask you, what kind of a life is that?",
"",
"Now, please let me sulk alone.",
"",
"",
"",
"",
"I am so depressed.",
"",
"",
"",
"",
"",
"",
"",
"<connection terminated>"




, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Friday, December 5, 2008

Friday Night At The Movies - Stars Wars On Linux Or Unix Via Telnet

Hey there and a good Friday to you all,

Special Note: Since this Telnet version of Star Wars was released a long time ago (less than a decade) in a galaxy far far away (not in my back yard), a lot of the links that claim the story is incomplete are incorrect. As of the writing of this post, I've watched the entire thing. Cool, yet sad. The best part is that, since there's no sound, you don't have to actually "hear" Luke whining ;)

Usually, I'll wait until the weekend to post links to "other stuff on the web" that I find interesting, but I try to stick to humor on the weekends and, today, I just happened to stumble over (not upon ;) something that's not necessarily funny, but definitely cool. ...especially if you're like me and your first video game console featured two very well drawn blocky sticks, with shorter blocky sticks sticking out of them and little squares (which we pretended where the circles they claimed to be) bouncing up and down. I still get a kick out of my kids complaining about things that aren't perfect in the games they play today. Here's a small list of the usual criticisms I hear, coupled up with the comments that inevitably get triggered in my head ;)

1. The character models are terrible. They look blocky and don't move naturally: When I was a kid, we didn't have that problem. The character "was" a block. And, as for how natural blocks move, you can do your own experimenting, but I think they did an admirable job of replicating the realism of the moving-block experience;)

2. This game is nothing but button mashing: Yes, but at least you have more than one button to mash and you don't have to increase the tensile strength of your wrist by curling dumbbells to push them repeatedly without causing severe damage. Many of my generation can be counted among those who's thumbs are permanently paralyzed.

3. I can't believe the lame quality of the voice-overs: I can't believe how much like an actual movie games have now become. You've got A-list actors delivering scripted dialogue. Even the people you've never heard of do a pretty decent job of sounding like the human beings they are. We had the option of "reading" text (which, I realize, can be a burden, what with all the "eye strain" involved ;) or listening to approximated electronic noises that, while they attempted to make recognizable sounds, mostly just made our ears ring and, eventually, bleed ;)

I could go on, but I fear that I've complained enough.

Go check out the full version of the little clipping below at Lifehacker.com's Telnet Star Wars Page. This reminds me of what it was like to be a kid, playing text adventures and complaining about how I had to "walk" so far before I got to turn N or NE. My father's generation actually had to walk great distances to engage in actual physical activities ;) ...I digress.

BTW, if the Telnet version doesn't work for you, try this asciimation version to get your fix :)

Hope you enjoy this and have a great weekend. See you tomorrow!

Cheers,



Watch Star Wars in Text via Telnet




While it's not technically an Easter egg, one of the most eye-popping tips in last Sunday's Top 10 Easter eggs post comments was a pointer to a telnet server that broadcasts Star Wars Episode IV to your command line as animated text. You didn't read that wrong. Give it a try: from any command line, type telnet towel.blinkenlights.nl and sit back to watch the show. This is the least productive thing you'll do all day, but you know what they say about all work and no play. After the jump, see a handful of screenshots—just 4 of the 13,935 frames that make up the entire movie.








Hit the link for the story on Blinkenlights' ASCII Star Wars animation which has been around since the Dark Ages (well, 2000). Thanks to all the commenters who told us about this one!


Ever wanted to see Star Wars in Telnet?



, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Thursday, November 27, 2008

Happy Thanksgiving - Unix/Linux ASCII Art

Happy Turkey Day!

Here's hoping you're all enjoying a day off of work, have nothing whatsoever to do and fully plan on doing it ;)

Below, a little ASCII art script that should run on any Linux or Unix distro. I don't know who created the original ASCII picture and I give credit to whomever it was. If this is your turkey, send me an email and I'll be happy to credit you with the catch!

Happy Thanksgiving and take care :)

Click below to see this gobbler super-sized ;)

Happy Thanksgiving

...and click here to download the script just in case Blogspot completely destroys all the spacing or any special characters. We put the entire picture in one echo statement in a celebration of whatever anniversary of security through obfuscation this is.

May you be blessed enough to realize all you have to be thankful for.

#!/bin/bash

#
# htg.sh - Happy Thanksgiving :)
#

echo -e "\n ,+*^^*+___+++_\n ,*^^^^ )\n _+* ^**+_\n +^ _ _++*+_+++_, )\n _+^^*+_ ( ,+*^ ^ \+_ )\n { ) ( ,( ,_+--+--, ^) ^\\n { (@) } f ,( ,+-^ __*_*_ ^^\_ ^\ )\n {:;-/ (_+*-+^^^^^+*+*<_ _++_)_ ) ) /\n ( / ( ( ,___ ^*+_+* ) < < \\n U _/ ) *--< ) ^\-----++__) ) ) )\n ( ) _(^)^^)) ) )\^^^^^))^*+/ / /\n ( / (_))_^)) ) ) ))^^^^^))^^^)__/ +^^\n ( ,/ (^))^)) ) ) ))^^^^^^^))^^) _)\n *+__+* (_))^) ) ) ))^^^^^^))^^^^^)____*^\n \ \_)^)_)) ))^^^^^^^^^^))^^^^)\n (_ ^\__^^^^^^^^^^^^))^^^^^^^)\n ^\___ ^\__^^^^^^))^^^^^^^^)\\n ^^^^^\uuu/^^\uuu/^^^^\^\^\^\^\^\^\^\\n ___) >____) >___ ^\_\_\_\_\_\_\)\n ^^^//\\_^^//\\_^ ^(\_\_\_\)\n ^^^ ^^ ^^^ ^^\n"
banner happy;banner thanks;banner giving


, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Tuesday, October 7, 2008

Using Iconv To Convert Character Sets On Linux And Unix

Hey There,

Today's topic was obliquely referenced in yesterday's post on using the online multilingual dictionary from the Bash CLI. Yes, after I woke up around 1 am and thought about it, the results did seem odd. It turns out, when I went to the page, that the multilingual dictionary on reference.com is actually house within a frameset under the online Thesaurus. My belated apologies for getting the name incorrect, although, if you think about it, it's not even a multilingual dictionary (not really). If you enter a word in English, get the definition in English and then get the word spelled for you in 30 different languages, that's more like an online dictionary with a keyword translator. If it were truly a multilingual dictionary, I would expect to get definitions in 30 different languages. Perhaps I want for too much at some times and not enough at others. Probably a good mix of the two ;)

Today, we're going to look at character conversion (Since, if you looked at the picture in yesterday's bash script post, you probably noticed that a lot of the foreign characters came up looking like garbage. Ok; maybe not garbage, but certainly not in the way they were intended to be shown. All manner of inflective symbols and more picturesque languages (Cyrillic) etc, just don't show up well on a standard U.S. computer.

There are, as I see it, two basic ways to get around this.

1. Install every font set and allow for every single type of encoding available. If your OS supports it, you should know be able to read Japanese Kanji and Russian, German, French, etc with the proper characters displayed. Still, I'm not sure there's any guarantee that this would always work, or that the benefits of keeping a huge cache of fonts and displays wouldn't end up under-weighing the burden.

2. Use a program called "iconv" (present on most Linux and Unix boxes nowadays), and convert when necessary.

I'll assume we want to proceed with option 2 and check out a simple example. But, before we do that, I'd like to point out that, from distro to distro, the implementations of the iconv program can vary greatly. For a striking difference, consider Sun's native version vs. Gnu's. In the Sun's version from 2.6 (Perhaps not a fair comparison, but their native client hasn't come up all that much either), you only have two flags to choose from (actually, you have to use them both): -f (The "convert from" character set) and -t (the "convert to" character set). Don't know what character sets you have installed? Your issue ;)

In the Gnu version, you've got those options (plus the long versions of both -- guess what those are ;) a few other options to suppress errors and gloss over characters that can't be decoded and, best of all, a "--list" option that will list all the character sets installed on your system. This list can be very useful if you want to convert to or from a character set but aren't sure if you can. With Gnu's iconv, you'll know in a few seconds without having to look anywhere else (For Sun 2.6, and later, you can find the definitions under /usr/lib/locale. If you do a "man" on "charmap" it's referring to the charmap source files in there - There may or may not be a standard directory like /usr/share/ii8n/charmaps on your Sun system). For useful information you can actually work with (on a less-than-abstract level) do a "man" on "localedef" and/or "locale." Didn't want to leave you with nothing on that side of the coin ;)

Here's a simple, but dramatically visual enough way, to show you what iconv can do. This example isn't really "practical," except insofar as it shows you proof from a few different angles that "iconv" actually can do what it says.

First, we'll check out our test file and make sure it's good to go:

host # ls
regular
host # file regular.ascii
regular: ASCII text
host # cat regular.ascii
This is a file created using our standard charset
host # cat -v regular.ascii
This is a file created using our standard charset


Then, we'll check the version of iconv (We want Gnu) to make sure we can work as efficiently as possible with as little charmap/locale/charset knowledge as possible:

host # iconv --version
iconv (GNU libc) 2.3.2...
<-- Good :)
host # iconv --list
The following list contain all the coded character sets known. This does
not necessarily mean that all combinations of these names can be used for
the FROM and TO command line parameters. One coded character set can be
listed with several different names (aliases).

437, 500, 500V1, 850, 851, 852, 855, 856, 857, 860, 861, 862, 863, 864, 865,
866, 866NAV, 869, 874, 904, 1026, 1046, 1047, 8859_1, 8859_2, 8859_3, 8859_4,
8859_5, 8859_6, 8859_7, 8859_8, 8859_9, 10646-1:1993, 10646-1:1993/UCS4,
ANSI_X3.4-1968, ANSI_X3.4-1986, ANSI_X3.4, ANSI_X3.110-1983, ANSI_X3.110,
ARABIC, ARABIC7, ARMSCII-8, ASCII, ASMO-708, ASMO_449, BALTIC, BIG-5...


There are literally 50, or so, more lines of available character sets we can convert from and to. Just run that command anytime if you need to check out the entire list. This is great because now we don't have to do any extra work to figure out that part.

Then we'll move on to converting the regular ASCII file to a UTF-16 file. We could convert it to UTF-8, but the "file" command doesn't consider the two charsets "different" enough (and neither do your eyes) and we want this to stand out. Also, UTF-16 has some fun features like not having complete EOL chars, etc, and is unsearchable by standard "grep." Notice the output from the "file," "grep," "cat" and "cat -v" commands once we've finished with the converse and do our comparisons:

host # iconv --from-code ASCII --to-code UTF-16 --output regular.utf16 regular.ascii
host # ls
regular.ascii regular.utf16
host # file regular.ascii regular.utf16
regular.ascii: ASCII text
regular.utf16: Little-endian UTF-16 Unicode character data, with no line terminators
host # grep file regular.ascii regular.utf16
regular.ascii:This is a file created using our standard charset
host # cat regular.ascii
This is a file created using our standard charset
host # cat regular.utf16
ÿþThis is a file created using our standard charset
host # cat -v regular.ascii
This is a file created using our standard charset
host # cat -v regular.utf16
M-^?M-~T^@h^@i^@s^@ ^@i^@s^@ ^@a^@ ^@f^@i^@l^@e^@ ^@c^@r^@e^@a^@t^@e^@d^@ ^@u^@s^@i^@n^@g^@ ^@o^@u^@r^@ ^@s^@t^@a^@n^@d^@a^@r^@d^@ ^@c^@h^@a^@r^@s^@e^@t^@
^@


Man, did we make a mess of things ;) Now, we'll put everything back the way it was (hopefully) and run the same tests:

host # iconv --from-code UTF-16 --to-code ASCII --output regular.new regular.utf16
host # ls
regular.ascii regular.new regular.utf16
host # file regular.ascii regular.new
regular.ascii: ASCII text
regular.new: ASCII text
host # grep file regular.ascii regular.new
regular.ascii:This is a file created using our standard charset
regular.new:This is a file created using our standard charset
host # cat regular.ascii
This is a file created using our standard charset
host # cat regular.new
This is a file created using our standard charset
host # cat -v regular.ascii
This is a file created using our standard charset
host # cat -v regular.new
This is a file created using our standard charset


And, voila, we've got everything back. "file" returns the same information, both files can be catted again and "grep" works on the file that we converted back from UTF-16 to ASCII.

That, in a nutshell is what "iconv" can do for you. The possibilities are endless, as (of course) are the amount of problems you can create for yourself ;)

Cheers,

, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Friday, May 2, 2008

Perl Script To Do Lame Encryption With Octal Dump On Linux Or Unix

Hey There,

A post ago, we took a look at using od on Linux or Unix. Hopefully, it made the use of that cryptic command somewhat more accessible.

Today, I thought we'd take a look at using the "od" command for a less practical purpose. Much like crypt (and a much older post we did on using simple encryption and decryption using Perl's pack and unpack functions), the quick-and-dirty Perl script we're putting out today is a pretty good way to keep people who don't know what they're reading from rifling through your stuff ;)

The script is simple enough, and only takes two arguments. You can either instruct it to convert a file from ASCII to octal, like so:

host # ./octala.pl -o shell.pl

or the opposite ( octal to ASCII conversion ):

host # ./octala.pl -a shell.pl.od <--- Assuming you're just running this script and accepting the default extension we popped on the end (BTW, by default, this line of code will add an ".as" extension to your file. The original is never destroyed. But that can be easily fixed by adding a line of code if you like. ...just don't forget to back up any file you might need!)

Below is a simple demonstration of the script in action, followed by the real deal. Note that we only substitute four characters that aren't "representable" (SPC = a space, HT = a tab, LF = a line feed, CR = a carriage return -- actually the CR and LF are both replaced with a new-line).

Here's to people not knowing what you're up to ;)

Cheers,

Ex:

host # cat shell.pl
<--- This script is one of our old ones with some lines chopped off, so it probably won't run :)

#!/usr/bin/perl

if ( $port =~ /\D/) {
$port = getservbyname($port, $protocol) || die "getservbyname ${port}/$protocol\n";;
}
$inet_address = inet_aton($host) || die "inet_aton: ${host}\n";
$port_address = sockaddr_in($port, $inet_address);
$protocol_num = getprotobyname('$protocol');

while (1) {
$shell_shock=accept(NEWSOCKET, SOCKET)|| die "accept $!\n";
dup2(STDERR,2);
system("/bin/sh -i");
close($shell_shock);
}
exit;


host # ./octala -o shell.pl <--- Here we convert the file to octal, and strip out the offset field.

host # cat shell.pl.od
043 041 057 165 163 162 057 142 151 156 057 160 145 162 154 012
012 151 146 040 050 040 044 160 157 162 164 040 075 176 040 057
134 104 057 051 011 173 012 011 044 160 157 162 164 040 075 040
147 145 164 163 145 162 166 142 171 156 141 155 145 050 044 160
157 162 164 054 040 044 160 162 157 164 157 143 157 154 051 040
174 174 040 144 151 145 040 042 147 145 164 163 145 162 166 142
171 156 141 155 145 040 044 173 160 157 162 164 175 057 044 160
162 157 164 157 143 157 154 134 156 042 073 073 012 175 012 044
151 156 145 164 137 141 144 144 162 145 163 163 040 075 040 151
156 145 164 137 141 164 157 156 050 044 150 157 163 164 051 040
174 174 040 144 151 145 040 042 151 156 145 164 137 141 164 157
156 072 040 044 173 150 157 163 164 175 134 156 042 073 012 044
160 157 162 164 137 141 144 144 162 145 163 163 040 075 040 163
157 143 153 141 144 144 162 137 151 156 050 044 160 157 162 164
054 040 044 151 156 145 164 137 141 144 144 162 145 163 163 051
073 012 044 160 162 157 164 157 143 157 154 137 156 165 155 040
075 040 147 145 164 160 162 157 164 157 142 171 156 141 155 145
050 047 044 160 162 157 164 157 143 157 154 047 051 073 012 012
167 150 151 154 145 040 050 061 051 011 173 012 011 044 163 150
145 154 154 137 163 150 157 143 153 075 141 143 143 145 160 164
050 116 105 127 123 117 103 113 105 124 054 040 123 117 103 113
105 124 051 174 174 040 144 151 145 040 042 141 143 143 145 160
164 040 044 041 134 156 042 073 012 011 144 165 160 062 050 123
124 104 105 122 122 054 062 051 073 012 011 163 171 163 164 145
155 050 042 057 142 151 156 057 163 150 040 055 151 042 051 073
012 011 143 154 157 163 145 050 044 163 150 145 154 154 137 163
150 157 143 153 051 073 012 175 012 145 170 151 164 073 012

host # ./octala -a shell.pl.od
<--- and here we take that octal file and translate it back to ASCII

host # cat shell.pl.od.as
#!/usr/bin/perl

if ( $port =~ /\D/) {
$port = getservbyname($port, $protocol) || die "getservbyname ${port}/$protocol\n";;
}
$inet_address = inet_aton($host) || die "inet_aton: ${host}\n";
$port_address = sockaddr_in($port, $inet_address);
$protocol_num = getprotobyname('$protocol');

while (1) {
$shell_shock=accept(NEWSOCKET, SOCKET)|| die "accept $!\n";
dup2(STDERR,2);
system("/bin/sh -i");
close($shell_shock);
}
exit;


host # diff shell.pl shell.pl.od.as <--- Cool - They're exactly the same :)


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/usr/bin/perl

#
# octala.pl - convert files from octal to ASCII or reverse
# Usage: octala [-o|-a] input_file
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

if ( $#ARGV != 1 ) {
print "Usage: $0 [-o|-a] input_file\n";
exit(1);
}

$oct_or_asc = $ARGV[0];
$input_file = $ARGV[1];

if ( ! -f $ARGV[1] ) {
print "File $input_file can't be found! Over\n";
exit(2);
}

$tmp=$$;

%otoa = qw(000 NUL 001 SOH 002 STX 003 ETX 004 EOT 005 ENQ 006 ACK 007 BEL 010 BS 011 HT 012 LF 013 VT 014 FF 015 CR 016 SO 017 SI 020 DLE 021 DC1 022 DC2 023 DC3 024 DC4 025 NAK 026 SYN 027 ETB 030 CAN 031 EM 032 SUB 033 ESC 034 FS 035 GS 036 RS 037 US 040 SPC 041 ! 042 " 043 # 044 $ 045 % 046 & 047 ' 050 ( 051 ) 052 * 053 + 054 , 055 - 056 . 057 / 060 0 061 1 062 2 063 3 064 4 065 5 066 6 067 7 070 8 071 9 072 : 073 ; 074 < 075 = 076 > 077 ? 100 @ 101 A 102 B 103 C 104 D 105 E 106 F 107 G 110 H 111 I 112 J 113 K 114 L 115 M 116 N 117 O 120 P 121 Q 122 R 123 S 124 T 125 U 126 V 127 W 130 X 131 Y 132 Z 133 [ 134 \ 135 ] 136 ^ 137 _ 140 ` 141 a 142 b 143 c 144 d 145 e 146 f 147 g 150 h 151 i 152 j 153 k 154 l 155 m 156 n 157 o 160 p 161 q 162 r 163 s 164 t 165 u 166 v 167 w 170 x 171 y 172 z 173 { 174 | 175 } 176 ~ 177 DEL);

if ( $oct_or_asc eq "-o" ) {
system("od -b $input_file >odfile.$tmp");
open(TMPODFILE, "<odfile.$tmp");
@TMPODFILE = <TMPODFILE>;
close(TMPODFILE);

open(NEWODFILE, ">$input_file.od");
foreach $odline (@TMPODFILE) {
if ( $odline =~ /^\w+$/ ) {
next;
}
$odline =~ s/^\w+ //;
print NEWODFILE $odline;
}
close(NEWODFILE);
unlink("odfile.$tmp");
} elsif ( $oct_or_asc eq "-a" ) {
open(TMPASFILE, "<$input_file");
@TMPASFILE = <TMPASFILE>;
close(TMPASFILE);
open(NEWASFILE, ">$input_file.as");
foreach $asline (@TMPASFILE) {
@asline = split(" ", $asline);
foreach $aschunk (@asline) {
$fixedaschunk = $otoa{$aschunk};
$fixedaschunk =~ s/SPC/ /;
$fixedaschunk =~ s/HT/\t/;
$fixedaschunk =~ s/LF/\n/;
$fixedaschunk =~ s/CR/\n/;
print NEWASFILE $fixedaschunk;
}
}
close(NEWASFILE);
unlink("odfile.$tmp");
} else {
print "Unrecognized option: $oct_or_asc\n";
exit(3);
}


, Mike

Thursday, May 1, 2008

Using OD To Find Bad Characters In Files On Linux Or Unix

Hey there,

Today we're going to take a look at a command called "od" (short for "octal dump") and the sometimes elusive search for, and destruction of, those "mystery characters" that make your scripts not run correctly. Sure, there are programs out there like dos2unix that pretty much take care of this problem for you, but that's like taking candy from a baby ;) And there's always the possibility that they won't be able to find the bizarre character you're trying to get rid of. What do you do then?

We covered the other side of this issue in an earlier post on adding real control characters to your files. Now, it's time to finally undo that damage ;)

od is a great utility for finding out if there really are bad characters in your file in the first place. "cat -v" works, too, but you can only trust it as much as you trust your terminal settings. I generally assume my tty settings are correct, but they could be up to just about anything ;) For today's purposes, "cat -v" serves as an excellent corollary to od's output and, hopefully, makes it even easier to understand.

For instance, if you're looking for a control character in a file (we'll say ^M, since that one's the most popular), cat -v does a great job of bringing it out in the open, like this:

host # cat file
def
host # cat -v file
abc^Mdef


od can do the same thing, if only slightly differently:

host # od -c file
0000000 a b c \r d e f \n
0000010


Notice that, with the "-c" flag used, we can make the "^M" show up as an easily identifiable "\r". We also get to see what having that "actual" ^M in our file has done. Notice the second line in the "od" output (00000010). The first column of od's output is the byte-offset of the line. The first line, naturally starts at an offset of 0 and, since od only grabs the amount of bytes per line that you can actually see in the output, the second entry (the offset of the 6 letters and the new-line) should be 7 (This is because the numbering starts at zero - just in case you didn't know. No offense if you did ;). Another clue that something is amiss.

This is what the file would look like normally, using the same example as above, but without the ^M inserted:

host # cat file
abcdef
host # cat -v file
abcdef
host # od -c file
0000000 a b c d e f \n
0000007


Perfect :) The really nice thing about using od with the "-c" flag is that it prints out all regular characters in ASCII, which, studies have shown, most humans prefer reading ;) Only when od runs into a character it doesn't understand, does it do any substitution, as with the ^M. Below is the basic table of conversions the "-c" flag will do automatically:

null \0
backspace \b
form-feed \f
new-line \n
return \r
tab \t


After that, if od doesn't recognize a regular ASCII character, it will finally live up to its name and dump the octal value (of course, we could have forced it to do this all along, but we're trying to make this command seem accessible ;). Here's an example of what we see when od can't translate for us ASCII folks anymore:

host # cat file
bcdef
host # cat -v file
a^?bcdef
host # od -c file
0000000 a 177 b c d e f \n
0000010


Okay. So, in this instance, "cat -v" shows us what looks like a "backspace" or "erase" character (^?). od's output is slightly different. The "what would be the next line" offset is at 10. That's the sum of all 6 ASCII characters, the new-line and the 3-digit octal code, so everything's in order (even though it's not right).

The really sweet thing is that you, armed with the knowledge od has provided, can remove the character from the file with tr (or your fancy file/character manipulation command of choice) using the octal code, which makes it completely unnecessary for you to remember some bizarre symbol ;)

host # cat file
bcdef
host # cat -v file
a^?bcdef
host # od -c file
0000000 a 177 b c d e f \n
0000010
host # tr -d '\177' <file
abcdef
host # tr -d '\177' <file >file2
<--- Where the magic happens...
host # cat file2
abcdef
host # cat -v file2
abcdef
host # od -c file2
0000000 a b c d e f \n
0000007


Hope this makes the crusty old "od" command seem less daunting. You can do a whole lot more with it, of course, but there will be plenty of time for that later :)

Cheers,

, Mike

Saturday, April 19, 2008

Snooping Through Email On Solaris

Good morning/afternoon/evening,

For this Saturday's post, I thought I'd put together another bash script on Solaris Unix using snoop. The last time we did this it was to grab cleartext logins and passwords. This time, I thought we'd look at email. SMTP, port 25, in particular.

Snooping through someone's physical mail (delivered to their home) would be a federal offense, but (to my knowledge) if you're a Unix or Linux administrator and have to analyze network traffic and interrogate packets at your place of work, there's almost no way you can avoid getting into other people's business. Most company's have an HR policy that your email is considered private and gaining access to another user's email, without their consent, is blah, blah, blah leading up to, and including termination. Of course, five minutes after said employee leaves the company, you're probably going to be called upon to provide just that sort of access (or the information gained by that access) to the same department that demanded you never ever do that sort of thing in the first place.

That being said, I'm pretty sure the law at this point is that a company can do whatever it wants with any data you create or use on their systems. If they need to, or want to, they can look at the email you send out and receive and where you go on the web, etc. I'm not sure why corporate America insists on assuring the average employee that their company-owned data is "personal and confidential" when all that email and web traffic has to be scanned by 15 security appliances before it can be allowed to enter or leave the company network? You can't block access to a website (even to, say, everyone in the company) without having to examine where every employee is going when they surf the web, etc. It probably makes for some yawn-inspiring legal battles ;)

Anyway, for the sake of today's argument, you're the root user (or someone with sufficient privilege to run snoop on Solaris Unix) and you're inspecting network traffic on an interface on a machine for a semi-legitimate reason.

If you need to check mail traffic, the simplest thing to do is snoop on port 25. This is the SMTP port and is used for sending and receiving email (you can also look at the POP and IMAP ports, but we'll wrap that into the everything's-pretty-much-all-the-same-when-you-get-right-down-to-it closing). You can get a good deal of information just running a straight-up snoop, like so:

host # snoop -o output_file port 25 <--- This snoop will use the default network interface, only capture traffic on port 25 and write the output to a file called "output_file."

The only problem you have is that, although it's readily clear who sent mail to whom, you can't see "what" they wrote. That's the stuff you want to see if you're going to be intercepting that information in real-time.

Note: In order to see the full contents of a packet, you don't need to use the "-v" flag. In fact, I'd strongly discourage it, since it pumps out about 50+ lines of IP stack layer information that you don't need for each and every packet!

If you want to see the full contents of the packets in snoop, just use the "-x" option and pass it the argument of an offset. "-x" gives you the entire packet, in both HEX and ASCII formats. You don't really need the HEX, since most humans read ASCII encoded text (like this) a lot more easily ;) A quick way to dump the HEX portion of each packet is to set the offset to 54 (for TCP traffic) and 42 (for UDP traffic). So, if you wanted to grab each packet and look at the ASCII contents only, you would type:

host # snoop -x 54 -o output_file port 25 <--- We're assuming TCP for the email transmission, although we'd capture any UDP packets that went to that port, also.

If you're ever snooping a protocol that doesn't fit the standards, or you forget these, you can almost always get the exact same effect (for TCP, UDP and any other protocol) by piping your output_file to awk when you're ready to read it, and just printing out the last field of every record, like so:

host # snoop -o output_file port 25
host # snoop -i output_file 2>&1 | awk '{ print $NF }'


The script we wrote for today doesn't take any arguments (but you should modify the snoop line if you want to specify a NIC with the "-d" option) and can be run simply, like this:

host # ./snoopmail.sh

And you'll get somewhat-ugly, but ultimately satisfying, results like this (yet another reason to never send a password via email):

..............To
...some.poor.guy
@xyz12345.com..S
ubject
Update 4....Hi
again....How are
ya,....Your new
password is bU
ggl3s....Please
do not share thi
s information wi
th any one!....T
hanks,.....Secur
ity..


Enjoy your Saturday, everyone :) Best wishes,


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/bin/bash

#
# snoopmail.sh
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

if [ $# -ne 1 ]
then
echo "Usage: $0 SnoopOutputFile"
echo "Please capture packets with the suggested"
echo "settings: snoop -o output port 25"
exit 1
fi

snoop_file=$1

if [ ! -f $snoop_file ]
then
echo "Cannot find snoop output file $snoop_file. Exiting..."
exit 1
fi

snoop -i $snoop_file -x 54|sed -n '/DATA/,/QUIT/p'|grep -v SMTP|awk -F":" '{print $2}'|cut -c41- -


, Mike