Created
June 15, 2020 10:22
-
-
Save olliencc/af056560e943bafa145120103a0947a3 to your computer and use it in GitHub Desktop.
Dump keys from Cobalt Strike server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.util.Base64; | |
import common.CommonUtils; | |
import java.security.KeyPair; | |
class DumpKeys | |
{ | |
public static void main(String[] args) | |
{ | |
try { | |
File file = new File(".cobaltstrike.beacon_keys"); | |
if (file.exists()) { | |
KeyPair keyPair = (KeyPair)CommonUtils.readObject(file, null); | |
System.out.printf("Private Key: %s\n\n", new String(Base64.getEncoder().encode(keyPair.getPrivate().getEncoded()))); | |
System.out.printf("Public Key: %s\n\n", new String(Base64.getEncoder().encode(keyPair.getPublic().getEncoded()))); | |
} | |
else { | |
System.out.println("Could not find .cobaltstrike.beacon_keys file"); | |
} | |
} | |
catch (Exception exception) { | |
System.out.println("Could not read asymmetric keys"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment