閱讀291 返回首頁    go 魔獸


仿冒檢測示例代碼__Java-SDK_SDK手冊_移動安全-阿裏雲

仿冒檢測

  1. public class ScanFakeTest {
  2. IAcsClient client = null;
  3. @BeforeMethod
  4. public void init() throws ClientException {
  5. // 替換成調用方的 accessKey 和 accessKeySecret
  6. IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "your key", "your secret");
  7. // 初始化一個IAcsClient對象
  8. client = new DefaultAcsClient(profile);
  9. }
  10. private String getAppInfo() {
  11. JSONObject appInfo = new JSONObject();
  12. appInfo.put("dataType", 1);
  13. appInfo.put("data",
  14. "https://g01.alibaba-inc.com/tfscom/LB1PaMeKXXXXXX8XFXXXXXXXXXX.tfsprivate1446115983140-375");
  15. appInfo.put("md5", "ce86f08da845d0af6d9df2a958de17b0");
  16. appInfo.put("size", 1713656);
  17. appInfo.put("callbackUrl", "https://aaa.com/callback");
  18. appInfo.put("appOsType", 1);
  19. return appInfo.toJSONString();
  20. }
  21. @Test
  22. public void testScanFake() {
  23. ScanFakeRequest request = new ScanFakeRequest();
  24. request.setExtParam("ext message - scan fake by xidong.");
  25. request.setAppInfo(getAppInfo());
  26. try {
  27. ScanFakeResponse response = client.getAcsResponse(request);
  28. System.out.println("error code : " + response.getErrorCode());
  29. System.out.println("error msg : " + response.getErrorMsg());
  30. Data data = response.getData();
  31. //todo
  32. } catch (Exception e) {
  33. e.printStackTrace();
  34. }
  35. }
  36. }

查詢仿冒檢測掃描詳細結果

  1. public class GetRiskDetailTest {
  2. IAcsClient client = null;
  3. @BeforeMethod
  4. public void init() throws ClientException {
  5. // 替換成調用方的 accessKey 和 accessKeySecret
  6. IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "your key", "your secret");
  7. // 初始化一個IAcsClient對象
  8. client = new DefaultAcsClient(profile);
  9. }
  10. @Test
  11. public void test() {
  12. GetRiskDetailRequest request = new GetRiskDetailRequest(); request.setItemId("b888cd36-a5e4-4103-85d3-5ab0c330a5d3");
  13. try {
  14. GetRiskDetailResponse response = client.getAcsResponse(request);
  15. System.out.println("error code : " + response.getErrorCode());
  16. System.out.println("error msg : " + response.getErrorMsg());
  17. Data data = response.getData();
  18. //todo
  19. } catch (ServerException e) {
  20. e.printStackTrace();
  21. } catch (ClientException e) {
  22. e.printStackTrace();
  23. }
  24. }
  25. }

最後更新:2016-11-23 16:04:13

  上一篇:go 惡意代碼掃描示例代碼__Java-SDK_SDK手冊_移動安全-阿裏雲
  下一篇:go 接入前準備__Android_安全組件教程_移動安全-阿裏雲