Created
April 7, 2016 14:14
-
-
Save k2wanko/6376006ce422f9a5286d8bcc801fcc11 to your computer and use it in GitHub Desktop.
xlsxba
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 org.apache.poi.poifs.crypt.Decryptor | |
import org.apache.poi.poifs.crypt.EncryptionInfo | |
import org.apache.poi.poifs.filesystem.POIFSFileSystem | |
import java.io.FileInputStream | |
import java.math.BigInteger | |
fun main(args: Array<String>) { | |
val inputStream = FileInputStream("/path/to/file.xlsx") | |
val fileSystem = POIFSFileSystem(inputStream) | |
val info = EncryptionInfo(fileSystem) | |
val d = Decryptor.getInstance(info) | |
var i: BigInteger = 0L.big | |
while(!d.verifyPassword(i.to36)) { | |
i = i.add(BigInteger.ONE) | |
println("${i.to36} $i") | |
} | |
print("pass: ${i.to36}") | |
} | |
val Long.big: BigInteger | |
get() = BigInteger.valueOf(this) | |
val BigInteger.to36: String | |
get() = toString(36) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment