Last active
July 22, 2019 15:01
-
-
Save pgmillon/3585f5e59fde9374fd22 to your computer and use it in GitHub Desktop.
Nexus password recovery
This file contains hidden or 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 org.bouncycastle.jce.provider.BouncyCastleProvider; | |
import org.sonatype.security.ldap.realms.persist.PasswordHelper; | |
import org.sonatype.security.ldap.upgrade.cipher.DefaultPlexusCipher; | |
import org.sonatype.security.ldap.upgrade.cipher.PlexusCipher; | |
import org.sonatype.security.ldap.upgrade.cipher.PlexusCipherException; | |
import java.security.Security; | |
/** | |
* @author Pierre-Gildas MILLON <[email protected]> | |
*/ | |
public class App { | |
public static void main(String[] args) throws PlexusCipherException { | |
final PlexusCipher cipher = new DefaultPlexusCipher(); | |
final String ENC = "CMMDwoV"; | |
Security.addProvider(new BouncyCastleProvider()); | |
PasswordHelper ph = new PasswordHelper() { | |
public String encrypt(String password) throws PlexusCipherException { | |
if(password != null) { | |
return cipher.encrypt(password, ENC); | |
} | |
return null; | |
} | |
public String decrypt(String encodedPassword) throws PlexusCipherException { | |
if(encodedPassword != null) { | |
return cipher.decrypt(encodedPassword, ENC); | |
} | |
return null; | |
} | |
}; | |
System.out.println(ph.decrypt("")); | |
} | |
} |
This file contains hidden or 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
<?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>io.github.pgmillon</groupId> | |
<artifactId>nexus.decrypt</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<dependencies> | |
<dependency> | |
<groupId>org.sonatype.nexus.plugins.ldap</groupId> | |
<artifactId>ldap-common</artifactId> | |
<version>1.9.2.2</version> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment