Friday, December 14, 2012

Netcat - Tool Tuesday

Netcat (nc) is an invaluable tool that makes working with network connections as easy as working with text files (for those of you on UNIX, that is pretty dang easy!)

Set Up a Chat Server

This is a very quick way to set up a person to person chat over the Internet. It isn't encrypted, but it is simple and always works.
Server
# nc -l 8080
Client (replace the IP with any other host)
# nc 127.0.0.1 8080

Clone a Harddisk Over the Web

This is a great free and dirty replacement to Norton Ghost which helps you clone a harddisk from one machine to another.
Machine to Clone to
# nc -l 2222 > /dev/sdb
Machine to Clone From
# nc FROM_HOSTNAME 2222 < /dev/sda
(Note that if a quit character is encountered somewhere in the disk it will kill netcat.)

Transfer a File

Need to transfer a file between a computer but don't have SSH or FTP?
Sender
# nc  -l 8080 < /path/to/some.file
Receiver
# nc localhost 8080 > output.file 

See Web Headers

Ever want to see what your web-browser is sending out as headers?
Server
# nc -l 8080
Then point your web-browser to http://localhost:8080/ and watch the netcat window show what your browser is telling all sites you visit.
Example Output
GET / HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Cookie: wp-settings-time-1=1348281280

Leave Yourself a Backdoor

Warning, this will totally leave your system open to attackers (and some netcat builds don't even allow this flag for that reason, like Ubuntu's.)
Server
# nc -l 8080 -e /bin/bash
With this example, as soon as you connect, you'll be communicating with a BASH instance running at whatever security level you opened nc with. If you want your users to at least have to authenticate, use /bin/login instead.

Run a Portscan

If you don't have nmap installed, and don't want to build something in Python, you can quickly tell which ports are being used on a host using the following:
# nc -zv localhost 1-5000 2>&1 | grep succeeded
This command checks ports 1-5000 on localhost, and looks for any ports that are open. The reason we redirect stderr to stdout is grep only works on stdout, while nc outputs the information we want on stderr.

Monday, December 10, 2012

Cookies! - Maker Monday, Holiday Edition

For years my grandmother would make all of her children large tins of cookies for Christmas; before she moved and stopped making them, I made sure to get her recipes. The secret is either love, or butter, I'm still not entirely sure. What I am sure about is how well they can smooth over rough family situations:
 

Butter Cookies:

Bake Time
10 min / batch
Bake Temp
375°
Number
4 dozen (48)
Prep Time
15 min

Ingredients:

  • 1 Cup (2 sticks) of Butter
  • ½ Cup Sugar
  • 2 Egg Yolks
  • 2 Cups of Sifted Flour
  • ½ Teaspoon Vanilla (or other flavoring of your choice)

Optional Ingredients:

  • Food Coloring
  • Cookie Sprinkles

Directions:

  1. Preheat oven to 375° F
  2. Soften butter.
  3. Cream together butter and sugar.
  4. Add egg yolks, mixing well.
  5. Gradually add flour, mixing after each addition.
  6. Add flavoring and food coloring of your choice.
  7. Follow one of the two methods below.
  • Log Method
    • Divide in half.
    • Wrap in waxed paper.
    • Refrigerate for 1 hour or until firm.
    • Shape each half into 15-inch log; wrap in wax paper
    • Cut cookies off of log.
  • Cookie Press
    • Use your cookie press normally.
  1. Put dough on cookie sheet, around two inches apart.
  2. Bake in oven for ten minutes or until lightly brown around edges.
  3. Remove from baking sheet immediately.
  4. Let cool on wire rack.

 

Grandmothers Oatmeal Cookies:

Bake Time
10 min / batch
Bake Temp
350°
Number
4 dozen (48)
Prep Time
30 min + 1 hour stand time

Ingredients:

  • 3 Eggs
  • 1 Cup Nuts
  • 1 Cup Raisins
  • 1 Tbsp. Vanilla
  • 1 Cup Butter
  • 1 Cup Brown Sugar
  • 1 Cup White Sugar
  • 2 ½ Cup Flour
  • 2 Teaspoons Baking Soda
  • 1 Teaspoon Cinnamon
  • 2 Cups Quick Oatmeal

