Saturday, May 28, 2011

How to Install Python 3 in Linux

$ sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libbz2-dev libc6-dev libsqlite3-dev tk-dev g++ gcc
Step 2: Grab the bits, extract them and build them

$ wget http://www.python.org/ftp/python/3.0/Python-3.0.tgz
$ tar xvzf Python-3.0.tgz
$ cd Python-3.0/
$ ./configure
$ make
$ sudo make install

Python 3.0 (r30:67503, May 29 2011, 02:31:02)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Friday, April 29, 2011

Hacking Security Cameras Google Search Terms

inurl:ViewerFrame?Mode=
intitle:Axis 2400 video server
inurl:/view.shtml
intitle:Live View / - AXIS
inurl:view/view.shtml^
inurl:ViewerFrame?Mode=
inurl:ViewerFrame?Mode=Refresh
inurl:axis-cgi/jpg
inurl:axis-cgi/mjpg (motion-JPEG)
inurl:view/indexFrame.shtml
inurl:view/index.shtml
inurl:view/view.shtml
liveapplet
intitle:live view intitle:axis
intitle:liveapplet
allintitle:Network Camera NetworkCamera
intitle:axis intitle:video server
intitle:liveapplet inurl:LvAppl
intitle:EvoCam inurl:webcam.html
intitle:Live NetSnap Cam-Server feed
intitle:Live View / - AXIS
intitle:Live View / - AXIS 206M
intitle:Live View / - AXIS 206W
intitle:Live View / - AXIS 210?
inurl:indexFrame.shtml Axis
inurl:MultiCameraFrame?Mode=Motion
intitle:start inurl:cgistart
intitle:WJ-NT104 Main Page
intext:MOBOTIX M1? intext:Open Menu
intext:MOBOTIX M10? intext:Open Menu
intext:MOBOTIX D10? intext:Open Menu
intitle:snc-z20 inurl:home/
intitle:snc-cs3 inurl:home/
intitle:snc-rz30 inurl:home/
intitle:sony network camera snc-p1?
intitle:sony network camera snc-m1?
site:.viewnetcam.com -www.viewnetcam.com
intitle:Toshiba Network Camera user login
intitle:netcam live image
intitle:i-Catcher Console - Web Monitor
inurl:”ViewerFrame?Mode=
intitle:Axis 2400 video server
inurl:/view.shtml
intitle:”Live View / - AXIS” | inurl:view/view.shtml^
inurl:ViewerFrame?Mode=
inurl:ViewerFrame?Mode=Refresh
inurl:axis-cgi/jpg
inurl:axis-cgi/mjpg (motion-JPEG)
inurl:view/indexFrame.shtml
inurl:view/index.shtml
inurl:view/view.shtml
liveapplet
intitle:”live view” intitle:axis
intitle:liveapplet
allintitle:”Network Camera NetworkCamera”
intitle:axis intitle:”video server”
intitle:liveapplet inurl:LvAppl
intitle:”EvoCam” inurl:”webcam.html”
intitle:”Live NetSnap Cam-Server feed”
intitle:”Live View / - AXIS”
intitle:”Live View / - AXIS 206M”
intitle:”Live View / - AXIS 206W”
intitle:”Live View / - AXIS 210″
inurl:indexFrame.shtml Axis
inurl:”MultiCameraFrame?Mode=Motion”
intitle:start inurl:cgistart
intitle:”WJ-NT104 Main Page”
intext:”MOBOTIX M1″ intext:”Open Menu”
intext:”MOBOTIX M10″ intext:”Open Menu”
intext:”MOBOTIX D10″ intext:”Open Menu”
intitle:snc-z20 inurl:home/
intitle:snc-cs3 inurl:home/
intitle:snc-rz30 inurl:home/
intitle:”sony network camera snc-p1″
intitle:”sony network camera snc-m1″
site:.viewnetcam.com -www.viewnetcam.com
intitle:”Toshiba Network Camera” user login
intitle:”netcam live image”
intitle:”i-Catcher Console - Web Monitor”

Wednesday, March 30, 2011

Install Python from Source

