Playing with the java applet of Ufone!

Well quite recently i got my interest developed about how to send sms !! With my cruel looking cell phone i visited the ufone web2sms ..! It asks me for Nick and cell phone number!
gave it..and now it authenticates weather i wish to receive the sms or not. I replied yes and the chat Initiates!!! Next thing i did was to download the class file the byte code of the java applet.! Now what !! How does it works.!! We gotta decompile it..!! Used jad and it gives me out the source code of the applet.

which is.


// DeCompiled : webchat.class

import java.applet.Applet;
import java.awt.Button;
import java.awt.Choice;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Label;
import java.awt.Rectangle;
import java.awt.TextArea;
import java.awt.TextComponent;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.Socket;
import java.util.Vector;

public class webchat extends Applet
implements ItemListener, ActionListener
{
/* member class not found */
class SimpleTextListener {}

public static Button buttonDb1;
public static Button buttonDb2;
Button buttonDb3;
Button buttonDb4;
Image img;
Image img1;
String Nick;
public static TextArea textNum;
public static TextField textNumX;
public static TextField textNumA;
public static TextField textNumB;
public static Choice preChoice;
TextField textIP;
TextField textPort;
Label textLabel;
Label textLabel1;
Label textLabel2;
Label textLabel20;
Label textLabel_MSG;
java.awt.List buddy;
Vector V;
String m_number;
String prefix;
public static Client10 clientObject;
String line;
public static String can_message;
public static String id_message;
public static String applet_id;
public static String message_txt;
public static boolean id_flag = false;
String server_ip;
String server_port;

public webchat()
{
server_ip = “vega.vectracom.net”;
server_port = “5000”;
}

public void init()
{
super.init();
setLayout(null);
setBackground(Color.white);
textLabel1 = new Label(“Nick”);
textLabel1.setForeground(Color.black);
textLabel1.setFont(new Font(“Arial”, 0, 10));
textLabel1.setBounds(new Rectangle(5, 20, 40, 20));
Nick = getParameter(“NICK”);
textNumX = new TextField(Nick, 10);
textNumX.setFont(new Font(“Arial”, 0, 10));
textNumX.setBackground(Color.white);
textNumX.setBounds(new Rectangle(50, 20, 70, 20));
textNumX.requestFocus();
textNumX.addTextListener(new Object() /* anonymous class not found */
class _anm1 {}

);
buttonDb2 = new Button(“Connect”);
buttonDb2.setFont(new Font(“Arial”, 0, 10));
buttonDb2.setBounds(new Rectangle(140, 20, 70, 20));
buttonDb2.addActionListener(this);
textNum = new TextArea(“”, 0, 0, 1);
textNum.setFont(new Font(“Arial”, 0, 12));
textNum.setBackground(Color.white);
textNum.setEditable(false);
textNum.setBounds(new Rectangle(5, 60, 300, 120));
V = new Vector();
buddy = new java.awt.List(10, true);
buddy.setFont(new Font(“Arial”, 0, 10));
buddy.setMultipleMode(false);
buddy.setBounds(new Rectangle(310, 60, 90, 120));
can_message = getParameter(“MESSAGE”);
buttonDb3 = new Button(can_message);
buttonDb3.setBounds(new Rectangle(5, 270, 400, 20));
buttonDb3.setFont(new Font(“Arial”, 0, 10));
buttonDb3.setActionCommand(“Add Message”);
buttonDb3.addActionListener(this);
textLabel = new Label(“Mobile No:”);
textLabel.setForeground(Color.black);
textLabel.setFont(new Font(“Arial”, 0, 10));
textLabel.setBounds(new Rectangle(310, 190, 80, 20));
textLabel20 = new Label(“+923”);
textLabel20.setForeground(Color.black);
textLabel20.setFont(new Font(“Arial”, 0, 10));
textLabel20.setBounds(new Rectangle(300, 210, 32, 20));
textNumA = new TextField(9);
textNumA.setFont(new Font(“Arial”, 0, 10));
textNumA.setBackground(Color.white);
textNumA.setBounds(new Rectangle(332, 210, 70, 20));
textNumA.addTextListener(new Object() /* anonymous class not found */
class _anm2 {}

);
textLabel2 = new Label(“Message :”);
textLabel2.setForeground(Color.black);
textLabel2.setFont(new Font(“Arial”, 0, 10));
textLabel2.setBounds(new Rectangle(5, 190, 50, 20));
textNumB = new TextField();
textNumB.setColumns(10);
textNumB.setFont(new Font(“Arial”, 0, 12));
textNumB.setBackground(Color.white);
textNumB.setBounds(new Rectangle(5, 210, 290, 20));
buttonDb1 = new Button(“Send !”);
buttonDb1.setBounds(new Rectangle(310, 240, 90, 20));
buttonDb1.setFont(new Font(“Arial”, 0, 10));
buttonDb1.setEnabled(false);
buttonDb1.addActionListener(this);
buttonDb4 = new Button(“Clear”);
buttonDb4.setBounds(new Rectangle(5, 240, 90, 20));
buttonDb4.setFont(new Font(“Arial”, 0, 10));
buttonDb4.addActionListener(this);
buddy.addItemListener(this);
SimpleTextListener simpletextlistener = new SimpleTextListener();
textNumB.addActionListener(simpletextlistener);
textNumA.addActionListener(simpletextlistener);
img = getImage(getDocumentBase(), getParameter(“img”));
img1 = getImage(getDocumentBase(), getParameter(“img1”));
textIP = new TextField();
textIP.setText(server_ip);
textPort = new TextField();
textPort.setText(server_port);
add(textLabel1);
add(textNumX);
add(buttonDb2);
add(textNum);
add(buddy);
add(textLabel2);
add(textNumB);
add(textLabel);
add(textNumA);
add(textLabel20);
add(buttonDb4);
add(buttonDb1);
add(buttonDb3);
}

public void paint(Graphics g)
{
g.drawImage(img, 100, 300, this);
g.drawImage(img1, 220, 10, this);
}

public void itemStateChanged(ItemEvent itemevent)
{
m_number = buddy.getSelectedItem();
prefix = m_number.substring(2, 5);
m_number = m_number.substring(5, 12);
preChoice.select(prefix);
textNumA.setText(m_number);
}

public void actionPerformed(ActionEvent actionevent)
{
String s2 = actionevent.getActionCommand();
if(s2.equals(“Connect”))
{
if(textNumX.getText().trim().equals(“”))
{
showStatus(“Please enter your nick first !”);
} else
{
textNum.append(“\nConnecting…”);
clientObject = null;
clientObject = new Client10(this, textIP.getText(), textPort.getText());
textNumX.setEnabled(false);
buttonDb2.setLabel(“Disconnect”);
buttonDb2.setActionCommand(“Disconnect”);
}
} else
if(s2.equals(“Disconnect”))
{
buttonDb2.setLabel(“Connect”);
buttonDb2.setActionCommand(“Connect”);
buttonDb1.setEnabled(false);
textNumX.setEnabled(true);
clientObject = null;
try
{
Client10.sock.close();
}
catch(Exception exception) { }
buddy.removeAll();
} else
if(s2.equals(“Add Message”))
{
String s3 = textNumB.getText();
textNumB.setText(s3 + “<” + can_message + “>”);
} else
if(s2.equals(“Clear”))
{
textNumB.setText(“”);
textNumA.setText(“”);
} else
if(s2.equals(“Send !”) && !textNumA.getText().equals(“”) && !textNumB.getText().equals(“”))
{
String s1 = textNumA.getText().trim();
String s = “923” + textNumA.getText().trim();
if(!V.contains(s))
{
V.addElement(s);
buddy.add(s);
}
textNumA.setText(s1);
line = textNumB.getText().trim();
String s4 = textNumX.getText().trim();
textNumB.setText(“”);
textNum.append(“\nTo ” + s + “: ” + line + “”);

// Here is the Message going out.!!

String s5 = “Message MobileServer ” + s + ” 0 ” + id_message + ” ” + s4 + “:\\n” + line;
try
{
clientObject.os.write(s5.getBytes());
}
catch(Exception exception1)
{
System.out.println(“Exception ” + exception1);
}
System.out.println(“Mobile Number: ” + s + “\nMessage :” + line);
}
}

}

