饒榮慶 -- 您今天UCWEB了嗎?--http://www.ucweb.com

          3G 手機(jī)開發(fā)網(wǎng)

             :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            99 Posts :: 1 Stories :: 219 Comments :: 0 Trackbacks

           

          1.關(guān)于自動注冊原理與實(shí)踐。

          1.基于瀏覽器請求,-- 程序員寫出一個程序模擬一條自動注冊url,把注冊所必須的參數(shù)都附在請求后面
          2.基于HttpClient 請求。實(shí)現(xiàn)過程比較簡單,可以通過穿過ssl進(jìn)行請求

          自動注冊首先要解決的問題:
          1.關(guān)于注冊驗(yàn)證嗎的破解。
            1.市面上一個簡單圖片驗(yàn)證嗎的開發(fā)已經(jīng)不是什么難事了,對于程序生產(chǎn)的圖片,破解起來是比較困難的,
              特別是google,我曾經(jīng)不段的驗(yàn)證,發(fā)現(xiàn),如果您單獨(dú)取出那條驗(yàn)證嗎的,話,google會說您的請求錯誤,
              也就是google的驗(yàn)證嗎的前提是必須輸入請求注冊url才行,因此破解它是很困難的。
            2.關(guān)于中文驗(yàn)證嗎,雖然生產(chǎn)原理是一樣,但是給注冊的人破解就跟是難了。

          由于以上原因,我沒有找到一個關(guān)于破解驗(yàn)證嗎的程序,而我本人知識水平有限,因此自動注冊,我只能
          找出那些字段跟注冊url,并模擬一個注冊請求。

          前陣子,因?yàn)橛行枨螅蛩闫平釭mail的圖片識別碼,進(jìn)而達(dá)到自動注冊Gmail郵箱的構(gòu)想,

          想法大概如下,構(gòu)建一個Model,保存注冊Gmail郵箱必填字段,跟一些隱藏參數(shù),

          先向Gmail注冊地址進(jìn)行請求服務(wù),拿下Gmail圖片驗(yàn)證碼,進(jìn)而調(diào)用圖片識別程序,進(jìn)行循環(huán)破解,知道破解成功,然后往Model設(shè)置識別嗎的參數(shù),

          最后調(diào)用HttpClient進(jìn)行請求服務(wù)。最后分析返回htm結(jié)果進(jìn)行分析,是否注冊成功。

          在這里,唯一的難度就是破解驗(yàn)證嗎程序,小弟還沒找到好方法,不過至于模擬其他請求已經(jīng)設(shè)置好。現(xiàn)在發(fā)個代碼給大家看看

           

          /** *//********************************************************************
           * 項(xiàng)目名稱                :<b>j2me學(xué)習(xí)</b>            <br/>
           * 
           * Copyright 2005-2006 Wuhua. All rights reserved
           ********************************************************************/
          package org.job.four;

          /** *//**
           * <b>類名:Member.java</b> </br> 
           * 編寫日期: 2007-3-27 <br/>
           * 程序功能描述:提供對注冊字段的封裝,<br/>
           *  程序只需要封裝一個member,再向gmail發(fā)生請求<br/>
           * Demo: <br/>
           * Bug: <br/>
           * 
           * 程序變更日期 :<br/> 
           * 變更作者 :<br/> 
           * 變更說明 :<br/>
           * 
           * @author wuhua </br> <a href="mailto:rrq12345@163.com">rrq12345@163.com</a>
           */
          public class Member ...{
              
              private String PasswdAgain = "51jobboj"; //重復(fù)密碼
           
              private String FirstName="foxjob"; //名字
              private String LastName="tang";//姓
              private String Email="gooooooooooooooooooooooooooogle";//email名字
              private String Passwd="51jobboj";//密碼
              private String selection="who is me?";//安全問題
              
              private String IdentityAnswer="me to 51job"; //密碼安全問題答案
              private String SecondaryEmail="gooogledev@gmail.com";//第2電子郵箱
              private String loc="中國"; //地點(diǎn)
              private String newaccountcaptcha="";  //驗(yàn)證嗎
              
              
              //以下是gmail隱藏的參數(shù)
              private String Continue = "http://mail.google.com/mail/e-11-104e59efab9ad9107b5532645c608844-f30129a93b86f8b2ec791bab26d3a93974381ba7"; //由于continue是java關(guān)鍵字,所以把c改為大寫C
              private String t="6e91f0ba-47e895da-33e242a784269c0e1776";
              private String service="mail";
              private String dsh = "7874657562226198951";
              public final String getContinue() ...{
                  return Continue;
              }
              public final String getDsh() ...{
                  return dsh;
              }
              public final String getService() ...{
                  return service;
              }
              public final String getT() ...{
                  return t;
              }
              public final void setContinue(String continue1) ...{
                  Continue = continue1;
              }
              public final void setDsh(String dsh) ...{
                  this.dsh = dsh;
              }
              public final void setService(String service) ...{
                  this.service = service;
              }
              public final void setT(String t) ...{
                  this.t = t;
              }
              public final String getEmail() ...{
                  return Email;
              }
              public final String getFirstName() ...{
                  return FirstName;
              }
              public final String getIdentityAnswer() ...{
                  return IdentityAnswer;
              }
              public final String getLastName() ...{
                  return LastName;
              }
              public final String getLoc() ...{
                  return loc;
              }
              public final String getNewaccountcaptcha() ...{
                  return newaccountcaptcha;
              }
              public final String getPasswd() ...{
                  return Passwd;
              }
              public final String getPasswdAgain() ...{
                  return PasswdAgain;
              }
              public final String getSecondaryEmail() ...{
                  return SecondaryEmail;
              }
              public final String getSelection() ...{
                  return selection;
              }
              public final void setEmail(String email) ...{
                  Email = email;
              }
              public final void setFirstName(String firstName) ...{
                  FirstName = firstName;
              }
              public final void setIdentityAnswer(String identityAnswer) ...{
                  IdentityAnswer = identityAnswer;
              }
              public final void setLastName(String lastName) ...{
                  LastName = lastName;
              }
              public final void setLoc(String loc) ...{
                  this.loc = loc;
              }
              public final void setNewaccountcaptcha(String newaccountcaptcha) ...{
                  this.newaccountcaptcha = newaccountcaptcha;
              }
              public final void setPasswd(String passwd) ...{
                  Passwd = passwd;
              }
              public final void setPasswdAgain(String passwdAgain) ...{
                  PasswdAgain = passwdAgain;
              }
              public final void setSecondaryEmail(String secondaryEmail) ...{
                  SecondaryEmail = secondaryEmail;
              }
              public final void setSelection(String selection) ...{
                  this.selection = selection;
              }
            
              
              public static final Member getDefaultMember()...{
                  
                  return new Member();
              }
          }

           

           

          package org.job.four;

          import java.io.IOException;

          import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
          import org.apache.commons.httpclient.HttpClient;
          import org.apache.commons.httpclient.HttpException;
          import org.apache.commons.httpclient.HttpStatus;
          import org.apache.commons.httpclient.NameValuePair;
          import org.apache.commons.httpclient.methods.GetMethod;
          import org.apache.commons.httpclient.methods.PostMethod;
          import org.apache.commons.httpclient.params.HttpMethodParams;
          import org.job.util.Logger;

          /** *//**
           * <b>類名:AutoRegistGmail.java</b> </br> 
           * 編寫日期: 2007-3-27 <br/>
           * 程序功能描述:對Gami自動注冊的啟動類 <br/>
           * 注冊原理實(shí)現(xiàn)是,封裝一些gmail比填的字段,然后再通過HttpClient向Gmail請求,
           * 請求完畢后分析結(jié)果
           * Demo: <br/>
           * Bug: <br/>
           * 
           * 程序變更日期 :<br/> 
           * 變更作者 :<br/> 
           * 變更說明 :<br/>
           * 
           * @author wuhua </br> <a href="mailto:rrq12345@163.com">rrq12345@163.com</a>
           */
          public class AutoRegistGmail ...{

           

              private static String postRegistUrl = "https://www.google.com/accounts/NewAccount";

              private static Logger logger = Logger.getLogger(AutoRegistGmail.class);

              public static void main(String[] args) ...{
                  autoRegist();
              }

              public final static void autoRegist() ...{
                  logger.debug("開始自動注冊Gmail.....");
              
                  //        構(gòu)造HttpClient的實(shí)例
                  HttpClient httpClient = new HttpClient();
                  PostMethod postMethod = new PostMethod(postRegistUrl);
                  Member member = Member.getDefaultMember();
                  
                  //             填入各個表單域的值
                  NameValuePair[] data = ...{
                          new NameValuePair("Email", member.getEmail()),
                          new NameValuePair("Passwd", member.getPasswd()),
                          new NameValuePair("PasswdAgain", member.getPasswdAgain()),
                          new NameValuePair("FirstName", member.getFirstName()),
                          new NameValuePair("Loc", member.getLoc()),
                          new NameValuePair("newaccountcaptcha", member
                                  .getIdentityAnswer()),
                          new NameValuePair("IdentityAnswer", member
                                  .getNewaccountcaptcha()),
                          new NameValuePair("Selection", member.getSelection()),
                          new NameValuePair("SecondaryEmail", member.getSecondaryEmail()),
                          new NameValuePair("continue", member.getContinue()),
                          new NameValuePair("dsh", member.getDsh()),
                          new NameValuePair("service", member.getService()) };

                  //             將表單的值放入postMethod中
                  postMethod.setRequestBody(data);
                  try ...{
                      //執(zhí)行g(shù)etMethod
                      int statusCode = httpClient.executeMethod(postMethod);
                      if (statusCode != HttpStatus.SC_OK) ...{
                          System.err.println("Method failed: "
                                  + postMethod.getStatusLine());
                      }
                      //讀取內(nèi)容 
                      byte[] responseBody = postMethod.getResponseBody();
                      //處理內(nèi)容
                      System.out.println(new String(responseBody, "UTF-8"));
                  } catch (HttpException e) ...{
                      //發(fā)生致命的異常,可能是協(xié)議不對或者返回的內(nèi)容有問題
                      System.out.println("Please check your provided http address!");
                      e.printStackTrace();
                  } catch (IOException e) ...{
                      //發(fā)生網(wǎng)絡(luò)異常
                      e.printStackTrace();
                  } finally ...{
                      //釋放連接
                      postMethod.releaseConnection();
                  }

              }
          }



          爬蟲工作室 -- 專業(yè)的手機(jī)軟件開發(fā)工作室
          3G視線 -- 專注手機(jī)軟件開發(fā)
          posted on 2007-04-04 12:42 3G工作室 閱讀(2879) 評論(8)  編輯  收藏 所屬分類: j2ee

          Feedback

          # re: 自動注冊gmail郵箱構(gòu)想 2007-04-04 13:58 aaa
          寫了等于白寫吧,核心的問題沒解決。把那些 getter 與 setter、變量的定義去掉,沒幾行代碼了。  回復(fù)  更多評論
            

          # re: 自動注冊gmail郵箱構(gòu)想[未登錄] 2007-04-04 14:08 samuel
          就是!說的沒錯  回復(fù)  更多評論
            

          # re: 自動注冊gmail郵箱構(gòu)想 2007-04-04 14:21 yuri
          解決驗(yàn)證碼,其他的都不是問題  回復(fù)  更多評論
            

          # re: 自動注冊gmail郵箱構(gòu)想 2007-04-04 14:53 爬蟲工作室
          哈哈。我覺得我是沒這本事了,各位大哥有辦法,
          教教我行嗎?  回復(fù)  更多評論
            

          # re: 自動注冊gmail郵箱構(gòu)想 2007-04-04 18:17 liulc
          構(gòu)想倒是不錯  回復(fù)  更多評論
            

          # re: 自動注冊gmail郵箱構(gòu)想 2007-04-05 08:53 aaa
          來破解blogjava的驗(yàn)證碼吧,是保存在cookie里面的  回復(fù)  更多評論
            

          # re: 自動注冊gmail郵箱構(gòu)想 2008-07-18 10:08 ubunto
          雖然沒提到解決驗(yàn)證碼,不過對 httpclient 的 post和get 方法的使用流程有了更好的理解  回復(fù)  更多評論
            

          # re: 自動注冊gmail郵箱構(gòu)想 2012-09-25 17:17 姜英祺
          請問樓主,自動注冊時有一個bgresponse字段您是怎么獲取到的?  回復(fù)  更多評論
            

          主站蜘蛛池模板: 宜兴市| 康乐县| 铁岭县| 库伦旗| 建瓯市| 金寨县| 莎车县| 永嘉县| 汨罗市| 呼图壁县| 贵定县| 拉孜县| 西藏| 普兰店市| 和林格尔县| 和平县| 奉化市| 平顺县| 五大连池市| 丰县| 错那县| 义马市| 灵璧县| 陇川县| 深圳市| 游戏| 彭水| 县级市| 山东省| 连南| 陆丰市| 邯郸市| 桂林市| 临汾市| 广丰县| 平邑县| 永州市| 长沙县| 简阳市| 酉阳| 桃园县|