14 May, 2011

Does your Gmail account hacked yesterday ??? who knows


You knows !!! Gmail is considered as one among the best email services today, so people are using it for both business and personnel usage. Then comes the issue of security that protects the mails in your inbox. Make sure that your gmail account is safe and open to you only. Google offers activity information mechanism for finding weather your gmail account is hacked or not. Its simple.., you don't need to be a geek. This post will help you to identify weather someone else is accessing your inbox.



Navigate to the bottom side of the gmail inbox. I just pinned the snapshot of mine here. Check for the line starting with the sentence 'Last account activity : x hours ago at IP x.x.x.x'. There you can find a link labeled 'Details'. Click their to see the log information on your gmail inbox and make sure that you are the only one used that account.



Make sure that the IP addresses listed are the same ones that you used. Check the country, date, time and access type also, and identify weather it matches with your usage. Once i have seen a log from a different ip address on my gmail's log. It appeared to be one from Aisanet's network. (That was a my first experience of being hacked). Later i found it was not an accidental one. This unwanted access was from an  internet cafe once i used 2-3 days before the hazard, and what really happened was i really forgot to logout from my gmail account when i quit the cafe. If you feels the same, then understand this is the right time to change your google account's password. Do it  now itself, else you may be the next victim. Changing the passwords frequently is always refered as the best methode to escape from hacks and unwanted access to your personals kept on internet...

Finding ip adress of your machine

If you dont want to go technical just visit the website tracemyip to know your ip address and related details.  



If you are a unix guy, use the ifconfig command on the terminal to know your ip. The field shown as 'inet addr' corresponding to your mode of connection (eth, wlan, ppp) is the ip.





and, If you are windows guy, use the dos command ipconfig in the command prompt window to view your ip. 


Note :
  • Ip address may not be the same for every time you connects, if you are not using a static connection.. 
Read rest of entry

27 January, 2011

python xmlrpc : a simple client server connection mechanism with greater possibilities

A byte of theory . . .

XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a transport. With it, a client can call methods with parameters on a remote server (the server is named by a URI) and get back structured data. This module supports writing XML-RPC client code; it handles all the details of translating between conformable Python objects and XML on the wire.

A byte of surprise . . .


Here the xmlrpc library of the python does the magic, by leaving the  programmer give maximum attention to logic by freeing him from the concepts of the sockets, binding, listening, accepting, etc ... which are the primary constraints while developing a  network based program. Remote Procedure Call (RPC) mechanism allows the client to call any function defined and registered as 'remote' in the server.

A byte of reality . . .


xmlrpc library offers communication between the client and server in such a way that, we can define functions in one machine (say a server) and access those functions from the other machine (say a client). Here the communication occurs in two ways.
    >< client calling the remote server function can 
           pass arguments to it. So the server recieves this 
           arguments 
   ><  Server can transport some data as the return 
           value of the function that the client called

A byte of practical . . .


    Inorder to make the client and server communicate together we need to create the server object and client object with the ip and port of the server. Here i am running the client and server on the same machine. You can replace 127.0.0.1 in sample code with the ip of the server where you need to connect the clients. Port should be greater than the 1024.

server program

   import xmlrpclib
   from SimpleXMLRPCServer import SimpleXMLRPCServer
   def add(a, b) :
         return a+b
   server=SimpleXMLRPCServer(("127.0.0.1",9009))
   server.register_function(add)
   server.serve_forever()


In server program we have to create the object of the server with a method called SimpleXMLRPCServer() with parameters as ip and port. Then the function has to be registered inorder to access it remotely. The serve_forever() function is used to put the server wait for the client request infinitely.
client program
    
    import xmlrpclib
    server = xmlrpclib.ServerProxy('http://127.0.0.1:9009')
    a=input("No 1: ")
   
b=input("No 2: ")
    result = server.add(a,b)
    print "Result  :  "+result

In the client program we will use the ServerProxy() method to specify the details(port, ip) of the server which is having a function named add() which can be called remotely. So two integers a,b are passed as parameters to the remote function. Remote function calculates the sum and returns the result to the called function.

I felt this xmlrpc library as the most awesome mechanism provided by the python. It makes the programming to the very simplest extent so that the users can give maximum attention to developing logic, instead of worrying about the networking constraints and errors related to it...



 
Read rest of entry

08 November, 2010

C program in UNIX to for TCP communication through sockets

Here is a C program in  Unix that introduces the basics of tcp communication by creating sockets. Here the cleint program and server programs communicates by passing messages to the sockets. 

Inorder to run this program store each program in  separate C files and compile it. Inorder to make it working run the programs simultaneosly in two terminals. 

