Saturday, 30 August 2014

GENERAL:String

//============================================================================
// Name        : pi.cpp
// Author      : Rohit More
//============================================================================

#include <iostream>
#include <string.h>
using namespace std;

int main()
{

    char * string2="C++ Programming With Parazhar";

    int n = strlen(string2);
    for(int i=1;i<n;i++)
    {
        cout.write(string2,i);
        cout<<"\n";
    }
    for(int i=n;i>n;i++)
    {
        cout.write(string2,i);
        cout<<"\n";
    }
    cout.write(string2,n);
    cout<<"\n";


    return 0;
}
/*
 * OUTPUT
 C
C+
C++
C++
C++ P
C++ Pr
C++ Pro
C++ Prog
C++ Progr
C++ Progra
C++ Program
C++ Programm
C++ Programmi
C++ Programmin
C++ Programming
C++ Programming
C++ Programming W
C++ Programming Wi
C++ Programming Wit
C++ Programming With
C++ Programming With
C++ Programming With P
C++ Programming With Pa
C++ Programming With Par
C++ Programming With Para
C++ Programming With Paraz
C++ Programming With Parazh
C++ Programming With Parazha
C++ Programming With Parazhar

 */

GENERAL:Value of PI

//============================================================================
// Name        : pi.cpp
// Author      : Rohit More
//============================================================================

#include <iostream>
using namespace std;

int main()
{
    float pi=22.0/7.0;
    int i;
    cout<<"Val of pi:";

    for(i=1;i<20;i++)
    {
        cout.width(i+1);
        cout.precision(i);
        cout<<pi<<"\n";
    }
    return 0;
}
/*
 * OUTPUT
 * Val of pi: 3
3.1
3.14
3.143
3.1429
3.14286
3.142857
3.1428571
3.14285707
3.142857075
3.1428570747
3.14285707474
3.142857074738
3.1428570747375
3.14285707473755
3.142857074737549
3.1428570747375488
3.14285707473754883
3.142857074737548828
 *
 */

Monday, 25 August 2014

DSPS: paper boy (dfs traversal_graph)

//============================================================================
// Name        : newpaper_boy.cpp
// Author      : Parashar
// Version     :
// Copyright   : Do not try this at home
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
#define True 1
#define False 0
#define size 10

class graph
{
public:
    int n,e;
    int g[size][size],q[size];
    int front,rear;
    int visit[size];
int dist;
public:
    graph();
    void create();
    void dfs(int);
    void visited();

};

graph::graph()
{
    front=rear=-1;
    for(int v1=0;v1<size;v1++)
    {
        for(int v2=0;v2<size;v2++)
        {
            g[v1][v2]=g[v2][v1]=False;
        }
    }
}
    void graph::visited()
{
    for(int i=0;i<size;i++)
        visit[i]=False;

    dist=0;
}


void graph::create()
{
    int v1,v2,dist;
    cout<<"\nEnter the number of lanes:";
    cin>>n;
    cout<<"\nEnter Total number of paths leading to lanes:";
    cin>>e;

    for(int i=0;i<e;i++)
      {
        cout<<"\nEnter the lane a and b:";
        cin>>v1>>v2;
        cout<<"\nEnter the distance between the lane's entered: ";
        cin>>dist;
        g[v1][v2]=g[v2][v1]=dist;
      }


    cout<<"\n The Entered Graph is  "<<endl;
    for(int v1=0;v1<n;v1++)
        {
        cout<<"| ";
            for(int v2=0;v2<n;v2++)
            {
                cout<<g[v1][v2]<<"  ";
            }
            cout<<"|";
        cout<<endl;
        }
}

void graph::dfs(int v1)
{
    int v2;
    visit[v1]=True;
 cout<<v1<<" ";
 for(v2=0;v2<n;v2++)
 {
     if(g[v1][v2]!=false && visit[v2]==false)
     {
         dist=dist+g[v1][v2];
         dfs(v2);
     }
 }
}


