Monday, July 9, 2012

Are you safe against DNSChanger ?

By now you have probably heard about DNSChanger, a piece maleware in the wild. Here is a bit of information about it.

How it works ?

DNS (Domain Name System) is an Internet service that converts user-friendly domain names into the numerical Internet protocol (IP) addresses that computers use to talk to each other. When you enter a domain name like www.xyz.com in your browser address bar, your system contacts DNS servers to get the IP address for that website. Your system then uses that IP to locate and connect to website. Generally DNS servers are operated by your Internet Service Providers ( (ISP) and are included in your system's network configuration.You can think of like a phone book, you search for the name you want and DNS gives the corresponding no. If your system is infected with DNSChanger then there is also a possibility of other malewares also.

What does DNSChanger do in system ? 

DNSChanger does what the name itself describes. DNSChanger malware causes a computer to use rogue DNS servers in one of two ways. First, it changes the computer’s DNS server settings to replace the ISP’s good DNS servers with rogue DNS servers operated by the criminal. Second, it attempts to access devices on the victim’s small network that run a dynamic host configuration protocol (DHCP) server (eg. a router or home gateway).The malware attempts to access these devices using common default usernames and passwords and, if successful, changes the DNS servers these devices use from the ISP’s good DNS servers to rogue DNS servers operated by the criminals. This is a change that may impact all computers on the network, even if those computers are not infected with the malware.

How can I detect infection on my system ?

Following are the steps to check the infection on Windows systems.

1. Go to Start menu. Click on Run option or press Windows + R.
















2. Write cmd in the box and press Ok


3. Type on command prompt : ipconfig /all. It will list all the network interfaces configured on your system
Check the DNS Servers line in all the entries. 


4. Compare whether any of listed entries has DNS servers listed in the number ranges given at the end of the blog.

If your computer is configured to use one or more of the rogue DNS servers, it may be infected with DNSChanger malware.
 
Following are the steps to check the infection on Mac OSX systems.

1. Click on the Apple in the top left corner and choose System Preferences. Then, from the Apple System Preferences window, choose Network.

2. The Apple Network pane will show a number of possible connections on the left side. Choose the one that is active for you and click on the Advanced button in the right lower corner. Then choose DNS from the options to show the DNS servers you are using.


3. Compare whether any of listed entries has DNS servers listed in the number ranges given at the end of the blog.

If your computer is configured to use one or more of the rogue DNS servers, it may be infected with DNSChanger malware. 


How to compare ?

To make the comparison between the computer’s DNS servers and this table easier, start by comparing the first number before the first dot. For example, if your DNS servers do not start with 85, 67, 93, 77, 213, or 64, you can move on to the next step. If your servers start with any of those numbers, continue the comparison.

List of rough DNS Servers

1. 85.255.112.0 through 85.255.127.255
2. 67.210.0.0 through 67.210.15.255
3. 93.188.160.0 through 93.188.167.255
4. 77.67.83.0 through 77.67.83.255
5. 213.109.64.0 through 213.109.79.255
6. 64.28.176.0 through 64.28.191.255





 

Friday, February 3, 2012

A beginner's guide for development and installlation of OpenERP modules

OpenERP  AT  A GLANCE :-


  • OpenERP (previously known as TinyERP) is a comprehensive suit of business applications similar to SAP and Microsoft Dynamics for small and medium enterprises. It is completely cutomizable,platform-independent and an open-source system completely developed using open-source technologies like Python, Postgresql and pyGTK. It follows a modular approach called Model-View-Controler. It is developed by Belgium based software development firm called OpenERP SA. Most of it's code is released under AGPL license so there is no fees involved in use of the software. OpenERP follows a modular approach as described below.


  • What Is Module ?

Module is an independent and self-contained unit of any system. OpenERP modules are written in Python. The usage of module in OpenERP will extend the functionality of OpenERP. It uses OpenERP ORM to persist it’s data in a relational database called Postgresql. Modules are simple way to structure a complex application. One can add his own module in his OpenERP system or customize any existing module. Modules could also be known as plug-ins. Our demo module is called Student_info. This module provides an interface to collect following information about students.
  • Name
  • Age
  • Gender
  • Percentage
  • Details
  • Active

It also displays list of student information in tabular format. You can search student by name, gender and age.

Following are the standard Applications available in OpenERP.

  • CRM
  • Sales and Distribution
  • Accounting
  • Marketing
  • Human Resource
  • Purchase
  • Manufacturing
  • Project Management
  • Point of Sale
  • Warehouse Management
  • Invoicing
  • Payroll

Apart from modules given above, there are around 700+ modules available for use.



  • Following are steps to install module in OpenERP :

For sake of simplicity here we will use module name “Student_info

  • Copy your module directory into addons directory located under your Openerp directory
  • Launch an OpenERP server using following command:
python openerp-server.py --addons=<path of your addons directory>

Here in above command openerp-server.py file is located at <your-openerp- directory>/server/bin/ directory. You also have to supply path of addons directory which is generally located right under your openerp directory.

If you see the message like “OpenERP server is running, waiting for connections...”. you have successfully started the server, Bingo!

  • After starting server, start your either GTK client using following command:
python openerp-client.py

Here in above command openerp-client.py is located at <your-openerp- directory>/client/bin/ directory. After launching the client successfully you will see following screen.




Our database is test_demo but you have to select your own database.
Enter correct username and password and click on OK button.


  1. After clicking on button you will see following screen. Here you will see“Administration” menu item. Click on it.


  1. After selecting Administration module expand “Module” items. 


    3   Select “Update Modules List”. As your module is not a part of the certified addons yet, you will need to update the repository which is identified by the OpenERP Server.






  1. Now you can see one wizard “Update Module List”. Click on “Update”. This process will update modules




  1. After updating module you need to add new module as well as updated module. So after updating modules one wizard will open as “Update Module List”. Click on “Open Modules”.




  1. Now you can see all modules are loaded in the module list.






    7.   You can search any module by Name, Description, Dependencies or State. Here      

         



  1. Now you can see the filtered results containing name “student” which is showing “Not installed”. Just click “Student_info” and go to Form View or just double click on that.



  1. Now you can see all the information about Student_info containing Name, Quality Certificate, Category, Information about Author and Dependencies. For installing “Student_info” click on “Schedule for Installation”.





  1. For applying updates click on “Apply scheduled Upgrades”.








  1. Now one wizard will open to start update “Student_info”. Click on “Start update”.








  1. Now next step is to start configuration after updating module. Click “Start configuration”.




  1. Click ctrl+R to reload the Modules. Now you can see the “Student” Module is loaded in Menu. Click on that.



    14.Now expand the tree of Student Management. Click on “Student Information”.





    15.   After Clicking Student Information you can see the List View in which all the     fields of Student will be shown and records of which are shown in list .



  1. You can create a New record by clicking “New”.



  1. After clicking new record you will take to another wizard i.e. a Form View in which u can edit, create a new record and save it.


  1. After clicking that you can see that Document is saved and it is showing in centre bottom that “Document Saved”.



  1. Now you can search any record by its Name, Gender or Age. Here we have searched a “abc” name and it is showing record name containing student name “abc”.



  1. Another example of search, we have searched by “Gender” and we can see record containing Gender “Female”.



Module structure of OpenERP module :

Module structure considers the following things : 

1. OpenERP addons (openobject-addons) OpenERP business modules : 
 

OpenERP addons host the functional business modules of openerp covering:
 accounting, sales, crm, purchases, warehouse, manufacturing, project, human resources,
 marketing, knowledge, point-of-sale, and much more.

  • Addons contain the list of modules. 
  • The modules : 
  • When you create any module there are minimum four files required. which are given below : 
            
   1. __init__.py 

    2. __openerp__.py 

   3. filename.py (Your model file ) 
   
   4. filename_view.xml :
  • Views
  • Actions
  • Menu entries
  • Report
  • Wizard     
   
  • Now we shall see how to create a module in OpenERP: 
      
     Step 1:   Create the __init__.py file in the new folder you have created for the module,
                  in the   addons directory. The  __init__.py file must have a line to import the main 
                  python(.py)  file you intend create for the module.Having the __init__.py file in your  
                  module makes the code a package.          
        
     Step 2:   Create a module description file (i.e __openerp__.py). The __openerp__.py 
                  file provides a description of the  module you want to create. 
  • It essentially contains a python dictionary. 
         Step 3:  Create your python file that contains objects (Infact thats your model) .
                 This file you have to import in your __init__.py file. 

    Step 4 :  Create your view.xml file 
                This XML file is a VIEW component of MVC architecture, which is responsible for the GUI.

  •  They are used for many purpose : 
  • Initialization and demonstration data declaration.
2. Views declaration :
  • Views are a way to represent the objects on the client-side. 
  • They indicate to the client how to layout the data coming from the objects on the screen. 
  • There are two basic types of view(there are more, but let's focus on basic ones):
  • Form view
  • Tree view  
    
    
    List view  is simply a particular case of tree view.
          
      
     3. Report declaration : 
  • OpenERP uses a flexible and powerful reporting system.
  • Reports are generated either in PDF or HTML format.
  • Reports are designed on the principle of separation between the data layer and presentation layer. 
    
    
      4. Wizard declaration :  
  • A wizard is declared using wizard tag.        
   

      5. Workflow declaration. 
  • The workflow describes these interaction with graphs.
    
  • One or several workflows may be associated with the objects.
    
  • Workflows are not mendatory.
  • Screen short of the module is given below : 



  In above figure you can see the list of modules in the addons. 


The four file described above are :

(1)__init__.py
(2)__openerp__.py
(3)Student_info.py
(4)Student_info_view.xml
Now we see content of these above file:


(1)__init_.py

This file contains the import statements for importing python(.py) files.
The screenshot of this file is shown below.




(2) __openerp__.py

This file contains the directory which gives introduction about module. In which there are various field described below.


Key

Value
name
It shows field contains the name of the module.
version
It shows the version of the module.
author
It shows author of the module.
website
It contains website of the author.
depends
It is a list of modules on which this module depends.
category
It shows the category of the module (i.e. sales,finance,etc.)
description
The detailed description about the module which describe the functionality of the module.
init_xml
It contains list of xml files which will get executed when the module gets installed.

update_xml
It contains list of xml files which will get executed when the module goes under update mode.
demo_xml
It is a file same as other xml files, but this one contains the demostration data of the models created in the module.
active
It describes that if this module is installed by default or not.
installable
It describes this module is installable or not.
certificate
The certificate no. Assigned by Editor, OpenERP SA.

The example of the __openerp__.py file is shown in the screenshot below.








(3)Student_info.py

It contains the class which is inherits osv class by importing osv and fields class from osv file. The class contains _name which contains name of table, _columns which contains fields of table and _defaults is to give default value.

    • _name:
It define the table name of module. If (.) is used then it will be replaced by (_) in table name.
    • _columns:
It contains fields of the table. Fields contains various data type which shown below.

Data type

Description
char
It stores character data. Size is necessary for this data type.
integer
It stores the Integer value.
boolean
It store Boolean value which contains True or False.
text
It stores large amount of character data without defining the size.
float
It stores the floating(decimal) value.
selection
It contains list of tuple to store data in list. Can be said as a combo-box.






The _columns field contains dictionary to store fields of table.






In above screenshot the _columns contains dictionary which contains various keys and values. Key describe fields of table and value describe data type, label name and constraints of the field.

Various constraints are shown below.


Constraint

Description

required
It is used for mandatory field. If value of required is True then it consider as mandatory field.
readonly
If value of read only is True then user can not modify in field.
translate
If value of translate is True then the field can be translated into installed language.

    • _defaults:
It is use for give default value in table's field. The example shown in below screenshot.







The _defaults variable contains the dictionary, in above screenshot the name field contains default value “Atul” and it is Active.
The student_student() calls the parent class osv.osv's constructor.


View the XML File


There are two type of architectures
A. Client-Server Architecture
B. MVC Architecture

As per MVC architecture there are Model,View, and Controller. So this is view of
the system.
For the view of the module a file is created which is formatted as XML.
There are three categories of XML file in module.
    1) View
    • Search View
    • Tree View
    • Form View
         This portion contains presentation of your module. As per the requirement,
there are three types of view.
  • Search View:






Search View used in module to provide the search panels in form , and from those fields user can search the data. It creates a customized search panel, and is declared quite similarly to a form view, except that the view type and root element change to search instead of form.

Here, in above example Name, Gender and Age fields are provided so by using these fields user can search the particular record.




  • Tree view








Tree view is also called a list view. We can specify columns which we want to add in the list with some details of list display.

In above example we can see the Student Name, Student Age, Student Percentage , Gender and Active Status.


  • Form view



Form view is used when the User wants to Edit or Add the information. The field disposition in a form view always follows the same principle.By default, each field is preceded by a label, with its name. In above example code displays the form view of module and fields like name,age,gender etc.




2) Action :





The action defines the behavior of the system in response to the action of the users. Action portion shows an action or behaviour of module. It shows the priority of the views. By this action we will open next view.
In above code you can see that when we open the module the default view of module is form view.


    3) Menu :

In OpenERP, this element represents a menu structure as shown in the screenshot. You would be able to reach the Forms of the model only by clicking on this menu and it will trigger an action you created in (2).
We hope this guide will help you sail well in the boat of learning OpenERP Module Development.
Wish you a good luck for your module.
Thanks,
Malhar Vora, Bipin Rathod, Vijay Rathod, Nishant Jogi, Kalpana Hemnani, Abhishek Mehta, Atul Makwana, Hitesh Panara.
Guided by: