(byte[] content,boolean isRequest)
| 84 | //则如果请求包含它们返回true |
| 85 | |
| 86 | public boolean isEnabled(byte[] content,boolean isRequest){ |
| 87 | //参数content byte[]即是getMessage中获取的this.inputArea中的文本 |
| 88 | //参数isRequest boolean即表示当前文本是request请求 还是 response接收的数据 |
| 89 | //当isRequest true表示request false表示response |
| 90 | |
| 91 | try{ |
| 92 | if (!(IndexautoDecoder.getRadioButton2State() || IndexautoDecoder.getRadioButton1State())) |
| 93 | return false; |
| 94 | |
| 95 | if(isRequest){// 判断当请求为request |
| 96 | BurpExtender.flag = false; |
| 97 | IRequestInfo requestInfo = BurpExtender.helpers.analyzeRequest(content); |
| 98 | java.util.List<String> headersList = requestInfo.getHeaders(); |
| 99 | String[] hosts = IndexautoDecoder.getEncryptHosts(); |
| 100 | for(String header : headersList) { |
| 101 | // System.out.println(header); |
| 102 | //请求头中包含指定域名“applog.xx.cn”才设置我们生成的消息编辑器 |
| 103 | // for ( String host:hosts) { |
| 104 | // String host_value = ""; |
| 105 | // String[] host_lists = header.split(":"); |
| 106 | // if (host_lists[0].toLowerCase().equals("host")) { |
| 107 | // if (host_lists.length > 2) |
| 108 | // host_value = host_lists[1] + ":" + host_lists[2]; |
| 109 | // else |
| 110 | // host_value = host_lists[1]; |
| 111 | // host_value = host_value.trim(); |
| 112 | // if(host_value.replace("*", "").replaceAll(":(.*)", "").endsWith(host.replace("*", "").replaceAll(":(.*)", ""))) |
| 113 | // BurpExtender.flag = true; |
| 114 | // break; |
| 115 | // } |
| 116 | // if ( header.endsWith(host.replace("*", "")) || host_value.replace("*", "").replaceAll(":(.*)", "").endsWith(host.replace("*", "")) || |
| 117 | // header.replace("*", "").endsWith(host.replace("*", ""))) { |
| 118 | // BurpExtender.flag = true; //返回true |
| 119 | // break; |
| 120 | // } |
| 121 | // } |
| 122 | for (String host : hosts) { // 单个加密的域名 |
| 123 | String host_value = ""; |
| 124 | String[] host_lists = header.split(":"); |
| 125 | if (host_lists[0].toLowerCase().equals("host")) { |
| 126 | if (host_lists.length > 2) |
| 127 | host_value = host_lists[1] + ":" + host_lists[2]; |
| 128 | else |
| 129 | host_value = host_lists[1]; |
| 130 | |
| 131 | host_value = host_value.trim(); |
| 132 | if(host_value.replace("*", "").replaceAll(":(.*)", "").endsWith(host.replace("*", "").replaceAll(":(.*)", ""))) |
| 133 | BurpExtender.flag = true; |
| 134 | } |
| 135 | |
| 136 | if ( header.endsWith(host.replace("*", "")) || host_value.replace("*", "").replaceAll(":(.*)", "").endsWith(host.replace("*", "")) || |
| 137 | header.replace("*", "").endsWith(host.replace("*", ""))) { |
| 138 | |
| 139 | BurpExtender.flag = true; //返回true |
| 140 | } |
| 141 | |
| 142 | } |
| 143 | } |
nothing calls this directly
no test coverage detected