惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Y
Y Combinator Blog
F
Fortinet All Blogs
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
博客园 - Franky
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
量子位
博客园 - 三生石上(FineUI控件)
I
InfoQ
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿
D
Docker
美团技术团队
雷峰网
雷峰网
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理

《羽毛の家》的留言

移遠RM500Q-GL在NSA組網下鎖5G – 羽毛の家 Ubuntu下wine中文乱码问题解决 – 羽毛の家 不要IDE Mode! 我們要AHCI! – 羽毛の家 配置OpenVPN調用Java驗證用戶名/密碼登錄 – 羽毛の家 B站直傳測試連接 – 羽毛の家 多線程HttpClient4 Common – 羽毛の家 FFxivARR SqPack 暴力拆包 – 羽毛の家
使用HttpClient4登錄支付寶-淘寶接口 – 羽毛の家
yumao · 2014-08-17 · via 《羽毛の家》的留言

Welcome to Yumao′s Blog.

其實登錄支付寶的方式有很多種
最簡單的就是搞清楚支付寶的
3DES加密方式
直接在主頁登錄
這邊當然講的就是如何繞過支付寶加密
然後登入到支付寶內拉

方式有很多種
這裏先講下淘寶接口好了
衆所周知
登入淘寶帳號之後
在我的淘寶中是有支付寶的跳轉接口的
還有就是淘寶的登錄並不一定需要加密
僞裝成Linux+Chrome客戶端的話
只需要提供 帳號 密碼 驗證碼
即可登入淘寶系統

以下是實現code

	public static void main(String[] args) throws Exception {
		
		//獲取checkcode
		HttpGet get = new HttpGet("https://login.taobao.com/member/login.jhtml");
		HttpClient http = new DefaultHttpClient();  
		http.getParams().setParameter(ClientPNames.COOKIE_POLICY,CookiePolicy.BEST_MATCH);
		
		HttpResponse response = http.execute(get);
		if (response.getStatusLine().getStatusCode() == 200) {
			List<Cookie> cookies = ((AbstractHttpClient) http).getCookieStore().getCookies();
		    for (int i = 0; i < cookies.size(); i++) {
		    	if(cookies.get(i).getName().contains("cookie2"))
		    		System.out.println("checkcode url:\nhttps://regcheckcode.taobao.com/auction/checkcode?sessionID="+cookies.get(i).getValue());
		    }
		}
		//釋放連接
		get.abort();
		//手動輸入checkcode
		System.out.println("input checkcode:");
		Scanner scan=new Scanner(System.in);
		String checkcode=scan.nextLine().trim();
		
		String tbcUsername="<username>";
		String tbcPassword="<password>";
		
		//登入環境設置爲Chrom+Linux 不會有控件加密
		HttpPost post = new HttpPost("https://login.taobao.com/member/login.jhtml");
		post.setHeader("Content-Type","application/x-www-form-urlencoded");
		post.setHeader("Connection","keep-alive");
		//Linux+Chrome
		post.setHeader("User-Agent", "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.79 Safari/537.1"); 
		//NT5+IE
//		post.setHeader("User-Agent","User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)");
		post.setHeader("Accept-Encoding", "deflate,sdch");
		post.setHeader("Accept-Language", "zh-CN,zh;q=0.8");
		post.setHeader("Accept-Charset", "UTF-8,*;q=0.5");  
		
		List<NameValuePair> params = new ArrayList<NameValuePair>(); 
		params.add(new BasicNameValuePair("TPL_username", tbcUsername));  
		params.add(new BasicNameValuePair("TPL_password", tbcPassword));
		params.add(new BasicNameValuePair("TPL_checkcode", checkcode)); 
		params.add(new BasicNameValuePair("TPL_redirect_url", "http://www.taobao.com/")); 
		params.add(new BasicNameValuePair("need_check_code", "false"));
		params.add(new BasicNameValuePair("action", "Authenticator")); 
		params.add(new BasicNameValuePair("event_submit_do_login", "anything")); 
		params.add(new BasicNameValuePair("from", "tbTop")); 
		params.add(new BasicNameValuePair("fc", "default")); 
		params.add(new BasicNameValuePair("style", "default")); 
		params.add(new BasicNameValuePair("support", "000001")); 
		params.add(new BasicNameValuePair("CtrlVersion", "1,0,0,7")); 
		params.add(new BasicNameValuePair("loginType", "3")); 
		
		post.setEntity(new UrlEncodedFormEntity(params,"GBK"));
		//發送請求
		response = http.execute(post);
		System.out.println(response.getStatusLine().getStatusCode());
		if (response.getStatusLine().getStatusCode() == 302||response.getStatusLine().getStatusCode() == 200) {  
		    HttpEntity entity = response.getEntity(); 
		    post.abort();
			
	
			//獲取支付寶跳轉連接
			String jumpAlipayUrl = "";
			get=new HttpGet("http://member1.taobao.com/member/fresh/account_management.htm");
			response=http.execute(get);
			if (response.getStatusLine().getStatusCode() == 200) {  
			    entity = response.getEntity(); 
			    String htmlCode = EntityUtils.toString(entity);
			    jumpAlipayUrl = htmlCode.substring(htmlCode.indexOf("https://lab.alipay.com/user/i.htm?"));
			    jumpAlipayUrl = jumpAlipayUrl.substring(0,jumpAlipayUrl.indexOf("\""));
			    System.out.println("Alipay跳轉連接爲\n"+jumpAlipayUrl);
			}  else 
				System.out.println("頁面打開失敗");
			get.abort();
			//登錄Alipay提供給TB的接口
			get=new HttpGet(jumpAlipayUrl);
			response=http.execute(get);
			if (response.getStatusLine().getStatusCode() == 200) {  
			    entity = response.getEntity(); 
			    String htmlCode = EntityUtils.toString(entity);
			    jumpAlipayUrl = htmlCode.substring(htmlCode.indexOf("window.location.href = \"")+"window.location.href = \"".length());
			    jumpAlipayUrl = jumpAlipayUrl.substring(0,jumpAlipayUrl.indexOf("\""));
			    System.out.println("獲取跳轉到Alipay的URL+\n"+jumpAlipayUrl);
			    
			}
			get.abort();
			//跳轉到Alipay
			get=new HttpGet(jumpAlipayUrl);
			response=http.execute(get);
			if (response.getStatusLine().getStatusCode() == 200) {  
				 entity = response.getEntity(); 
				 String htmlCode = EntityUtils.toString(entity); 
				 System.out.println("alipay content:\n"+htmlCode);
			}
			get.abort();
		}  else {
			System.out.println("頁面打開失敗");
			post.abort();
		}
	}