btc

Evolution of money has always been an integral part of the economy, be it the medieval or the modern time. The abstraction of money might has changed over time, but one thing remained. The Money! But every monetary system, including the one we have today has always been controlled by a central authority. It is your cash, yet you do not have control over it. What if you get to control your cash? What if you get to be your own bank? That is exactly what bitcoin is!

In 2008 a pseudonymous person or a group of people under the name Satoshi Nakomoto published a paper on The Cryptography Mailing list at metzdowd.com that gave an account of a decentralized electronic payment system eliminating the need for a trusted third party. Later in 2009, the proposed system was made live by using various technologies and concepts, by Satoshi. And the first ever virtual decentralized digital cash, the bitcoin was generated. Since 2008 up to the mid of 2010 Nakamoto was active on the Internet as well as in the Bitcoin space., after which he set up Gavin Andresen as his successor and disappeared ever since.

The fully implemented decentralized software based payment system, more specifically, the bitcoin protocol stack is made open source and is available for download, and can be run on various computing devices including your smartphone. This protocol is used by the bitcoin users to communicate with the bitcoin network. In other words, the units of digital currency or the bitcoins, are transacted over the bitcoin network using the bitcoin protocol.

The users can pretty much do anything with the bitcoin that they could do using the traditional currency. They can send or receive bitcoin, buy goods with bitcoin, pay for the flight tickets, do charity/donations, exchange for other currencies, and so on… The best part is, your transaction/payment need not wait for days or hours to be validated, but ten minutes is sufficient. Each transaction is validated by the computing devices or the “nodes” running the bitcoin protocol stack. These nodes collectively form the bitcoin network. Every node in the network is a “peer” to another and all are equal. The nodes running “full bitcoin protocol stack” use their processing power to look for a solution to a difficult problem. On an average, every ten minutes a new solution is found by a node which then validate the transactions that happened in the past ten minutes. The node is rewarded with the newly generated bitcoins. Every 10 minutes, brand new bitcoins are generated. The process is called mining, and the nodes are called miners. The valid transactions are then added to the blockchain database. The blockchain database is the distributed public global ledger. Every transaction that ever happened right from the beginning is recorded in this distributed ledger eliminating the need for an intermediate financial institution who serve as the trusted third party. With this, it also eliminates the transaction fee associated with the transaction as well.

The system’s security is ensured by features like encryption and digital signature. The bitcoins are held using a digital wallet. The wallet addresses are shared to receive bitcoins. And a private key held by the user that ensures the ownership is used to unlock the value of bitcoin to be spent or transferred. This lets you have complete control over your money. Since the transaction deals only with the use of wallet addresses masking the true identity of the person behind the transaction, makes bitcoin transaction pseudonymous ensuring privacy.

In the traditional system, the monetary base is controlled by the central bank that prints/issues currency at the rate to match the growth of the amount of goods that are exchanged. However the monetary base of the bitcoin system is fixed, and cannot be regulated. A total of 21 million bitcoins will only be ever generated. By now more than 75% of the bitcoin has been mined already. The demand for bitcoin will only increase its value, just like the metal, gold. And for the very reason, the virtual currency is called as “the digital gold”.

Bitcoin in a way, is the perfect abstraction of money since it is fast, secure, decentralized and ensures your privacy. Also, an interesting prospect is to take the system to the unbanked (roughly 2.5 billion adults). Bitcoin is not just a money, but it is the Internet of Money. The currency is not the actual invention but the system is. Bitcoin is the first application built on this system, and will not be limited just to bitcoin.

Advertisements

From the manual entry :

Nmap (“Network Mapper”) is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. While Nmap is commonly used for security audits, many systems and network administrators find it useful for routine tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime.”

Here are few common ports used by TCP/IP to map packets to services :

20 – FTP (File Transfer Protocol, data transfer)
21 – FTP (File Transfer Protocol, control)
22 – SSH (Secure Shell)
23 – Telnet
25 – SMTP (Send Mail Transfer Protocol)
80 – HTTP (Hyper Text Transfer Protocol)
110 – POP3 (Post Office Protocol, version 3)
139 – Net BIOS
443 – HTTPS (Hyper Text Transfer Protocol secure)

