사이월드 채팅프로그램 분석
스샷입니당.
하면 다음과 같이 나옵니다.
아래는 소스코드입니다.
[CODE type="java"] import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
public class CyChat extends JFrame implements ActionListener{
[tab]
[tab]JTextArea txt_input;
[tab]
[tab]JPanel jp = new JPanel();
[tab]
[tab]
[tab]
[tab]public void init(){
[tab]
[tab]txt_input = new JTextArea(30,50);
[tab]jp.add(new JScrollPane(txt_input), BorderLayout.CENTER);
[tab]setSize(800,600);
[tab]
[tab]
[tab] [tab]
[tab]//jp.add(txt_input);
[tab]
[tab]
[tab]JButton cmd_ok = new JButton("실행");
[tab]jp.add(cmd_ok,BorderLayout.EAST);
[tab]
[tab]cmd_ok.addActionListener(this);
[tab]add(jp);
[tab]
[tab]
[tab]
[tab]}
[tab]public void paint(Graphics g){
[tab][tab]super.paint(g);
[tab][tab]
[tab]}
[tab]
[tab]public void actionPerformed(ActionEvent e) {
[tab][tab]String res;
[tab][tab]res = txt_input.getText();
[tab][tab]
[tab][tab]txt_input.setText( parse(res));
[tab][tab]repaint();
[tab][tab]
[tab][tab]
[tab]}
[tab]public CyChat(){
[tab][tab]super("hi");
[tab][tab]init();
[tab][tab]setSize(640,640);
[tab][tab]setVisible(true);
[tab][tab]
[tab]}
[tab]
[tab]public String parse(String text){
[tab][tab]StringBuffer buf = new StringBuffer();
[tab][tab]//text = text.replaceAll("%u","0x%");
[tab][tab]text = text.replaceAll("%20"," ");
[tab][tab]String arText[] = text.split("\n");
[tab][tab]String tmp;
[tab][tab]
[tab][tab]
[tab]
[tab][tab]StringTokenizer token = new StringTokenizer(text,"%");
[tab][tab]tmp ="";
[tab][tab]while(token.hasMoreTokens()){
[tab][tab][tab]try{
[tab][tab][tab][tab]tmp = token.nextToken();
[tab][tab][tab][tab]
[tab][tab][tab][tab][tab]
[tab][tab][tab][tab][tab]int intval = 0;
[tab][tab][tab][tab][tab]char charval;
[tab][tab][tab][tab][tab]
[tab][tab][tab][tab][tab]intval = Integer.parseInt(tmp.substring(1).trim(),16);
[tab][tab][tab][tab][tab]charval = (char)intval;
[tab][tab][tab][tab][tab]buf.append(charval );
[tab][tab][tab]}
[tab][tab][tab]catch (NumberFormatException e) {
[tab][tab][tab][tab]buf.append(tmp);
[tab][tab][tab]}
[tab][tab]}
[tab][tab]buf.append("\n");
[tab][tab]
[tab]
[tab][tab]
[tab][tab]return buf.toString();
[tab]}
[tab]
public static void main(String args[]){
[tab][tab]CyChat cy = new CyChat();
[tab]
[tab]
[tab][tab]
[tab][tab]cy.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE);
[tab][tab]
[tab]}
}
[/HTML][/CODE]
밑에 포스트에서 삽질한 결과물입니다-_-a
악용하지마세요
이 프로그램을 사용해서 일어나는 일에 대해서는 책임지지 않습니다.
Trackback Address :: 이 글에는 트랙백을 보낼 수 없습니다