吾爱汇编

 找回密码
 立即注册

QQ登录

绑定QQ避免忘记帐号

查看: 6171|回复: 72

[其他] 参考某东618工具接口写了几个请求

  [复制链接]
白云点缀的蓝 发表于 2021-6-15 16:15 | 显示全部楼层 |阅读模式

618.jpg

[Java] 纯文本查看 复制代码
import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.junit.Test;

import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
public class test {
    public String  Gets_token() throws Exception {
        String s_token="";
        HashMap<String, Object> stringStringHashMap = new HashMap<>();
        stringStringHashMap.put("lang","chs");
        stringStringHashMap.put("appid","300");
        stringStringHashMap.put("returnurl","https://wq.jd.com/passport/LoginRedirect?state=1621999066&returnurl=https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action&source=wq_passport");
        stringStringHashMap.put("source","wq_passport");
        JSONObject jsonObject=new JSONObject(stringStringHashMap);
        HttpClient httpClient= HttpClients.createDefault();
        HttpPost httpRequest=new HttpPost("https://plogin.m.jd.com/cgi-bin/mm/new_login_entrance");
        HttpUriRequest httpUriRequest=new HttpPost();
        StringEntity stringEntity=new StringEntity(jsonObject.toString(), StandardCharsets.UTF_8);
        stringEntity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"application/x-www-form-urlencoded"));
        httpRequest.setEntity(stringEntity);
        httpRequest.setHeader("Accept","application/json, text/plain, */*");
        httpRequest.setHeader("Referrer","https://plogin.m.jd.com/cgi-bin/mm/new_login_entrance?lang=chs&appid=300&returnurl=https://wq.jd.com/passport/LoginRedirect?state%3D1621999066%26returnurl%3Dhttps://home.m.jd.com/myJd/newhome.action?sceneval%3D2%26ufc%3D%26/myJd/home.action%26source%3Dwq_passport&source=wq_passport");
        httpRequest.setHeader("Accept","application/json, text/plain, */*");
        HttpResponse execute = httpClient.execute(httpRequest);
        if(execute.getEntity()!=null){
            String s = EntityUtils.toString(execute.getEntity());
            System.out.println(s);
            JSONObject jsonObject1 = JSONObject.parseObject(s);
            s_token = (String) jsonObject1.get("s_token");
            System.out.println(s_token);
        }
        return s_token;
//        System.out.println();
//        System.out.println(execute.toString());
    }
    public String GetToken() throws Exception {
        String s1 = Gets_token();
        CloseableHttpClient aDefault = HttpClients.createDefault();
    HttpPost httpPost = new HttpPost("https://plogin.m.jd.com/cgi-bin/m/tmauthreflogurl?lang=chs&appid=300&returnurl=https://wq.jd.com/passport/LoginRedirect?state%3D1621999066%26returnurl%3Dhttps://home.m.jd.com/myJd/newhome.action?sceneval%3D2%26ufc%3D%26/myJd/home.action%26source%3Dwq_passport&source=wq_passport&s_token="+s1+"");
    httpPost.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36");
    httpPost.setHeader("cookie","guid=79e9eef8e8c5c01a96f2e9c1504431093434233a23d605c088b6ebf4b4bfd4f6; EXPIRES=Wed, 08-Jun-2022 02:48:21 GMT; PATH=/; DOMAIN=.plogin.m.jd.com, lang=chs; PATH=/; DOMAIN=.plogin.m.jd.com, lsid=uyabtasbwcc8yjm5yqkndd2z3bb8zmiuks5e2xpza289luek; PATH=/; DOMAIN=.plogin.m.jd.com, lstoken=7ffzku2i; EXPIRES=Thu, 08-Jul-2021 02:48:21 GMT; PATH=/; DOMAIN=.plogin.m.jd.com, lsid=; Domain=.jd.com; Path=/; Expires=Fri, 02-Jan-1970 00:00:00 GMT, guid=; Domain=.jd.com; Path=/; Expires=Fri, 02-Jan-1970 00:00:00 GMT");
    httpPost.setHeader("referer","https://plogin.m.jd.com/cgi-bin/m/tmauthreflogurl?s_token=e16h3zv1");
    httpPost.setHeader("Accept","application/json, text/plain, */*");
    HashMap<String, Object> stringObjectHashMap = new HashMap<>();
    stringObjectHashMap.put("lang","chs");
    stringObjectHashMap.put("appid","300");
    stringObjectHashMap.put("returnurl","https://wq.jd.com/passport/LoginRedirect?state=1621999066&returnurl=https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action&source=wq_passport");
    stringObjectHashMap.put("source","wq_passport");
    stringObjectHashMap.put("s_token",s1);
        JSONObject jsonObject1 = new JSONObject(stringObjectHashMap);
        StringEntity stringEntity = new StringEntity(jsonObject1.toString());
    stringEntity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"application/x-www-form-urlencoded"));
    httpPost.setEntity(stringEntity);
    CloseableHttpResponse execute = aDefault.execute(httpPost);
    HttpEntity entity = execute.getEntity();