int main()
{
     graph obj;
      int lane=0;
      int path,small=999;
      obj.create();
      cout<<endl<<"The newspaper boy has following paths to distribute newspaper : "<<endl;
      while(lane<obj.n)
       {
        obj.visited();
        cout<<"The way from lane "<<lane<<" is ";
        obj.dfs(lane);
        cout<<" And  the total path length "<<obj.dist;
        cout<<endl;
        if(obj.dist<small)
         {
          small=obj.dist;
          path=lane;
         }
       lane++;
      }

      cout<<endl<<"The Newspaper boy should start distributing newspaper from lane "<<path;
      cout<<"  which has least distance of "<<small;
      return 0;
}

DELD: 8:1 mux (IC 74151)

http://ecelab.xigega.com/pin-outs/74151.jpg 


Earthquake

reference-wikipedia

The following table lists the approximate energy equivalents in terms of TNT explosive force – though note that the earthquake energy is released underground rather than overground.[19] Most energy from an earthquake is not transmitted to and through the surface; instead, it dissipates into the crust and other subsurface structures. In contrast, a small atomic bomb blast (see nuclear weapon yield) will not, it will simply cause light shaking of indoor items, since its energy is released above ground.
31.6227 to the power of 0 equals 1, 31.6227 to the power of 1 equals 31.6227 and 31.6227 to the power of 2 equals 1000. Therefore, an 8.0 on the Richter scale releases 31.6227 times more energy than a 7.0 and a 9.0 on the Richter scale releases 1000 times more energy than a 7.0. Thus, E \approx 6.3\times 10^4\times 10^{3M/2}\,
Approximate Magnitude Approximate TNT for
Seismic Energy Yield
Joule equivalent Example
-0.2 7.5 g 31.5 kJ Energy released by lighting 30 typical matches
0.0 15 g 63 kJ
0.2 30 g 130 kJ Large hand grenade
0.5 85 g 360 kJ
1.0 480 g 2.0 MJ
1.2 1.1 kg 4.9 MJ Single stick of dynamite [DynoMax Pro]
1.4 2.2 kg 9.8 MJ Seismic impact of typical small construction blast
1.5 2.7 kg 11 MJ
2.0 15 kg 63 MJ
2.1 21 kg 89 MJ West fertilizer plant explosion[20]
2.5 85 kg 360 MJ
3.0 480 kg 2.0 GJ Oklahoma City bombing, 1995
3.5 2.7 metric tons 11 GJ PEPCON fuel plant explosion, Henderson, Nevada, 1988 Dallas, Texas earthquake, September 30, 2012
3.87 9.5 metric tons 40 GJ Explosion at Chernobyl nuclear power plant, 1986
3.91 11 metric tons 46 GJ Massive Ordnance Air Blast bomb St. Patrick's Day earthquake, Auckland, New Zealand, 2013 [21][22]
4.0 15 metric tons 63 GJ Johannesburg/South Africa, November 18, 2013
4.3 43 metric tons 180 GJ Kent Earthquake (Britain), 2007 Eastern Kentucky earthquake, November 2012
5.0 480 metric tons 2.0 TJ Lincolnshire earthquake (UK), 2008
M_\text{w} Ontario-Quebec earthquake (Canada), 2010[23][24]
5.5 2.7 kilotons 11 TJ Little Skull Mtn. earthquake (Nevada, USA), 1992
M_\text{w} Alum Rock earthquake (California), 2007
M_\text{w} Chino Hills earthquake (Southern California), 2008
5.6 3.8 kilotons 16 TJ Newcastle, Australia, 1989
Oklahoma, 2011
Pernik, Bulgaria, 2012
6.0 15 kilotons 63 TJ Double Spring Flat earthquake (Nevada, USA), 1994 Approximate magnitude of Virginia/Washington, D.C./East Coast earthquake, 2011
Approximate yield of the Little Boy Atomic Bomb dropped on Hiroshima (~16 kt)
South Napa Earthquake, 2014
6.3 43 kilotons 180 TJ M_\text{w} Rhodes earthquake (Greece), 2008
Jericho earthquake (British Palestine), 1927
Christchurch earthquake (New Zealand), 2011
6.4 60 kilotons 250 TJ Kaohsiung earthquake (Taiwan), 2010 Vancouver earthquake (Canada), 2011
6.5 85 kilotons 360 TJ M_\text{s} Caracas earthquake (Venezuela), 1967
Irpinia earthquake (Italy), 1980
M_\text{w} Eureka earthquake (California, USA), 2010
Zumpango del Rio earthquake (Guerrero, Mexico), 2011[25]
6.6 120 kilotons 500 TJ M_\text{w} San Fernando earthquake (California, USA), 1971
6.7 170 kilotons 710 TJ M_\text{w} Northridge earthquake (California, USA), 1994
6.8 240 kilotons 1.0 PJ M_\text{w} Nisqually earthquake (Anderson Island, WA), 2001
M_\text{w} Great Hanshin earthquake (Kobe, Japan), 1995
Gisborne earthquake (Gisborne, NZ), 2007
6.9 340 kilotons 1.4 PJ M_\text{w} San Francisco Bay Area earthquake (California, USA), 1989
M_\text{w} Pichilemu earthquake (Chile), 2010
M_\text{w} Sikkim earthquake (Nepal-India Border), 2011
7.0 480 kilotons 2.0 PJ M_\text{w} Java earthquake (Indonesia), 2009
M_\text{w} Haiti earthquake, 2010
7.1 680 kilotons 2.8 PJ M_\text{w} Messina earthquake (Italy), 1908
M_\text{w} San Juan earthquake (Argentina), 1944
M_\text{w} Canterbury earthquake (New Zealand), 2010
7.2 950 kilotons 4.0 PJ Vrancea earthquake (Romania), 1977
M_\text{w} 1980 Azores Islands Earthquake
M_\text{w} Baja California earthquake (Mexico), 2010
7.5 2.7 megatons 11 PJ M_\text{w} Kashmir earthquake (Pakistan), 2005
M_\text{w} Antofagasta earthquake (Chile), 2007
7.6 3.8 megatons 16 PJ M_\text{w} Nicoya earthquake (Costa Rica), 2012
M_\text{w} Oaxaca earthquake (Mexico), 2012
M_\text{w} Gujarat earthquake (India), 2001
M_\text{w} İzmit earthquake (Turkey), 1999
M_\text{w} Jiji earthquake (Taiwan), 1999
7.7 5.4 megatons 22 PJ M_\text{w} Sumatra earthquake (Indonesia), 2010
M_\text{w} Haida Gwaii earthquake (Canada), 2012
7.8 7.6 megatons 32 PJ M_\text{w} Tangshan earthquake (China), 1976
M_\text{s} Hawke's Bay earthquake (New Zealand), 1931
M_\text{s} Luzon earthquake (Philippines), 1990
7.9 10-15 megatons 42-63 PJ Tunguska event
1802 Vrancea earthquake
M_\text{w} Great Kanto earthquake (Japan), 1923
8.0 15 megatons 63 PJ M_\text{s} Mino-Owari earthquake (Japan), 1891
San Juan earthquake (Argentina), 1894
San Francisco earthquake (California, USA), 1906
M_\text{s} Queen Charlotte Islands earthquake (B.C., Canada), 1949
M_\text{w} Chincha Alta earthquake (Peru), 2007
M_\text{s} Sichuan earthquake (China), 2008
Kangra earthquake, 1905
8.1 21 megatons 89 PJ México City earthquake (Mexico), 1985
Guam earthquake, August 8, 1993[26]
8.35 50 megatons 210 PJ Tsar Bomba - Largest thermonuclear weapon ever tested. Most of the energy was dissipated in the atmosphere. The seismic shock was estimated at 5.0-5.2[27]
8.5 85 megatons 360 PJ M_\text{w} Sumatra earthquake (Indonesia), 2007
8.6 120 megatons 500 PJ M_\text{w} Sumatra earthquake (Indonesia), 2012
8.7 170 megatons 710 PJ M_\text{w} Sumatra earthquake (Indonesia), 2005
8.75 200 megatons 840 PJ Krakatoa 1883
8.8 240 megatons 1.0 EJ M_\text{w} Chile earthquake, 2010,
9.0 480 megatons 2.0 EJ M_\text{w} Lisbon earthquake (Portugal), All Saints Day, 1755
M_\text{w} The Great Japan earthquake, March 2011
9.15 800 megatons 3.3 EJ Toba eruption 75,000 years ago; among the largest known volcanic events.[28]
9.2 950 megatons 4.0 EJ M_\text{w} Anchorage earthquake (Alaska, USA), 1964
M_\text{w} Sumatra-Andaman earthquake and tsunami (Indonesia), 2004
9.5 2.7 gigatons 11 EJ M_\text{w} Valdivia earthquake (Chile), 1960
13.00 100 teratons 420 ZJ Yucatán Peninsula impact (creating Chicxulub crater) 65 Ma ago (108 megatons; over 4x1029 ergs = 400 ZJ).[29][30][31][32][33]
22.88 or 32 310 yottatons 1.3×1039 J Approximate magnitude of the starquake on the magnetar SGR 1806-20, registered on December 27, 2004.[clarification needed]

