Lanmap – Network discovery tool

Lanmap Listens to all available traffic on the interface of your choice, figures out who’s talking to who, how much, using which protocols.This information is then put into a nice human-readable 2d image (various formats are available) which can be used to understand a network’s topology.

Install lanmap in Ubuntu

sudo aptitude install lanmap

This will complete the installation

Using lanmap

lanmap syntax

lanmap [-o directory] [-e program] [-T {png,gif,svg}] [-f filtetr] [-D {#,all,raw}] [-r seconds]

[-i {?,*wildcard*,iface}] [-h] [-v] [-V]

lanmap example

lanmap -i eth0 -r 30 -T png -o /tmp/

This will create a lanmap.png file under tmp folder

lanmap available options

-o directory – The directory in which to save the generated images. Default is the current directory.

-e program – The program to use to generate images. Default is twopi.

-T {png,gif,svg} – Output image format. Default is png.

-f filter – Traffic filter, in libpcap syntax.

-D {#,all,raw} – Debug mode; lots of output, use with caution. #: payload bytes to dump (default: 0)

-r seconds – Set the time interval between 2 consecutive graph generations. Default is 60 seconds.

-i {?,*wildcard*,iface} – Interface to use: ?: list all devices and exit *3Com*: use the first NIC with

“3Com” in it

-V – Version info.

-vv – Verbose mode, up to 3 levels (-vv, -vv09:21 29/11/2007v).

-h – Help message.

Advertisements

Java Programming Style Guide

Introduction

The Java language gives you all the room you need to write code that would be very difficult for others to understand. Java also permits you to write code that is very easy to understand. Most development teams would prefer the latter.

A style guide provides provides a map so that the code generated by a group of programmers will be consistent and, therefore, easier to read and maintain. Many people do not care for the style guide offered by Sun. This document is one alternative.

This document covers most areas where there could be confusion or difference of opinion. Areas that have never been a problem in our experience are undocumented.

1 – Formatting

1.1 – Indentation

  • All indents are four spaces. All indenting is done with spaces, not tabs.
  • Matching braces always line up vertically in the same column as their construct.
  • All if, while and for statements must use braces even if they control just one statement.

1.2 – Spacing

  • All method names should be immediately followed by a left parenthesis.
  • All array dereferences should be immediately followed by a left square bracket.
  • Binary operators should have a space on either side.
  • Unary operators should be immediately preceded or followed by their operand.
  • Commas and semicolons are always followed by whitespace.
  • All casts should be written with no spaces.
  • The keywords if, while, for, switch, and catch must be followed by a space.

1.3 – Class Member Ordering

class Order
{
// fields

// constructors

// methods
}

1.4 – Maximum Line Length

Avoid making lines longer than 120 characters.

1.5 – Parentheses

Parentheses should be used in expressions not only to specify order of precedence, but also to help simplify the expression. When in doubt, parenthesize.

2 – Identifiers

All identifiers use letters (‘A’ through ‘Z’ and ‘a’ through ‘z’) and numbers (‘0’ through ‘9’) only. No underscores, dollar signs or non-ascii characters.

2.1 – Classes and Interfaces

All class and interface identifiers will use mixed case. The first letter of each word in the name will be uppercase, including the first letter of the name. All other letters will be in lowercase, except in the case of an acronym, which will be all upper case.

2.2 – Packages

Package names will use lower case characters only. Try to keep the length under eight (8) characters. Multi-word package names should be avoided.

2.3 – All Other Identifiers

  • All other identifiers, including (but not limited to) fields, local variables, methods and parameters, will use the following naming convention. This includes identifiers for constants.
  • The first letter of each word in the name will be uppercase, except for the first letter of the name. All other letters will be in lowercase, except in the case of an embedded acronym, which will be all uppercase. Leading acronyms are all lower case.
  • Hungarian notation and scope identification are not allowed.
  • Test code is permitted to use underscores in identifiers for methods and fields.

3 – Coding

3.1 – Constructs to Avoid

  • Never use do..while.
  • Never use return in the middle of a method.
  • Never use continue.
  • Never use break other than in a switch statement.

3.2 – Do Not Compound Increment Or Decrement Operators

  • Use a separate line for an increment or decrement.
  • Never use pre-increment or pre-decrement

3.3 – Initialization

Declare variables as close as possible to where they are used.

3.4 – Access

All fields must be private, except for some constants.

4 – Self-Documenting Code

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”

— Martin Fowler, Refactoring: Improving the Design of Existing Code

Rather than trying to document how you perform a complex algorithm, try to make the algorithm easier to read by introducing more identifiers. This helps in the future in case the algorithm changes but someone forgets to change the documentation.

Source: JavaRanch

Let Me Know

When was the last time you knew of a great opportunity – only too late?

Let Me Know is an effort to connect the best candidates to the best opportunities (beyond jobs) in India. Breaking the information barrier. Finally.

A volunteer team of graduate and undergraduate students across majors and interests will contribute information of opportunities to this blog. The opportunities could be Cul-Fests, Tech-Fests, Biz, Lit, Geek, Gyaan, Volunteer or Internships.

So no Google, no Yahoo its just Let Me Know. One stop place for hordes of events covering all your tastes.

Great Software Quotes

Before software can be reusable, it first has to be usable.

–Ralph Johnson

Good judgment comes from experience, and experience comes from bad judgment.

–Fred Brooks

Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why it works. Programmers combine theory and practice: Nothing works and they don’t know why. It’s hard enough to find an error in your code when you’re looking for it; it’s even harder when you’ve assumed your code is error-free.

-Steve McConnell Code Complete

If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilisation.

-Gerald Weinberg

The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt.

–Bertrand Russell

If debugging is the process of removing bugs, then programming must be the process of putting them in.

–Edser Dijkstra

There are two ways to write error-free programs; only the third works.

–Alan J. Perlis

Measuring programming progress by lines of code is like measuring aircraft building progress by weight.

–Bill Gates

The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.

–Tom Cargill

Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.

–Anon

I did say something along the lines of “C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows your whole leg off.”

–Bjarne Stroustrup

If the code and the comments disagree, then both are probably wrong.

–attributed to Norm Schryer

As we said in the preface to the first edition, C “wears well as one’s experience with it grows.” With a decade more experience, we still feel that way.

–Brian Kernighan and Dennis Ritchie

Simplicity is prerequisite for reliability

–Edsger W.Dijkstra

Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves.

–Alan Kay

Every program has (at least) two purposes: the one for which it was written, and another for which it wasn’t.

–Alan J. Perlis

Copy and paste is a design error

–David Parnas

Any code of your own that you haven’t looked at for six or more months might as well have been written by someone else.

–Eagleson’s law

The Banana: Amazing Fruit

Banana

Bananas contain three natural sugars – sucrose, fructose and glucose combined with fiber. A banana gives an instant, sustained and substantial boost of energy. Research has proven that just two bananas provide enough energy for a strenuous 90-minute workout. No wonder the banana is the number one fruit with the world’s leading athletes. But energy isn’t the only way a banana can help us keep fit. It can also help overcome or prevent a substantial number of illnesses and conditions, making it a must to add to our daily diet.

Depression: According to a recent survey undertaken by MIND amongst people suffering from depression, many felt much better after eating a banana. This is because bananas contain tryptophan, a type of protein that the body converts into serotonin, known to make you relax, improve your mood and generally make you feel happier.

PMS: Forget the pills – eat a banana. The vitamin B6 it contains regulates blood glucose levels, which can affect your mood.

Anemia: High in iron, bananas can stimulate the production of hemoglobin in the blood and so helps in cases of anemia.

Blood Pressure: This unique tropical fruit is extremely high in potassium yet low in salt, making it perfect to beat blood pressure. So much so, the US Food and Drug Administration has just allowed the banana industry to make official claims for the fruit’s ability to reduce the risk of blood pressure and stroke.

Brain Power: 200 students at a Twickenham (Middlesex) school were helped through their exams this year by eating bananas at breakfast, break, and lunch in a bid to boost their brain power. Research has shown that the potassium-packed fruit can assist learning by making pupils more alert.

Constipation: High in fiber, including bananas in the diet can help restore normal bowel action, helping to overcome the problem without resorting to laxatives.

Hangovers: One of the quickest ways of curing a hangover is to make a banana milkshake, sweetened with honey. The banana calms the stomach and, with the help of the honey, builds up depleted blood sugar levels, while the milk soothes and re-hydrates your system.

Heartburn: Bananas have a natural antacid effect in the body, so if you suffer from heartburn, try eating a banana for soothing relief.

Morning Sickness: Snacking on bananas between meals helps to keep blood sugar levels up and avoid morning sickness.

Mosquito bites: Before reaching for the insect bite cream, try rubbing the affected area with the inside of a banana skin. Many people find it amazingly successful at reducing swelling and irritation.

Nerves: Bananas are high in B vitamins that help calm the nervous system.

Ulcers: The banana is used as the dietary food against intestinal disorders because of its soft texture and smoothness. It is the only raw fruit that can be eaten without distress in over-chronicler cases. It also neutralizes over-acidity and reduces irritation by coating the lining of the stomach.

Temperature control: Many other cultures see bananas as a “cooling” fruit that can lower both the physical and emotional temperature of expectant mothers. In Thailand, for example, pregnant women eat bananas to ensure their baby is born with a cool temperature.

Seasonal Affective Disorder (SAD): Bananas can help SAD sufferers because they contain the natural mood enhancer tryptophan.

Smoking & Tobacco Use: Bananas can also help people trying to give up smoking. The B6, B12 they contain, as well as the potassium and magnesium found in them, help the body recover from the effects of nicotine withdrawal.

Stress: Potassium is a vital mineral, which helps normalize the heartbeat, sends oxygen to the brain and regulates your body’s water balance. When we are stressed, our metabolic rate rises, thereby reducing our potassium levels. These can be rebalanced with the help of a high-potassium banana snack.

Strokes: According to research in “The New England Journal of Medicine, ‘eating bananas as part of a regular diet can cut the risk of death by strokes by as much as 40%!

Warts: Those keen on natural alternatives swear that if you want to kill off a wart, take a piece of banana skin and place it on the wart, with the yellow side out. Carefully hold the skin in place with a plaster or surgical tape!

So, a banana really is a natural remedy for many ills. When you compare it to an apple, it has four times the protein, twice the carbohydrate, three times the phosphorus, five times the vitamin A and iron, and twice the other vitamins and minerals. It is also rich in potassium and is one of the best value foods around So maybe its time to change that well-known phrase so that we say, “A banana a day keeps the doctor away!”

Complete Guide to Bananas