Directions:

  1. Beat eggs.
  2. Combine Eggs, Raisins and Vanilla, Let stand 1 hour.
  3. Preheat Oven To 350°.
  4. Cream Butter and sugar.
  5. Add flour, baking soda, and cinnamon.
  6. Stir in oatmeal, nuts, and raisins.
  7. Roll into 1” balls, flatten slightly, then bake for around 10 min.

    Old Fashioned Oatmeal Cookies:

    Bake Time
    12 min / batch
    Bake Temp
    375°
    Number
    4 dozen (48)
    Prep Time
    15 min

    Ingredients:

  8. 2 Cups of Sifted Flour
  9. 1 Teaspoon Soda
  10. 1 Teaspoon Salt
  11. 1 ½ Teaspoons Cinnamon
  12. 2 Cups of Quick Cooking Oatmeal
  13. ½ Cups of Brown Sugar, Firmly Packed
  14. ½ Cup Granulated Sugar
  15. 1 Cup Shortening (Room Temp)
  16. 2 Eggs, Unbeaten
  17. 1/3 Cup Milk (Sweet or Sour)
  18. 1 Teaspoon Vanilla
  19. 1 Cup raisins or dates
  20. ¾ Cup chopped nuts

Directions:

  1. Preheat oven to 375°.
  2. Stir together, flour, soda, salt, cinnamon.
  3. Add, oatmeal, sugar, brown sugar, shortening, eggs, milk, vanilla.
  4. Beat on medium speed until blended (around 2 min).
  5. Scrape bowl while beating.
  6. Add raisins, and nuts.
  7. Beat on low speed until blended.
  8. Bake on greased sheet around two inches apart.
  9. Cook for 12 minutes, or until browned.


Original Toll House Cookies:

Bake Time
10 min / batch
Bake Temp
375°
Number
7.5 Dozen
Prep Time
15 min

Ingredients:

  • 1 Cup Shortening
  • ¾ Cup Granulated Sugar
  • ¾ Cup Firmly Packed Brown Sugar
  • 1 Teaspoon Vanilla
  • ½ Teaspoon Water
  • 2 Eggs
  • 2 ¼ Cups Flour
  • 1 Teaspoon Baking Soda
  • 1 Teaspoon Salt
  • 12 Ounce Package Of Semi Sweet Chocolate Morsels
  • 1 Cup Chopped Nuts

Directions:

  1. Preheat oven to 375°.
  2. Combine shortening, sugar, vanilla, and water.
  3. Beat until creamy.
  4. Beat in egg.
  5. Add all dry ingredients except nuts and chocolate, mix well.
  6. Mix in chocolate chips and nuts at a lower speed.
  7. Drop tablespoonfuls onto cookie sheet.
  8. Bake for 10 – 12 minutes.


Sugar Cookies:

Bake Time
8 -10 min / batch
Bake Temp
375°
Number
4 dozen (48)
Prep Time
15 min + refrigeration time

Ingredients:

  • 1 ½ Cups Powdered Sugar
  • 1 Cup Butter
  • 1 Egg
  • 1 Teaspoon Vanilla
  • ½ Teaspoon Almond
  • 2 ½ Cups Flour
  • 1 Teaspoon Cream Of Tartar
  • 1 Teaspoon Baking Soda

Directions:

  1. Cream together butter and sugar.
  2. Add egg and flavoring.
  3. Stir in dry ingredients.
  4. Chill until workable.
  5. Preheat oven to 375°.
  6. Bake 8 – 10 minutes.

Sunday, December 9, 2012

Drowning in Web App Formats

With the rise of HTML5, (and the web being, arguably, the best defined MVC system around) there has been an explosion of technologies wanting to take advantage of it for apps, notably:
Firefox RT, Chrome Apps, W3C widgets/Tizen Apps, and Opera Apps all fall in to a simple group consisting of variations on a theme. They're all HTML, CSS, and JS files packed in a zip file with a manifest. The only real difference is the manifest format (excluding some features where APIs are different).

My point is that if someone cared to create a small utility they could make development much simpler for the rest of us wanting to write true cross-platform applications. Perhaps Tizen for desktops. In the meantime, keep an eye on my github, as I may have a good reason to write something that can convert sites to standalone apps.

Happy Grace Hopper Day 2012!

Grace Hopper (December 9, 1906 – January 1, 1992) was a US Naval officer and inventor of the first compiler and machine-independent programming language.

Friday, December 7, 2012

Friday Link List

Operating Systems

Haiku, a BeOS clone is near it's first release after eleven years. The article gives a nice rundown of the project for those not in the know.

Phenomina

The Listserve is an ongoing lottery consisting of a group of people who have joined it; every day, a randomly chosen one gets to send a message to the whole group (it eventually hopes to have a million people, currently it is at around twenty-two thousand)