Friday, 22 August 2014

OSA:System information c++

#include <iostream>
#include <sys/utsname.h>

using namespace std;

int main(){
struct utsname sysinfo;
uname(&sysinfo);
cout << "System Name: "<<sysinfo.sysname<<endl;
cout << "Host Name: "<<sysinfo.nodename<<endl;
cout << "Release(Kernel) Version: "<<sysinfo.release<<endl;
cout << "Kernel Build Timestamp: "<<sysinfo.version<<endl;
cout << "Machine Arch: "<<sysinfo.machine<<endl;
cout << "Domain Name: "<<sysinfo.domainname<<endl;
return 0;
}

OSA: System info shell program

while(true)
do
echo "CPU INFORMATION
      1.CPU CORES AND THREADS
      2.CPU MANUFACTURER
      3.PROCESSOR FAMILY
      4.PROCESSOR VERSION
      5.PROCESSOR FREQUENCY
      6.SYSTEM MANUFACTURER
      7.BIOS VERSION
      8.RAM INFO 
      9.EXIT"
read a;
case $a in
1)echo "CPU INFORMATION.."
dmidecode -t processor
;;
2)echo "CPU MANUFACTURER.."
dmidecode -s processor-manufacturer   
;;
3)echo "PROCESSOR FAMILY.."
dmidecode -s processor-family
;;
4)echo "PROCESSOR VERSION.."
dmidecode -s processor-version   
;;
5)echo "PROCESSOR FREQUENCY.."
dmidecode -s  processor-frequency   
;;
6)echo "SYSTEM MANUFACTURER.."
dmidecode -s  system-manufacturer
;;
7)echo "BIOS VERSION.."
dmidecode -s bios-version

