2012年10月18日 星期四

j2ssh



[NOTE]
用j2ssh使用java進行SSH連線並下指令的小範例


import com.sshtools.j2ssh.*;
import com.sshtools.j2ssh.transport.IgnoreHostKeyVerification;
import com.sshtools.j2ssh.authentication.*;
import com.sshtools.j2ssh.session.SessionChannelClient;
import com.sshtools.j2ssh.session.SessionOutputReader;


String user = "user";
String passwd = "123456";
String host = "111.111.111.111";
String port = "22";
//先建立好一個使用者的認證,並給他帳號密碼資訊
PasswordAuthenticationClient auth = new PasswordAuthenticationClient();
auth.setUsername(user);
auth.setPassword(passwd);


try { //必須catch

            //建立一個空的client物件,並給他連線資訊
            SshClient client = new SshClient();
            client.connect(host, 22, new IgnoreHostKeyVerification());

            //利用這個client物件,使用剛剛建立的使用者認證來進行登入
            int result = client.authenticate(auth);
            if(result== AuthenticationProtocolState.COMPLETE){
                        System.out.println("OK");
            }
            else{
                        System.out.println(result);
            }

            //成功登入就建立一個空的session 準備進行對話
            SessionChannelClient session = new SessionChannelClient();
            //替這個session物件開啟一個對話用的Channel
            session = client.openSessionChannel();
           //開始對話
            if (session.startShell()){
             
            }
           //建立一個Output Stream ,並且把他關連到剛剛建立的session         
            OutputStream writer = session.getOutputStream();
          //建立一個專門讀output Stream的Reader,關連到session
            SessionOutputReader sor = new SessionOutputReader(session);
          //下指令
            writer.write("pwd\n".getBytes());
          //一定要等一下,不然機器還沒返回結果你就去讀會得到NULL
            Thread.sleep(3000);        
          //從Reader拿到Stream的資料
            String line = sor.getOutput();        
            System.out.println(line);
          //還要下指令的話就繼續write、繼續等、繼續getOutput
          //有始有終
            session.close();
        } catch (Exception ex) {
            System.out.println(ex.toString());
        }

2012年10月6日 星期六

ATH-ES55 黑耳姬

ATH-ES55 未RUN試聽心得


品嘉白色缺貨,黑的也不錯,就把黑耳姬帶回家了 \O_O/


 作者  gmoz (  This can't do that. )                          看板  Headphone
 標題  [心得] 鐵三角 ATH-ES55 黑耳姬
 時間  Sat Oct  6 12:35:55 2012
───────────────────────────────────────

姬體:ATH-ES55 黑色 (白色大缺貨)

姬體狀態:全新、未RUN過。

入掱價格:品嘉 2.7K 老闆說現在買,超值。

心得:

1.試聽YANNI(Live at the Acropolis) DVD

  細節還OK,以前爛爛的耳機(SJ3)聽不到的小樂器聲都出現了,
  鈴鼓、Hihat、Ride Cym. 這些金屬類的聲音我覺得表現的還不錯,
  BASS聲線表現中上、低頻厚,中頻足、但感覺有點擠在一起,
  高音稍暗,等到RUN開後應該可以接受 (在品嘉試聽過RUN開的)

2.試聽Dream Theater( Six Degrees of Inner Turbulence) DVD

  吉他的音色表現佳(尤其是clear tone),鼓的聲音表現也不錯
  低頻雖厚但力度感覺有點沒有拳拳到肉,不過拿來聽前衛金、日本ACG歌應該是沒差

3.試聽Asriel (QuoVadis) 320K MP3

  因為中頻厚,樂器更明顯了,KOKOMI的聲音有些歌跑到稍微後面去了,
  等RUN開後應該會好一些

4.暗黑破壞神 3-7
  武僧的聲音更有磁性了

結論:

2.7K的價格來說,應該算OK

果然沒有直上中高階耳機是對的,以後耳朵上癮了,坑衝開了就沒救了...QAQ
壓抑自身威能(?中..


--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.167.117.132

終焉に咲く花-Asriel