McSweeneys has a positively delightful short look at the future of used (e)book stores.
"Why, hello there!—I was just appraising some rare PDFs in the back room when I heard you come in. Feel free to peruse our inventory, and if you have any questions, please allow me—one of the world’s foremost authorities on and purveyors of fine electronic books—to act as your steward through the wonderfully esoteric world of antique eBook collecting."

Algorithms

Jeff Moser gives a great account of the math behind the SSL cryptography that all happens within a few milliseconds of you connecting to a secure website.

Making

Thingiverse now allows users to "collect" items together in to groups, and also allows others to view these groups. No more searching around for parts that will work together!

Server Exploits, Week One

Introduction

Some time ago, I started a project that ran Kippo, a medium interaction honeypot on a server I ran to intercept attacks that hackers were making on the system as I wanted a glimpse in to the first few moments of what they do.

In this series of videos, I'll play some of the more interesting logs with commentary as to what (I think) is going on.

The Attack


If you are watching and recognize your work, and want recognition or it to be removed, contact me and I'll be happy to oblige.

Commands Referenced in this Video

Transcript Of Attack

sales:~# w
21:56:41 up 14 days, 3:53, 1 user, load average: 0.08, 0.02, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 000.000.000.000 21:56 0.00s 0.00s 0.00s w
sales:~# ls
sales:~# free -m
bash: free: command not found
sales:~#

Wednesday, December 5, 2012

A Primer for Interacting With Hackers

hack-er n.
    An enthusiastic and skillful computer programmer or user.

The Hacker/Maker culture is a strange one; they follow different rules out of necessity.

The culture is sometimes called a subculture. That term too often derogatory in nature for my liking. Imagine them instead as perpetual students. We are a super-culture, comprised of the best ideas stolen from all the nations on Earth.

Hackers are tinkerers by nature, if they find a better way of doing something, they aren't afraid to change what they have in front of them to incorporate it; this includes their culture.

Hackers respect those that prove themselves to be master tinkerers, those capable of whipping out elegant solutions to complex problems under lots of pressure. But above all else, they respect those that put things in action; talk is cheap, the only thing that matters in the real world are real solutions.

With these three facts, you have the foundation on which to understand all of "hacker" culture.

How to Introduce Yourself

Be Formal

Being that you haven't been around long enough to know the tone of the community, it is always best to start out formal.

Speak English to the best of your ability 

English is the universal language for hackers and you'll get a much better response if you try. They're usually very patient people, because they all once stood where you are now.

Give them a way to look you up 

It is nice to put a face to the name, and it is good to show you're a real person rather than a troll.

Give your skill level and set

Solutions a community presents you will differ depending on where your general skill set is. Plus, one of them may ask you for help in an area you have expertise in.

How To Ask Questions

Show that you searched

Don't waste other people's time by asking questions that can be easily found if you searched. If you have searched, tell the community what you found and why it didn't quite answer your question.

Be Open


Context is very important in giving good answers, and if what you were doing was really so secret, you'd be the one giving the answers, not asking the questions.

Don't be pedantic

Hackers are changing the real world, and don't have much time for the theoretical, unless it is part of an elegant solution.

Please and Thank You

They are the magic words!

Don't joke unless it is on topic

Jokes are very culture dependent, and while communicating with people that can be anywhere in the world, they may be interpreted as part of your question, not make sense, or worse, be offensive.
(Acceptable jokes are on topic and should be denoted with an emoticon, e.g. "The install left lots of extra files in my root directory, I already tried sudo rm -rf / to no avail. ;)")

Get to the point

The faster the expert can answer your question and get back to their own work, the more likely it is to be answered.

How to Share Ideas/Suggestions

If you're sharing an idea or suggestion, there are several ways that make it more likely to get that idea or suggestion worked on by the community, listed from most likely to least:

Do it

Put your idea in action, the community gets help, and you get your feature in the main product.

Attempt to do it

If you can't do it totally, do your best, then ask for help, it shows initiative.

Trade

If you can't do it at all, give a good jumping off point for your idea (your notes/research/ideas so far) and do something else the community needs that is in your ability (like updating or proofing their website, mirroring their software,  doing user testing, etc.)

Mock it up

If you can't trade, try to show how your improvement would be useful to lots of people by use cases, and do some work showing how you think the improvement would work.

Pay somebody to do it

Many communities have forums you can pay for your suggestions to be implemented, just remember that you're oftentimes getting someone far cheaper than you would otherwise.