Well, lets explore this tool…

  • nmap takes host name as its argument. Use help option to know more.
    #nmap –help or #nmap -h

    Screenshot from 2013-11-07 13:12:01

  • Scan a single host (IPv4)
    Scan (SYN scan, by default) a host using the following command,
    #nmap host-name or #nmap host-ip
    #nmap 192.168.1.2
    For verbose output, use -v option, for more verbose output, use -vv option.

    Screenshot from 2013-11-08 00:34:27

  • Scan multiple IP address
    scan a range of IP address using
    #nmap 192.168.1.1-30
    Or scan the entire subnet using,
    #nmap 192.168.1.0/24
    you can also use wildcard,
    #nmap 192.168.1.*

    Screenshot from 2013-11-08 00:09:40

  • Stealth Scan / Half Open Scan.
    This sends SYN packet. If port open, the target sends SYN/ACK packet. Knowing that the port is open, Nmap will send RST packet to break the connection. This scan still be detected. Use -sS option to do this scan.
    #nmap -sS 192.168.1.2

    Screenshot from 2013-11-07 21:48:04

  • TCP Connect / Full Open Scan.
    A complete 3-Way handshake is established. Nmap sends SYN packet, if the port is open, the target acknowledges with SYN/ACK packet, and nmap completes the connection with the ACK packet. Use -sT option for this scan.
    #nmap -sT 192.168.1.2

    Screenshot from 2013-11-07 21:48:52

  • Scan for UDP.
    To scan all the UDP ports use -sU option.
    #nmap -sU 192.168.1.2

    Screenshot from 2013-11-07 22:19:52

  • To know the version the services are running, use
    #nmap -sV 192.168.1.2

    Screenshot from 2013-11-07 21:43:49

  • Or go for Aggressive scan, use -A option for this. It is same as using -O -sV options together.
    #nmap -A 192.168.1.2
  • ICMP scan. Just scan, don’t ping
    #nmap -PO 192.168.1.2
  • Fast scan.
    #nmap -F 192.168.1.2

    Screenshot from 2013-11-08 01:05:14

  • Specify port(s) to scan.
    You can specify the port that yo wish to know the status of. Say for an instance, port 80,
    #nmap -p 80 192.168.1.2
    Or you can scan for more than one port,
    #nmap -p 80,443 192.168.1.2
    Or give a range,
    #nmap -p 20-100 192.168.1.2

    Screenshot from 2013-11-08 01:10:46

  • To see the host interfaces and routers
    #nmap –iflist

    Screenshot from 2013-11-08 01:09:24

  • Detect the Operating system (TCP/IP fingerprinting)
    Use -O option,
    #nmap -O 192.168.1.2
    If this doesn’t work, ask nmap to guess for you.
    #nmap -O –osscan-guess 192.168.1.2

    Screenshot from 2013-11-08 00:40:39

  • Trace the Packets
    #nmap –packet-trace 192.168.1.2
    Screenshot from 2013-11-08 01:07:46

The main reason I decided to write a post on creating an ISO image from a live CD, is because most of my friends use VMware(s) and they keep downloading ISO images in-spite of having live-distros. When asked why, all they say is that they need a .iso file and can’t find one in the live distros!!

While using Linux, everything is possible.., at least we try our best to make it possible. This pretty much works for all most all the Linux/Unix distro. Other OS, I have not tried. Anyone with the solution is free to share.

Fine lets go ahead and create an ISO image from a live CD. To do this, follow these steps :

  1.  Boot your system normally. Once you are inside, insert the live CD. I found Ubuntu 11.10 (Oneiric Ocelot) live CD and will be using the same.
  2. Open your terminal. Find your live CD. To know your CD, run the command :
    $df -hT
    In my case it is /dev/sr0, it could be different in your case.
  3. Create your ISO image by running the following command :
    $cat your-cd > the-path-where-your-iso-image-must-reside/filename.iso
    In my case,
    $cat /dev/sr0 > /home/monsi/Desktop/Ubuntu\ 11.10.iso

