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.

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

Say you want to execute a block of code upon some condition, well, that’s were conditional statements comes handy.

PHP supports the following conditional statements :

1. if statement : Codes in the block (codes within {…}) are executed only if the specified condition is true.

if (condition) {
//codes to be executed.
}

<?php
//1. if statement.
echo "1. if statement.";
echo "<br>";
$x=10;
if ($x > 0) {
echo "This is true <br>";
}
?>

2. if… else statement : Execute one of the block. Block1 if the condition is true. Block2 if the condition is false.

if (condition) {
//codes to be executed.
}
else {
//codes to be executed.
}

<?php
//2. if... else statement.
echo "2. if... else statement.";
echo "<br>";
$x=2013;
if ($x == 2013) {
echo "We are in 2013 <br>";
}
else {
echo "We are not in 2013 <br>";
}
?>

3. if…elseif…else statement : Select one of the blocks to be executed out of many.

if (condition) {
//codes to be executed.
}
elseif {
//codes to be executed.
}
.
.
.
else {
//codes to be executed.
}

<?php
//3. if...elseif...else statement.
echo "3. if...elseif...else statement. <br>";
$mood = "boring";
if ($mood == "sleepy") {
echo "Save the code, and go to sleep <br>";
}
elseif ($mood == "boring") {
echo "Go browse something fun and get back <br>";
}
else {
echo "continue...";
}
?>

4. Switch statement : Select one of the blocks to be executed out of many.

switch (pattern) {
case label1 :
//execute the codes in here if label1==pattern.
break;
case label2 :
//execute the codes in here if label2==pattern.
break;
.
.
.
case labelN :
//execute the codes in here if labelN==pattern.
break;
default :
//execute the codes in here if none of the above label’s match the pattern.
}

<?php
//4. Switch statement.
echo "4. Switch statement. <br>";
$language = "php";
switch ($language) {
case "perl":
echo "We are coding using perl";
break;
case "python":
echo "we are coding using python";
break;
case "javascript":
echo "we are coding using javascript";
break;
default:
echo "We are coding using php";
}
?>

4. PHP – Operators.

Posted: September 20, 2013 in Hypertext Preprocessor (PHP)
Tags: ,

==>Arithmetic operators.

We can perform various arithmetic operations like addition (+), subtraction (-), multiplication (*), division (/) and modulus (%).
$variable (or a constant value) operator $variable (or a constant value).
Here is the code that demonstrates various arithmetic operations.

<?php
//Arithmetic operators.
echo "<strong>Arithmetic operations</strong> <br>";
$x=10.35;
$y=6;
echo "Additon <br>";
echo ($x + $y); //Addition.
echo "<br>Subtraction <br>";
echo ($x - $y); //Subtraction.
echo "<br>Multiplication <br>";
echo ($x * $y); //Multiplication.
echo "<br>Division <br>";
echo ($x / $y); //Division.
echo "<br>Modulus <br>";
echo ($x % $y); //Modulus.
?>

==>Assignment Operator.

We use ‘=’ to assign.
$variable = <value>
The example code :

<?php
//Assignment Operator.
echo "<br> <br><strong>Assignment operations</strong> <br>";
$x = $y;
echo "\$x has been assigned the value of \$y. Now \$x=$x";
?>

==>String Operators.

Concatenation : We use the dot (.) operator to achieve concatenation.
$variable (or a string).$variable (or a string)

<?php
//String Operators.
echo "<br> <br><strong>String operations</strong> <br>";
echo "Concatenation.<br>";
$a = "open ";
$b = "source";
$c = $a.$b; //concatenation.
echo "$c";
?>

==>Increment/Decrement Operators.

1. Pre-increment (++$variable).
2. Post-increment ($variable++).
3. Pre-decrement (–$variable).
4. Post-decrement ($variable–).

<?php
//Increment/Decrement Operators.
echo "<br> <br><strong>Increment/Decrement operations</strong> <br>";
echo "1.Pre-increment.<br>";
$x=0;
echo ++$x; // Pre-increment
echo "<br>2.Post-increment.<br>";
$y=0;
echo $y++; // Post-increment
echo "<br>3.Pre-decrement.<br>";
$z=10;
echo --$z; // Pre-decrement
echo "<br>4.Post-decrement.<br>";
$a=10;
echo $a--; // Post-decrement
?>

==>Comparison Operators.

1. Equal (==) :  Data types are not considered, just the values are considered.
2. Identical (===) : Data types are considered.
3. Not equal (!= ).
4. Not identical (!==).
5. Less than (<).
6. Less than or equal (<=).
7. Greater than (>).
8. Greater than or equal (>=).

<?php
//Comparison Operators.
echo "<br> <br><strong>Comparison operations</strong> <br>";
$x=2013;
$y="2013";
echo "1.Equal.<br>";
var_dump($x == $y); //Equal
echo "<br>2.Identical.<br>";
var_dump($x === $y); // Identical
echo "<br>3.Not equal.<br>";
var_dump($x != $y); // Not equal
echo "<br>4.Not identical.<br>";
var_dump($x !== $y); // Not identical
$a=5;
$b=10;
echo "<br>5.Greater than.<br>";
var_dump($a > $b); //Greater than
echo "<br>6.Less than<br>";
var_dump($a < $b); //Less than
?>

==>Logical Operators.

1. AND ($variable and $variable / $variable && $variable).
2. OR ($variable or $variable / $variable || $variable).
3. XOR ($variable xor $variable).
4. NOT (!$variable).

<?php
//Logical Operators.
echo "<br> <br><strong>Logical operations</strong> <br>";
$x=true;
$y=false;
echo "1.AND<br>";
var_dump($x && $y); // And
echo "<br>2.OR<br>";
var_dump($x || $y); // Or
echo "<br>3.XOR<br>";
var_dump($x xor $y); // Xor
echo "<br>4.NOT<br>";
var_dump(!$x); // Not
?>

==>Array operators.

1. Union (+) : Duplicates are removed.
2. Equality (==).
3. Identity (===).
4. Inequality (!=).
5. Inequality (<>).
6. Non-identity (!==).

<?php
//Array operators.
echo "<br> <br><strong>Array operations</strong> <br>";
$x = array("a" => "mango", "b" => "cherry");
$y = array("b" => "cherry", "c" => "apple");
$z = $x + $y; // union of $x and $y
echo "1.union<br>";
var_dump($z);
echo "<br>2.Equality<br>";
var_dump($x == $y);
echo "<br>3.Identity<br>";
var_dump($x === $y);
echo "<br>4.Inequality<br>";
var_dump($x != $y);
echo "<br>5.Inequality<br>";
var_dump($x <> $y);
echo "<br>6.Non-identity<br>";
var_dump($x !== $y);
?>

Constants :

Constants as the name indicates, as they are defined they cannot be changed during the script. A constant is an identifier. A valid constant starts with a letter of underscore, and are automatically global across the script. To set a constant, we use the function, define(). For an instance :

<?php
//Constants
define (“constnt”,”This is a constant and cannot be changed”);
echo constnt;
?>

Comments :

PHP supports three different types of comments.

  • Multi-line comment as in C.
    /*——–comment——–*/
  • Single-line comment (//) as in C and C++.
    //———comment———-
  • Single-line comment (#) as in Perl.
    #———comment———–

Here is the code to demonstrate the above :


<!DOCTYPE html>
<html>
<body>

<?php
//Constants
define ("constnt","This is a constant and cannot be changed");
echo constnt;

//Comments...

/*php
supports
multi-line
comment.
*/

//single-line comment.

#And also the single-line comment using #, as in perl.
?>

</body>
</html>

BASICS OF NETWORKING

Posted: September 15, 2013 in Networks/Administration
Tags:

gh0st0625's avatard3viL_0625

1 ) Introduction

A) What is network

Image

A network is nothing more than two or more computers or machines connected by cables or by wireless connection so that they can exchange information and use the resource.The connection that is link could be in anyway like cables,satellite,infrared beams,telephone cables and radio waves also.

The best know computer network is the internet.

B) Why we use network

We use networking for exchange of information and messages etc..

Benefits of networking:

File sharing :  Network of computers helps the user  to share data files.

Hardware sharing : Users can share hardware’s like printer’s and scanner.

 User Sharing : Networks, Allows user to communicate user to communicate using e-mail, video conferencing etc

Network gaming : Lots of games  are available with multiplayer options now, by connecting network we can use this option.