tcp client program
/*program to create tcp client*/
#include<stdio.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<string.h>
#include<unistd.h>
#include<netinet/in.h>
#include<stdlib.h>
#include<sys/ipc.h>
#include<limits.h>
#include<fcntl.h>
#include<sys/shm.h>
main()
{
    int fd1,sid,f2,f3,f4,f1;
    char msg1[25],msg2[25];
   
    struct sockaddr_in client,server;
    client.sin_family=AF_INET;
    client.sin_port=htons(0);
    client.sin_addr.s_addr=htonl(INADDR_ANY);
    server.sin_family=AF_INET;
    server.sin_port=htons(1235); //please change this number while copying....
    server.sin_addr.s_addr=htonl(INADDR_ANY);
    sid=socket(AF_INET,SOCK_STREAM,0);
    if(sid<0)
        printf("socket not created\n");//please change this number while copying....
    else
    {
        printf("socket created\n");
        f1=bind(sid,(struct sockaddr*)&client,sizeof(struct sockaddr_in));
        if(f1==-1)
            printf("socket not bind\n");
        else
        {
            printf("socket binded\n");           
            f2=connect(sid,(struct sockaddr*)&server,sizeof(struct sockaddr_in));
            if(f2==-1)
                printf("connection request not send\n");
            else
            {               
                printf("\n\nconnection established\n\n");
                printf("Enter msg\n");
                scanf("%s",msg1);
                send(sid,msg1,sizeof(msg1),0);
                printf("msg send\n");
                recv(sid,msg2,sizeof(msg2),0);
                printf("received\n");
                printf("msg received is:%s\n",msg2);
            }
        }
    }
}







tcp server program

/*program to create tcp server*/
#include<stdio.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<stdlib.h>
#include<arpa/inet.h>
#include<string.h>
#include<unistd.h>
#include<netinet/in.h>
int main()
{
    int sid,f1,f2,f3,f4,f5,p;
    char msg1[25],msg2[25];
    struct sockaddr_in client,server;
    server.sin_family=AF_INET;
    server.sin_port=htons(1235);  //please change this number while copying....
    server.sin_addr.s_addr=htonl(INADDR_ANY);
    sid=socket(AF_INET,SOCK_STREAM,0);
    if(sid<0)
        printf("socket not created\n");
    else
    {
        printf("socket created\n");
        f1=bind(sid,(struct sockaddr*)&server,sizeof(struct sockaddr_in));
        if(f1<0)
            printf("socket not bind\n");
        else
        {
            printf("socket bind\n");
            f2=listen(sid,5);
            p=sizeof(struct sockaddr_in);
            f3=accept(sid,(struct sockaddr*)&client,&p);
            if(f3<0)
                printf("connection not accepted\n");
            else
            {
                printf("connection accepted\n");
                recv(f3,msg1,sizeof(msg1),0);
                printf("Message recieved from client:%s\n",msg1);
                printf("Enter the msg\n");
                scanf("%s",msg2);
                f5=send(f3,msg2,sizeof(msg2),0);
                printf("Message send\n");
            }
        }
    }
    return 1;
}
Read rest of entry

05 October, 2010

Copying Remote Files with scp



To use scp to transfer files, the SSH service (usually the sshd server daemon) must be running on the remote system. Here are some examples of useful scp commands:






$ scp myfile francois@server1:/tmp/ 
Password: ******
Above code copies myfile to server1


$ scp server1:/tmp/myfile 
Password: ******
Copy remote myfile to local working directory. Use the -p option to preserve permissions and timestamps on the copied files:

$ scp -p myfile server1:/tmp/If the SSH service is configured to listen on a port other than the default port 22, use -P to indicate that port on the scp command line:

$ scp -P 12345 myfile server1:/tmp/
 
Connect to a particular port.To do recursive copies, from a particular point in the remote file system, use the -r option:

$ scp -r mydir francois@server1:/tmp/ 
Copies all mydir to remote /tmp .Although scp is most useful when you know the exact locations of the file(s) youneed to copy, sometimes it’s more helpful to browse and transfer files interactively.

Read rest of entry

25 September, 2010

How to assign an IP address in Ubuntu using command line

Computers may be assiged a static IP address or assigned one dynamically. Typically servers and institutions will use a static IP which will not change each time u get connected. Workstation will use Dynamic Host Configuration Protocol (DHCP) for IP address assignment. It is more easily to find a system if the IP address does not change and is static.


Use the Command Line:

    /sbin/ifconfig eth0 192.168.10.12 netmask 255.255.255.0 broadcast 192.168.10.255                  
 
The ifconfig command does NOT store this information permanently. Upon reboot this information is lost. Manually add the network configuration to /etc/network/interfaces  as shown in my next post .
Read rest of entry

IP Configuration in Ubuntu

Here is a howto about the configuring ip using networking related files in Ubuntu / Debian systems.

File: /etc/network/interfaces
    This file contains network interface configuration information  for the ifup and ifdown commands. This is where you configure how your system is connected to the network.

