diff --git a/src/interactsh/Client.java b/src/interactsh/Client.java index dfdab13..ace48fd 100644 --- a/src/interactsh/Client.java +++ b/src/interactsh/Client.java @@ -45,6 +45,7 @@ public boolean registerClient() throws Exception { + "Host: " + host + "\r\n" + "User-Agent: Interact.sh Client\r\n" + "Content-Type: application/json\r\n" + + "Content-Length: " + registerData.toString().length() + "\r\n" + "Connection: close\r\n\r\n" + registerData.toString(); @@ -60,7 +61,7 @@ public boolean registerClient() throws Exception { } public boolean poll() throws IOException, InterruptedException { - String request = "GET /poll?id=" + correlationId + "&secret=" + secretKey + "\r\n" + String request = "GET /poll?id=" + correlationId + "&secret=" + secretKey + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "User-Agent: Interact.sh Client\r\n" + "Connection: close\r\n\r\n"; @@ -99,15 +100,16 @@ public boolean poll() throws IOException, InterruptedException { public void deregister(){ callbacks.printOutput("Deregistering " + correlationId); try { - JSONObject registerData = new JSONObject(); - registerData.put("correlation-id", correlationId); + JSONObject deregisterData = new JSONObject(); + deregisterData.put("correlation-id", correlationId); String request = "POST /deregister HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "User-Agent: Interact.sh Client\r\n" + "Content-Type: application/json\r\n" + + "Content-Length: " + deregisterData.toString().length() + "\r\n" + "Connection: close\r\n\r\n" - + registerData.toString(); + + deregisterData.toString(); callbacks.makeHttpRequest(host, port, scheme, request.getBytes(StandardCharsets.UTF_8)); }catch (Exception ex){ @@ -116,7 +118,7 @@ public void deregister(){ } public String getInteractDomain(){ - if (correlationId.isEmpty()){ + if (correlationId == null || correlationId.isEmpty()){ return ""; } else { String fullDomain = correlationId; @@ -141,12 +143,12 @@ public void generateKeys() throws NoSuchAlgorithmException { } private String getPublicKey(){ - String pubKey = "-----BEGIN RSA PUBLIC KEY-----\n"; + String pubKey = "-----BEGIN PUBLIC KEY-----\n"; String [] chunks = splitStringEveryN(Base64.getEncoder().encodeToString(publicKey.getEncoded()), 64); for (String chunk: chunks) { pubKey += chunk + "\n"; } - pubKey += "-----END RSA PUBLIC KEY-----\n"; + pubKey += "-----END PUBLIC KEY-----\n"; return pubKey; }