;;
8)echo "RAM INFO.."
dmidecode -t memory
;;
9)echo "stopped...."
  exit 0
;;
esac;
done




how to execute:
1.copy code and paste in gedit
2.save it with filename.sh extension
3.open terminal
4.type   sh filename.sh

DSPS: Revised version of GRAPHS (BFS)

#include<iostream>
using namespace std;
#define size 10
#define true 1
#define false 0
class graph
{
public:
    int g[size][size];
    int visit[size],rear,front,q[size];
    int n,e;
public:
    graph();
    void getmatrix();
    void displaygraph();
    void bfs(int);
};

graph::graph()
{
 for(int i=0;i<size;i++)
     {
         for(int j=0;j<size;j++)
         {
             g[i][j]=false;
         }
     }
 for(int i=0;i<size;i++)
     {
     visit[i]=false;
     }

}
void graph::getmatrix()
{

    int v1,v2;
    cout<<"Enter no. of nodes:";
    cin>>n;
    cout<<"Enter no. of edges:";
    cin>>e;
    for(int i=0;i<e;i++)
    {
        cout<<"Enter edge in the form of V1 and V2:";
        cin>>v1>>v2;
        g[v1][v2]=g[v2][v1]=true;
    }

    cout<<"Entered Graph is"<<endl;
    for(int k=0;k<n;k++)
         {
        cout<<"|";
             for(int l=0;l<n;l++)
             {
                 cout<<g[k][l]<<"\t";

             }
             cout<<"|";
             cout<<endl;
           
         }
}
void graph::bfs(int v1)
{
    int v2;
    front=rear=-1;
    visit[v1]=true;
    q[++rear]=v1;

    while(front!=rear)
    {
     v1=q[++front];
     cout<<v1<<" ";
     for(v2=0;v2<n;v2++)
      {
        if(g[v1][v2]==true && visit[v2]==false)
        {
        q[++rear]=v2;
        visit[v2]=true;
        }
    }
   }
}