Screenshot from 2013-10-24 21:41:59

This will take some time. Once done, an ISO image will be created in the path that you have mentioned. Go ahead and use this in your VMware, and it should work fine.

We have been using the print and echo statements in our previous posts right? We know these two are used to print. But what are they actually? These are in-built functions. When we include a print statement in our script, we are actually “calling” the in-built function print. Similarly, a user can define his/her own functions, called user-defined functions.

Functions are the block of statements that can be used repeatedly in a script. These lines will be executed only upon a  “call” to the function.

User defined function :

Function declaration starts with the keyword “function” followed by function name. A function name can start with a letter or underscore and are case-insensitive.

Syntax :

function functionName() {
//code to be executed
}

1. Simple php function.
Lets write a simple php function.


<?php
//simple function.
function printMessage() {
echo "Ahoy!!";
}

printMessage(); // call the function.
?>

2. Function with arguments.

Arguments are like variables. Their scope is limited only to that particular function to which they have been passed. Passing the arguments is nothing but passing the information. Arguments are specified after the function name, inside the parentheses. A number of arguments can be passed each one separated  by a comma. The following example illustrates the function with a single argument.


<?php
//function with arguments.
function printMessageArg1($name) {
echo "$name";
}

printMessageArg1("Adonis"); // call the function.
?>

3. Function with default arguments value.

You can give your arguments a default value, like so :


<?php
//function with default arguments value.
function printMessageArg2($age=20) {
echo "your age is $age";
}

printMessageArg2(30); // call the function.
echo "<br>";
printMessageArg2(); // call the function. No value is passed, hence will take the default value specified.
?>

4. Function with return values.

You can make your function pass some information to the called function, using the keyword “return“. This value is called return value. The following function computes the sum of two numbers and returns the same to the called function :


<?php
//function with return values.
function retSum($x=0,$y=0) {
$z=$x+$y;
return $z;
}

$a=retSum(2,3); // call the function.
echo "$a<br>";
$a=retSum(3.57,66.3344); // call the function.
echo "$a<br>";
$a=retSum(); // call the function.
echo "$a<br>";
?>

Scapy is a powerful packet manipulation tool, network scanner, packet generator, packet sniffer, etc. Scapy uses python interpreter as a command board. So you can perform any python operations to design your packets. You can install scapyt by typing the following in your terminal (Ubuntu).

#apt-get install python-scapy

Start Scapy by running the following in your terminal (you should be a root user), once your done with your installation.

#scapy -s mysession

Screenshot from 2013-09-27 01:51:15

Vital commands to begin with :

ls() – Lists supported protocol layers.

Screenshot from 2013-09-27 02:09:26

If a protocol layer is given as parameter, it lists the fields and types of fields associated with that particular protocol layer. Lets try, the Internet protocol layer.
#ls(IP)
And the result would be something like this…

Screenshot from 2013-09-27 02:12:35

lsc() – Lists some user commands. If a command is given as parameter, its documentation is displayed.

Screenshot from 2013-09-27 02:10:27

conf – This contains the configuration.

Screenshot from 2013-09-27 02:14:30

Fine, what are we waiting for? Lets go ahead and create our own packet. Lets create a TCP/IP packet.

>>> i=IP() #create IP packet
>>> i.dst="192.168.1.10" #destination = 192.168.1.10
>>> i.src="192.168.1.3" #source = 192.168.1.3
>>> i.ttl=128 #time to live = 128
>>> i.show() #show the created packet
###[ IP ]###
version= 4
ihl= None
tos= 0x0
len= None
id= 1
flags=
frag= 0
ttl= 128
proto= ip
chksum= None
src= 192.168.1.3
dst= 192.168.1.10
\options\
>>> t=TCP() #create TCP packet
>>> send(i/t) #send the packets, '/' is used as a separator

Screenshot from 2013-09-27 02:05:26

Now the packet is sent. But how do you confirm? Well, we know Wireshark! Go ahead and start your Wireshark, and resend the packet to actually capture your packet. Here is what I captured,