2) Creating a network and types of network

View original post 1,276 more words

gh0st0625's avatard3viL_0625

What are Networking Cables :

Networking cables are used to connect one network device to other network devices or to connect two or more computers to share printer, scanner etc

TYPES OF NETWORKING CABLES :

A ) Twisted Pair :  Twisted pair cables are mainly classified into 2 types

1.a)  Shielded Twisted Pair

 

 

Image

 

1. STP is a type of copper wiring in which each of the two copper wires that are twisted together are coated with an insulting coating that functions as a ground for the wires.

2.The extra covering in shielded twisted pair wiring protects the transmission lines from electromagnetic interference leaking into or out of the cable.

1.b)  Unshielded Twisted Pair

Image

 

1. UTP is a type of copper wiring cable that consists of two unshielded wires twisted around each other.

B ) Coaxial Cable

Image

 

 

Coaxial cable is a…

View original post 237 more words

NETWORKING TOPOLOGY :

Posted: September 15, 2013 in Networks/Administration
Tags: ,

gh0st0625's avatard3viL_0625

Network topology is the arrangement of the various elements (links,nodes, etc.) of a computer or biological network.

Essentially, it is the topological structure of a network, and may be depicted physically or logically,

Physical topology refers to the placement of the network’s various components,including device location and cable  installation,while logical topology shows how data flows within a network,regardless of its physical design.

There are many types of Network topologies but i’ll be explaining 4 types :

a) BUS : 

Image

A Bus network topology is a network architecture in which a set of clients are connected via a shared communications line/cables,called a bus.

Bus networks are the simplest way to connect multiple clients,but may have problems when two clients went to transmit at the same time on the same bus.

Thus systems which use bus network architectures normally have some scheme of collision handling or collision avoidance for communication on the…

View original post 237 more words

Monitor the incoming and outgoing traffic in your network using the IPTables.

IPTables by Netfilter organization is the firewall for Linux systems and is the successor of the popular Linux firewalls, IPChains and IPfwadm. In the Linux distributions RedHat and Fedora, IPTables is the default pre-installed firewall package. Download IPTables from freecode or for the ones interested in the source code, here is the git tree.

Once your IPTables is set, you can start defining your policies. You must be the root/super user to do this. So, lets begin. Let us start with the help command.
#iptables –help

To check the version :
#iptables –version
or
#iptables -V

Screenshot from 2013-09-15 00:56:54

Packet Processing :

There are basically four Tables, or the built-in queues for processing. Each table has its own functionality and is handled by a filtering chain (the firewall policies are placed in here).

To enlist all the available rules under the targeted table, use the following :
#iptables -L -t <table_name>

1. Filter table : Default table. Associated with the packet filtering and has three in-built chains.

#iptables -L -t filter

  • Input chain controls the traffic entering the system.
  • Forward chain controls the traffic being routed through the system.
  • Output chain controls the traffic leaving the system.

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

2. NAT (Network Address Translation) Table : For alternating the source and/or destination IP address and has four in-built chains.

#iptables -L -t nat

  • Prerouting chain used to NAT packets after changing their destination address.
  • Input chain handles packet that are entering the system.
  • Output chain handles packet that are leaving the system.
  • Postrouting chain used to NAT packets after changing their source address.

Screenshot from 2013-09-15 00:58:38

3. Mangle Table : It is related to modification of the Quality of Service bits in the TCP header. It is a combination of filter and NAT tables and has five chains.

#iptables -L -t mangle

  • Prerouting chain.
  • Input chain.
  • output chain.
  • Forward chain.
  • Postrouting chain.

Screenshot from 2013-09-15 00:59:36

4. Raw Table : Associated with the packets that are not traced. It contains two chains.

#iptables -L -t raw

  • Prerouting chain.
  • Output chain.

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

Insert New Rule(s) :

To insert new rule(s), use :

#iptables -I <target_chain> <rule_position> -t <target_table> <the_rule> -j <action>

Here -I indicates insert a rule in target chain at a specified position (this is for priority) and -j indicates jump to the action indicated, and the action can be, drop, reject and accept.

Let me demonstrate to reject the packets from a specific IP. Here I will be using backtrack machine running on the VirtualBox on my Ubuntu machine. Let us define all the rules for our Ubuntu 12.04 machine. I have set my Backtrack’s IP as, 192.168.1.3/24 and my Ubuntu’s IP as 192.168.1.10. To reject the packets :

#iptables -I INPUT 1 -t filter -s 192.168.1.3/24 -j REJECT

Now that the policy is places, lets see how it works. Lets send some ICMP packets, go ahead and ping the Ubuntu machine (192.168.1.10).

Screenshot from 2013-09-15 01:18:43

As you can see, all the packets are rejected and we are getting ICMP error message. If you don’t want to reply with an error message, you can just DROP the packets. This will give the user no information dropping the packets silently. To silently drop the packets :

#iptables -I INPUT 1 -t filter -s 192.168.1.3/24 -j DROP

Try pinging now.

Screenshot from 2013-09-15 01:20:31

As you can see in the screenshot, the sent 28 packets are dropped silently and the user gets no error message.

Not necessarily you must stick to the positioning. You can also append your rules using the option -A. To append your policy :

#iptables -A <target_chain> -t <target_table> <the_rule> -j <action>

Let us append the following rule :

#iptables -A INPUT -t filter -d 192.168.1.3/24 -j REJECT

This rule prevents any packet reaching the destination IP 192.168.1.3/24, generated by the host. Let us try sending few packets to the destination IP,

#ping 192.168.1.3

Screenshot from 2013-09-15 01:24:17

As you can see, no packets reach the destination IP from the host.  similarly you can append more rules :

#iptables -A INPUT -t filter -d 192.168.1.3/24 -j DROP

But instead of packets, sometimes it is necessary to define rules for a specific protocol or port. This can be done using :

#iptables -A <target_chain> -t <target_table> -p <protocol_name> -j <action>

For an instance,

#iptables -A INPUT -t filter -s 192.168.1.3/24 -p tcp –dport 80 -j REJECT

The above rule will reject all the http (port 80) packets from the specified IP.

Screenshot from 2013-09-15 01:33:52

Delete a rule or Flush all the rules :

You can delete the rule by :

#iptables -D <target_chain> <rule_position> -t <target_table>

#iptables -D INPUT 1 -t filter

will delete the first rule defined in the INPUT chain of the filter table.

To remove/flush all the rules :

#iptables -F -t <target_table>

#iptables -F -t filter

will flush all the rules defined in the filter table.

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

Saving the rules :

The rules we set are all volatile, and will be flushed once the system is restarted. To save these changes permanently, use the following :

for ubuntu : #iptables-save > /etc/iptables,rules

Screenshot from 2013-09-15 01:35:44

PHP supports various data types.

1. Integers : All natural numbers.

$x=34;

2. Floating point numbers : Fractional values.

$x=4.5;

3. Boolean : Boolean value can be either true or false.

$x=false;

4. Null : Null value specifies that the variable has no value.

$x=null;

5. Array : We can store multiple values using the array. Array values can be mixed, meaning, it can have integer value, floating point numbers, or strings.

$x= array(“Hello”, 2, 3.5);

6. String.

$x=”Ahoy!”;

Let us test these data types. Instead of using echo to print the values, let us use something called, var_dump. This prints both the data type as well as the value.

==>String Functions.

1. strlen() – Returns the length of the provided string.

echo strlen(“this line”);

2. strpos() – Returns the position of the character in the string or the stating position of the text in the string.

echo strpos(“lazy dog”,”dog”);


<!DOCTYPE html>
<html>
<body>

<?php
//Integer.
$x = 376;
var_dump ($x);
echo "<br>";

//float.
$x=3.4;
var_dump($x);
echo "<br>";

//boolean.
$x=true;
var_dump($x);
echo "<br>";

//Null.
$x=null;
var_dump($x);
echo "<br>";

//array.
$x=array("word", 2, 4.00, 'x');
var_dump($x);
echo "<br>";

//string.
$x="Ahoy!";
var_dump($x);
echo "<br>";

//---------------------------------------------------------------------------------------------------------
//string functions.

//1. strlen() - length of the string.
echo strlen ("This is a sentence.");
echo "<br>";
//2. strpos() - search a specified char or text within a string.
//This returns the position of the character specified, or starting
//position of the text specified.
echo strpos("Lazy dog","dog");

?>

</body>
</html>