Three important Interfaces are:
        # lo: Loopback interface (it is an internal 
            networking mechanism. It is used to
            test applications...)
        # eth0: First ethernet interface card
        # wlan0: First wireless network interface


Use following command to edit the interfaces file

$ sudo gedit /etc/network/interfaces

Add one or more of the stanzas below 

    Static IP example:
    auto lo
    iface lo inet loopback

    auto eth0
    iface eth0 inet static
            address 208.88.34.106
            netmask 255.255.255.248
            broadcast 208.88.34.111
            network 208.88.34.104
            gateway 208.88.34.110
                   

    Dynamic IP (DHCP) example:
    auto lo
    iface lo inet loopback

    auto eth0
    iface eth0 inet dhcp

    auto eth1
    iface eth1 inet dhcp

    auto eth2
    iface eth2 inet dhcp

    auto ath0
    iface ath0 inet dhcp

    auto wlan0
    iface wlan0 inet dhcp
                   
    Lines  beginning with the word "auto" in the interfaces file are used to identify the physical interfaces to be brought up when ifup is run with the -a option.  (This option  is  used by the system boot scripts.)  Physical interface names should follow the word "auto" on the same line.

GUI Network Tools:

    * NetworkManager or wicd can be used as the GUI tools for the network management. Better use wicd network manager if you have to rely more upon the wireless internet than the wired ones
.
Read rest of entry

04 September, 2010

Links: the browser for the terminal


Links is powerful text WWW browser with tables and frames. It runs in linux terminal providing a faster access to internet especially on slow connection. Its completely text based, so that you cant use it  as a complete replacement for usual browsers since terminal can not display images. Also since text based it can be a used for faster acces of internet when you are using mobile internet. 

 








Installing links in Ubuntu

Take the terminal and type in as follows

 $ sudo apt-get install links 

Or you can download the links package with graphics in compressed format from here. The details about installation are provided in the links site.
 
Browsing in links 

After installation take the terminal and type links

 $ links
 
command line options
-g 
            to run links in graphics mode
-no-g
            to run links in text mode

-anonymous
            Restrict links so that it can run on an anonymous  account.   No local  file  browsing.  No  downloads.  

 
-http-proxy <host:port>
              Host and port number of the HTTP  proxy,  or  blank.


-ftp-proxy <host:port>              
              Host  and  port  number  of  the FTP proxy, or blank. 

-download-dir <path>              
              Default download directory.  (default: actual dir) 


Navigation keys

ESC/F9    menu/escape
d      download link (text mode only)
/       search in the page
?       search back in the page
n       find next match
f        zoom actual frame
^R    reload page
g       go to URL
G       edit the current URL and goto the result
s       bookmark manager
q       quit, close window if more windows are open
=      document informations
\       toggle HTML source/rendered view
 
Setting proxy in links

Select Network Options from the setup menu(Click on F9 to get the menu).
 
Select Proxies to input the proxy address.







 
 

Read rest of entry

29 April, 2010

How to add Network Monitor applet to your taskbar in Ubuntu

                        Netspeed applet is a network monitor applet that describes your network traffic by showing the uplink and downlink rate graphically... Its simply helps you to identify weather there is network traffic or not instead of refereshing your browser frequently..

The figure below shows the Netspeed applet




Adding Netspeed applet to your panel

Right click on the panel on the top of your desktop.  Select the Add to panel option. Look out for the Netwok monitor entry in the list and click on the  add button as shown in the figure below. Now if you are connected to a network or internet the applet will start showing the downlink/uplink rate.








Read rest of entry

26 April, 2010

Make your keyboard blinking to represent network traffic using tleds in Ubuntu

tleds is debian based appliation that is used to indicate the netwotk traffic using your keyboard LEDs. As you know the led lights in the keyboard for indicating scroll lock, numlock have no other purpose other than just glowing to indicate this features are active. These remain off during most of the time.

So let's use these LED's to indicate the network traffic of your system. You can make them blinking when you send/recieve packets into network or internet.
This can be done by just downloading a small package called tleds.

Installing tleds


Take the terminal and type in as follows

    sudo apt-get install tleds

configuring

You have to show,  for which connection these LEDs should blink. You will issue the command ifconfig in the terminal to see the name of active connection. The commandline is
   
        sudo tleds wlan0   -- represents the wireless connection

        sudo tleds ppp0     -- represents the point to point connection (eth0,    
                                                                                 mobile broadband )

also you can issue command below for further control

        sudo tleds ppp0 -d 100
100 represents the delay between the blinking in microseconds. This delay represents the blinking speed. You can also issue command like this.  Here the default delay 200ms will be used.

That's all. Take your browser and search for something... See the lights in your keyboard blinking..
   
       
Read rest of entry
 

Terminal Diary | techblog Copyright © 2009 Gadget Blog is Designed by jintu jacob Powered by Blogger