localhost:~$ su −
Password: [enter your root password]
localhost:~# wget http://www.python.org/ftp/python/2.3/Python−2.3.tgz
Resolving www.python.org... done.
Connecting to www.python.org[194.109.137.226]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8,436,880 [application/x−tar]
...
localhost:~# tar xfz Python−2.3.tgz
localhost:~# cd Python−2.3
localhost:~/Python−2.3# ./configure
checking MACHDEP... linux2
checking EXTRAPLATDIR...
checking for −−without−gcc... no
...
localhost:~/Python−2.3# make
gcc −pthread −c −fno−strict−aliasing −DNDEBUG −g −O3 −Wall −Wstrict−prototypes
−I. −I./Include −DPy_BUILD_CORE −o Modules/python.o Modules/python.c
gcc −pthread −c −fno−strict−aliasing −DNDEBUG −g −O3 −Wall −Wstrict−prototypes
−I. −I./Include −DPy_BUILD_CORE −o Parser/acceler.o Parser/acceler.c
gcc −pthread −c −fno−strict−aliasing −DNDEBUG −g −O3 −Wall −Wstrict−prototypes
−I. −I./Include −DPy_BUILD_CORE −o Parser/grammar1.o Parser/grammar1.c
...
localhost:~/Python−2.3# make install
/usr/bin/install −c python /usr/local/bin/python2.3
...
localhost:~/Python−2.3# exit
logout
localhost:~$ which python
/usr/local/bin/python
localhost:~$ python
Python 2.3.1 (#2, Sep 24 2003, 11:39:14)
[GCC 3.3.2 20030908 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> [press Ctrl+D to get back to the command prompt]
localhost:~$

Sunday, March 27, 2011

Design pattern with Swing Actions

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JToolBar;

public class ActionSample extends JFrame {
 
 private Action sampleAction;
 private Action exitAction;
 
 public ActionSample(){
  super("Using Actions");
  
  sampleAction = new AbstractAction(){
   public void actionPerformed(ActionEvent event){
    JOptionPane.showMessageDialog(ActionSample.this, "The sampleAction was invoked!");
    
    exitAction.setEnabled(true);
   }
  };
  
  sampleAction.putValue(Action.NAME, "Sample Action");
  
  sampleAction.putValue(Action.SHORT_DESCRIPTION, "A Sample Action");
  
  sampleAction.putValue(Action.MNEMONIC_KEY, new Integer('s'));
  
  exitAction = new AbstractAction(){
   public void actionPerformed(ActionEvent event){
    JOptionPane.showMessageDialog(ActionSample.this, "The exitAction was invoked");
    
    System.exit(0);
   }
  };
 
  exitAction.putValue(Action.NAME, "Exit");
  
  exitAction.putValue(Action.SHORT_DESCRIPTION, "Exit Application");
  
  exitAction.putValue(Action.MNEMONIC_KEY, new Integer('x'));
  
  exitAction.setEnabled(false);
  
  JMenu fileMenu = new JMenu("File");
  
  fileMenu.add(sampleAction);
  fileMenu.add(exitAction);
  fileMenu.setMnemonic('F');
  
  JMenuBar menuBar = new JMenuBar();
  menuBar.add(fileMenu);
  setJMenuBar(menuBar);
  
  JToolBar toolBar = new JToolBar();
  
  toolBar.add(sampleAction);
  toolBar.add(exitAction);
  
  JButton sampleButton = new JButton();
  sampleButton.setAction(sampleAction);
  
  JButton exitButton = new JButton(exitAction);
  
  JPanel buttonPanel = new JPanel();
  
  buttonPanel.add(sampleButton);
  buttonPanel.add(exitButton);
  
  Container container = getContentPane();
  container.add(toolBar, BorderLayout.NORTH);
  container.add(buttonPanel, BorderLayout.CENTER);  
 }
 
 public static void main(String args[]){
  ActionSample sample  = new ActionSample();
  sample.setDefaultCloseOperation(EXIT_ON_CLOSE);
  sample.pack();
  sample.setVisible(true);
 }

}

Tuesday, March 22, 2011

Control mouse using the Robot Class

For these examples you will need to make sure you import the java.awt.Robot & java.awt.event.InputEvent classes.

Move the mouse cursor position on screen:


import java.awt.Robot;
 
public class MouseClass {
 
 public static void main(String[] args) throws Exception {
 
            Robot robot = new Robot();
 
            // SET THE MOUSE X Y POSITION
            robot.mouseMove(300, 550);
 
 }
}
--------------------------------------------------

Click the left mouse button:


import java.awt.Robot;
import java.awt.event.InputEvent;
 
public class MouseClass {
 
 public static void main(String[] args) throws Exception {
 
            Robot robot = new Robot();
 
            // LEFT CLICK
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
 }
}

--------------------------------------------------------------------------------

Click the right mouse button:

import java.awt.Robot;
import java.awt.event.InputEvent;
 
public class MouseClass {
 
 public static void main(String[] args) throws Exception {
 
            Robot robot = new Robot();
 
            // RIGHT CLICK
            robot.mousePress(InputEvent.BUTTON3_MASK);
            robot.mouseRelease(InputEvent.BUTTON3_MASK);
 
 }
}

--------------------------------------------------------------------

Click & scroll the mouse wheel:

import java.awt.Robot;
import java.awt.event.InputEvent;
 
public class MouseClass {
 
 public static void main(String[] args) throws Exception {
 
            Robot robot = new Robot();
 
            // MIDDLE WHEEL CLICK
            robot.mousePress(InputEvent.BUTTON3_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK);
 
            // SCROLL THE MOUSE WHEEL
            robot.mouseWheel(-100);
 
 }
}

Log in to MySQL in Terminal

>>> mysql -u root -h localhost -p

ztron@ztron-desktop ~ $ mysql -u root -h localhost -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.1.49-1ubuntu8.1 (Ubuntu)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.