int main()
{
    graph g;
    int v;
    g.getmatrix();
    cout<<"enter the starting vertex for BFS traversal";
    cin>>v;
    cout<<"The BFS tarversal is:";
    g.bfs(v);
    return 0;
}

Wednesday, 13 August 2014

Top 10 OS for hacking

1. BackTrack 5r3: This is one of the most loved and best known Linux-based hacking distributions. Based on Canonical’s Ubuntu operating system, Backtrack’s logo says, “The quieter you become, the more you are able to hear.” With version 5, the GNOME desktop environment was added along with the usual KDE desktop environment.

2. Nodezero: This is another Ubuntu-based hacking, which is used for penetration testing. Every time you get a patch for bugs in the Ubuntu OS, Nodezero also gets updated.

3. BackBox Linux: This is yet another Ubuntu-based distro being used for hacking. According to the developers, the OS has been designed to create a penetration testing distro that is fast and easy to use. It also gets update with new ethical hacking tools regularly using repositories.

4. Blackbuntu: Ubuntu itself may not be a hacking distro, but there are plenty that are based on it. This distribution comes with categories such as Network Mapping, Information Gathering, Penetration, Vulnerability Identification, Privilege Escalation, Radio Network Analysis, VoIP analysis and more.

5. Samurai Web Testing Framework: This distro lays focus on attacking websites using the best free and open source tools for hacking and attacking. The developers have incorporated four steps into the distribution, including, reconnaissance, mapping, discovery and exploitation.

6. Knoppix STD: From Ubuntu to Debian, Knoppix STD is a Debian based hacking distribution that runs the GNOME, KDE, LXDE and Openbox desktop environments. It has been around for quite a long time now and was amongst the first live distros.

7. Pentoo: This is a live CD that is meant for security testing and is based on Gentoo. It comes with a number of customised tools and kernel from the company. These include a Backported WiFi stack, XFCE4 etc.

8. Weakerthan: This distribution uses the Flufbox desktop environment and is best suited for WiFi hacking because of its many Wireless tools. It is a Debian Squeeze-based distribution that comes with tools for WiFi attacks, Cisco exploitation, SQL Hacking, Web Hacking, Bluetooth and others.

9. Matriux Krypton: After Weakerth4n, this is perhaps the first distribution that is directly based on the Debian OS. It contains an arsenal of 300 security tools and makes for a good choice for ethical hacking, penetration testing, security testing, system and network administration, cyber forensics investigations etc.

10. DEFT: This OS is based on the Linux Kernel 3 along with the Digital Advanced Response Toolkit. It uses WINE in order to run Windows tools Linux and predominantly run with the LXDE desktop environment.

Oracle Exadata Database Machine X4-8

Oracle Exadata Database Machine X4-8 


Oracle Exadata Database Machine X4-8 has the same extreme performance, storage, and InfiniBand as Oracle Exadata X4-2, but uses large-scale 8-socket SMP servers instead of the 2-socket servers in Oracle Exadata X4-2. Each of the 8-socket servers in Oracle Exadata X4-8 has 120 processor cores, and 2 to 6 terabytes of DRAM.
Oracle Exadata X4-8 is especially well suited for high-end OLTP workloads, in-memory or memory-intensive workloads, large-scale database consolidations, including DBaaS, and multi-rack data warehouses. A single-rack Oracle Exadata X4-8 has up to 12 TB of system memory 672 terabytes of disk, 44 terabytes of high-performance PCI Flash, 240 database CPU cores, and 168 CPU cores in storage to accelerate data-intensive SQL. Oracle Exadata X4-8 supports all Oracle Exadata software optimizations, including Smart Flash cache, Smart Flash compression, hybrid columnar compression, and InfiniBand messaging.



Oracle Exadata Storage Expansion Rack X4-2 

Oracle Exadata Storage Expansion Rack enables you to grow the Exadata storage capacity and bandwidth of Exadata Database Machine X4-8 and X4-2 and Oracle SPARC SuperCluster. It is designed for database deployments that require very large amounts of data, including historical or archive data; backups and archives of Oracle Exadata Database Machine data; documents, images, file, and XML data; LOB’s, and other large, unstructured data.