String Token="";
    if (entity != null) {
        String s = EntityUtils.toString(entity);
        JSONObject jsonObject = JSONObject.parseObject(s);
        System.out.println(s);
        Token= (String) jsonObject.get("Token");
        System.out.println(Token);
    }
        return Token;
//    return "1";
}
public void GetQr_code()throws Exception{
    String s = GetToken();
    CloseableHttpClient aDefault = HttpClients.createDefault();
    HttpPost httpPost = new HttpPost();
    httpPost.setURI(new URI("https://plogin.m.jd.com/cgi-bin/m/tmauth?client_type=m&appid=300&token="+s));
    HashMap<String, Object> stringObjectHashMap = new HashMap<>();
    stringObjectHashMap.put("appid","300");
    stringObjectHashMap.put("client_type","m");
    stringObjectHashMap.put("token",s);
    JSONObject jsonObject = new JSONObject(stringObjectHashMap);
    StringEntity stringEntity = new StringEntity(jsonObject.toString());
    stringEntity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"multipart/form-data"));
    httpPost.setEntity(stringEntity);
    aDefault.execute(httpPost);
}

    public static void main(String[] args) throws Exception{
        new test().GetQr_code();
    }
}


依赖相关


[Java] 纯文本查看 复制代码
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>untitled</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>
<dependencies>
    <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.13</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>fastjson</artifactId>
        <version>1.2.76</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/junit/junit -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.2</version>
        <scope>test</scope>
    </dependency>

</dependencies>
</project>

评分

参与人数 10HB +10 THX +4 收起 理由
消逝的过去 + 2
后学真 + 1
风里去 + 1 [吾爱汇编论坛52HB.COM]-软件反汇编逆向分析,软件安全必不可少!
zxjzzh + 2 [吾爱汇编论坛52HB.COM]-软件反汇编逆向分析,软件安全必不可少!
agan8888 + 1
samtry + 1 [吾爱汇编论坛52HB.COM]-吃水不忘打井人,给个评分懂感恩!
zm315857235 + 1 [吾爱汇编论坛52HB.COM]-学破解防破解,知进攻懂防守!
pmm018 + 1
liluj0079835 + 1 + 1 [快捷评语]--吃水不忘打井人,给个评分懂感恩!
0×Ret + 1 + 1 [快捷评语]--积极评分,从我做起。感谢分享!

查看全部评分

吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
1804536204 发表于 2021-6-16 03:05 | 显示全部楼层
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
0×Ret 发表于 2021-6-16 09:46 | 显示全部楼层


感谢作者分享,正好需要
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
办事靠关系 发表于 2021-6-24 18:14 | 显示全部楼层
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
 楼主| 白云点缀的蓝 发表于 2021-6-24 18:47 | 显示全部楼层

办事靠关系 发表于 2021-6-24 18:14
请问这个是做什么用的?

拿来做京东任务
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
2098502556 发表于 2021-8-1 02:09 | 显示全部楼层
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
omgTsQ6917 发表于 2022-2-25 05:54 | 显示全部楼层

谢谢分享
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
ftN2 发表于 2022-2-25 06:09 | 显示全部楼层

感谢楼主
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
CLybc73 发表于 2022-2-28 16:27 | 显示全部楼层

学习永不间断!
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
wLlqmUDo49 发表于 2022-3-1 01:15 | 显示全部楼层

谢谢分享
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

警告:本站严惩灌水回复,尊重自己从尊重他人开始!

1层
2层
3层
4层
5层
6层
7层
8层
9层
10层

免责声明

吾爱汇编(www.52hb.com)所讨论的技术及相关工具仅限用于研究学习,皆在提高软件产品的安全性,严禁用于不良动机。任何个人、团体、组织不得将其用于非法目的,否则,一切后果自行承担。吾爱汇编不承担任何因为技术滥用所产生的连带责任。吾爱汇编内容源于网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除。如有侵权请邮件或微信与我们联系处理。

站长邮箱:SharkHeng@sina.com
站长QQ:1140549900


QQ|RSS|手机版|小黑屋|帮助|吾爱汇编 ( 京公网安备11011502005403号 , 京ICP备20003498号-6 )|网站地图

Powered by Discuz!

吾爱汇编 www.52hb.com

快速回复 返回顶部 返回列表