So its pretty cool You connect toΒ  vega.vectracom.net:5000

Will send a message in a formate ID 0 0 0 0 <yourid>

and then you send message Message MobileServer 92333<yournumber> 0 <yourid> <yournick> :\n
<and your message>

And it gives out the message inviting a user to say yes or no!

If yes the chat initiated and You will get a reply from Mobileserver πŸ™‚

I have played with it quite a lot made a C# App that makes it possible to send sms !!

Advertisements

~ by Azeem on December 17, 2007.

9 Responses to “Playing with the java applet of Ufone!”

  1. Hi, u got brains buddy !

    Will try this out – btw Im a Java progmr

  2. πŸ™‚ nice to have you here

  3. That’s great. I know a handful of guys that work at VectraCom. In fact, I have been communicating with a couple of their Engineers for testing of sending and receiving of financial transaction messages from them to our Middleware server at work (what you call “SMS Banking”, since I am involved in implemented that for a client here).

  4. Glad to hear that helped ayaz bhai πŸ™‚

  5. Nice . . . . . . so try out a program to send bulk SMSes

  6. Well there is no way you can do Bulk SMSes if you play around with the protocol of there message server You message mobileserver first and in order to initiate chat the message server must reply! and in order to get a reply from message server the number you are message should reply with Y!! So no way to do bulk sms until you invade there server and try out one. πŸ˜‰

  7. slam

  8. can any one tell me how to use this source on any website so that one could send messages from my site?

  9. AOA,

    Green Hat to the rescue!

    Guys, this is an incomplete code … the important part of the code is missing. Client10 function..This function open the channel. without the channel (Session) being opened you cannot send sms’s.. i am working on it… inshallah i will post it soon..

    Regards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: