Garbage Bag

All my Garbage talks and junk codes

Month: January, 2010

Cursor Play With your neigbour System

If you have more than one system and need to acces all with a single mouse ?

Wanna hack your neigbour node and drive him mad?


you can use this code to move the cursor

and with little modification you can emulate a whole mouse and keyboard functionalities too …

Download My code from here


To Do :


step i) run the server.class first in machine u want to control say A

java server <port_numbr 1000-65535>


step ii) run the client.class in second machine u have the mouse say B

java client <ip of machine say 10.2.3.1 > <port_number_server 1000-65535>


step iii) move  mouse in machine B so that it moves on machine A

Algorithm behind :

i)  get the mouse position from master machine

ii) send the position in a ‘encrypt‘ string with X and Y positions merged

as encrypt=X*10000+Y ( I use 10000  here assuming your screen resolution is not more than 10000X10000 :D )

iii) send the string to slave node using Socket output stream

iv) get the encrypt string and extract x and Y position  by

X=encrypt/10000;

y=encrypt – X;


v) Now move the position of slave machine by mousemove(X,Y) method

vi) You can add leftclick , right click and keyboard keys too as above  :)

Keyboard as Network Packet Monitor

You can transform Your NUM lock and SCROLL lock led’s to monitor packets send and receive :)

Follow the simple steps below :

i) Installation:

Install tleds package  bye sudo apt-get install tleds

ii) Configure :

now configure the interface you use

say for ethernet  run tleds eth0

and for wirless  run tleds wlan0

Perform a restart :)

iii) Customize :

Now you can adjust the delay to very quick response to low response rate by adjusting -d paramter in tleds

for very quick run tleds  eth0 -d 1

for low speed run tleds eth0 -d 200

now you have  tranformed your keyboard to packet monitoring system as below :


enjoy :)

Facebook mouseclicks hack !

I came across a facebook application which counts maximum number of clicks per second and thought of emulating it in java ;)

it is as simple as a crap code … with simple steps Download it from here

step 1:

I wrote a java code which automtes mouseclicks for N times by for loop

the code seems like :

import java.awt.Robot;
import java.awt.event.InputEvent;
/**
*
* @author karthik
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Throwable {
Robot r=new Robot();

System.out.println(“Hurry up ! you have 10 seconds left “);
System.out.println(“This time you must have focused your mouse pointer on START button of facebook appln”);
r.delay(10000);

// TODO code application logic here
for(int i=0;i<10000;i++){
r.mousePress(InputEvent.BUTTON1_MASK);
System.out.println(“Clicking “+i+”th time “);
r.mouseRelease(InputEvent.BUTTON1_MASK);
System.out.println();
System.out.println();
}System.out.println(“Congrats ! you did it man  B-)”);

}
}

now save the code as Main.java in a directory c:\ in windows or /home in linux

step 2:

open terminal

compile the java code by running from the location where code is located by

javac Main.java

in the mean time open the facebook application

step 3:

Run the java code now this is critical part

java Main

( you can directly run this  by extracting Main.java.zip from above )

you will get a screen saying

“Hurry up ! you have 10 seconds left

This time you must have focused your mouse pointer on START button of facebook appln”

now focus your mouse pointer to the START button of fb appln

you will get a count more than 200 sometimes even 300 clicks per second ( depending on ur jvm )

for more clear details watch the video below :

Thank you :)

Disclaimer :

If you move your mouse button other than start button you will get random results around screen and may hang at times so keep the mouse pointer in START button for atleast a minute ;)

Music in Humble terminal

i)  Are you in need of humble player which consumes least your memory

ii)  If your xserver doesnt open and your prompted to a black terminal   and need of a playing music..

iii) if your admin blocked gui

Dont worry still you can hear your favourite  Music files by following simple steps

Step 1:

install the sox for linux by running

sudo apt-get install sox

Step 2:

install mp3 codec for sox (since most of our songs are in .mp3 )

sudo apt-get install libsox-fmt-mp3

Step 3 :

Now your done with  :)

just locate the music folder and run the file

karthik@karthik: play  my-favourite-song.mp3

for eg:

karthik@Karthik:~/Music$ play I\’m\ So\ Available.mp3

I’m So Available.mp3:

File Size: 7.93M     Bit Rate: 239k
Encoding: MPEG audio    Info: 2009
Channels: 2 @ 16-bit   Track: 3
Samplerate: 44100Hz      Album: Akon – Collection
Replaygain: off         Artist: Akon Feat. Flo-Rida
Duration: 00:04:25.51  Title: I’m So Available

In:0.84% 00:00:02.23 [00:04:23.28] Out:107k  [  ====|====- ]        Clip:0

this is what you will see

Step 4:

not only listening you can also record from terminal

karthik@karthik: rec my-recording.wav

you will se output recording screen as

Input File     : ‘default’ (alsa)
Channels       : 2
Sample Rate    : 48000
Precision      : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

In:0.00% 00:00:01.96 [00:00:00.00] Out:90.1k [      |      ]        Clip:0

now your recording will be saved in my-recording.wav file in music folder

enjoy with sox :)

Follow

Get every new post delivered to your Inbox.