Screenshot from 2013-09-27 02:07:16

When the same block of code has to be repeated over and over again, say for ‘N’ times, we can write the block of code ‘N’ times. But still we don’t want to do this (even though we are experts in ctrl-c and ctrl-v). That’s because computers are here to reduce our work right? So, we just want to make the best use of our computers.

In PHP, we have the following looping statements :

1. while : As long as the condition specified is true, execute a block of code.

while (condition) {
//code to be executed
}


<?php

//1. while loop.
echo "<strong>1. while loop.</strong><br>";
$x=0;
while ($x<=5) {
echo "\$x : $x <br>";
$x++;
}

?>

2. do… while : The condition is checked after executing the block of code once, and loops through the block of code until the specified condition is true.

do {
//code to be executed.
} while (condition);


<?php

//2. do...while loop.
echo "<br><br><strong>2. do...while loop.</strong><br>";
$x=0;
do {
echo "\$x : $x <br>";
$x++;
} while ($x==5);

?>

3. For loop : for loop can be used when you know beforehand how many times a block of code must be executed.

for (init counter; test counter; increment counter) {
//code to be executed
}


<?php

//3. for loop.
print "<br><br><strong>3. for loop.</strong><br>";
for ($x=0; $x<=5; $x++) {
echo "\$x : $x <br>";
}

?>

4. foreach loop : This loop works only on arrays. It is used to loop through each value in an array.

foreach ($array as $value) {
//code to be executed
}


<?php

//4. foreach loop.
echo "<br><br><strong>4. foreach loop.</strong><br>";
$fruits = array("apple","mango","grape","cherry");
foreach ($fruits as $value) {
echo "$value <br>";
}

?>

We do so much technical and serious stuffs. Fun is equally important. Following are few cool stuffs I found, so sharing with yo guys…

Fork Bomb

Type the following in the terminal (at your own risk). This repeatedly creates the child process.

:(){ :|:& };:

This is same as the following in C.

while (true) {
fork();
}

Screenshot from 2013-09-23 01:34:30

yes command

This command prints the parameter passed repeatedly until interrupted (ctrl+c).

#yes print this line

Screenshot from 2013-09-23 01:15:08

espeak

Listen to the e-voice. Turn on your speakers before you execute this command. (To install espeak, #apt-get install espeak).

#espeak “Hello there, how are you”

Screenshot from 2013-09-23 02:19:17

cmatrix

How many have played with the batch file and were crazy about the matrix rain as the startup guys in windows? Why did we stop this in with Linux? Try cmatrix… (To install cmatrix, #apt-get install cmatrix).

#cmatrix
#cmatrix -b (this is cool.)

Screenshot from 2013-09-23 00:58:06

aafire

Like fire? (To install aafire, #apt-get install aafire).

#aafire

Screenshot from 2013-09-23 01:00:27

oneko

Love cute graphic? Try oneko (To install, #apt-get install oneko).

#oneko

Screenshot from 2013-09-23 00:59:14

toilet

I know, funny name… But this is used for graphical word art. (To install, #apt-get install toilet).

#toilet ginger

Screenshot from 2013-09-23 01:04:47

cowsay

ASCII cow art. Fans of cDc and people used to metasploit framework would be used to this cow… (To install, #apt-get install cowsay).

#cowsay Ahoy

Screenshot from 2013-09-23 01:07:00

xcowsay

Pure graphics implementation. (To install, #apt-get install xcowsay).

#xcowsay linux

Screenshot from 2013-09-23 01:10:35

funny manpages

This is damn funny!! Install this (#apt-get install funny-manpages). And try the following list…

baby
celibacy
condom
date
echo
flame
flog
gong
grope, egrope, fgrope 
party 
rescrog 
rm
rtfm
tm
uubp
xkill 
xlart 
sex 
strfry

#man celibacy

Here is the screenshot for #man celibacy
Try others, it is really funny!!

Screenshot from 2013-09-23 02:15:50

Complimentary :P

Screenshot from 2013-09-23 01:22:41

And also…, this :

Online Command line fm for geeks…, do check it out…

cmd.fm