This commit is contained in:
loliball 2024-10-04 00:28:50 +08:00
parent 195635d2e3
commit 67631e4dbd
5 changed files with 112 additions and 18 deletions

View File

@ -12,7 +12,10 @@ repositories {
dependencies { dependencies {
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
implementation("com.aspose:aspose-psd:24.9:jdk16") // implementation("com.aspose:aspose-psd:24.9:jdk16")
implementation(files("libs/111.jar"))
implementation("org.javassist:javassist:3.30.2-GA")
implementation("net.lingala.zip4j:zip4j:2.11.5")
} }
tasks.test { tasks.test {

BIN
libs/111.jar Normal file

Binary file not shown.

View File

@ -0,0 +1,33 @@
package loli.ball
import net.lingala.zip4j.ZipFile
import net.lingala.zip4j.model.ZipParameters
import java.io.File
import javax.swing.filechooser.FileSystemView
/**
* Created by LoliBall on 2024/10/3 23:15.
* https://github.com/WhichWho
*/
fun main() {
val desktop = FileSystemView.getFileSystemView().homeDirectory
val fileAA = File("C:\\Users\\litte\\Desktop\\com\\aspose\\psd\\internal\\kP\\e.class")
val zip = ZipFile(File(desktop, "111.jar"))
zip.fileHeaders
// .filter { it.fileName.startsWith("META-INF") }
// .forEach {
// zip.removeFile(it)
// }
.filter { it.fileName == "com/aspose/psd/internal/kP/e.class" }
.forEach {
println(it.fileName)
val fileName = it.fileName
zip.removeFile(fileName)
zip.addFile(fileAA, ZipParameters().also { it.fileNameInZip = fileName })
}
zip.close()
}

42
src/main/kotlin/Crack.kt Normal file
View File

@ -0,0 +1,42 @@
package loli.ball
import javassist.ClassPool
import javassist.CtClass
import javassist.bytecode.Bytecode
import java.io.File
import javax.swing.filechooser.FileSystemView
/**
* Created by LoliBall on 2024/10/3 22:47.
* https://github.com/WhichWho
*/
fun main() {
val desktop = FileSystemView.getFileSystemView().homeDirectory
ClassPool.getDefault().insertClassPath(File(desktop, "111.jar").absolutePath)
val zzZJJClass = ClassPool.getDefault().getCtClass("com.aspose.psd.internal.kP.e")
val methodA = zzZJJClass.declaredMethods
for (ctMethod in methodA) {
var ps = ctMethod.parameterTypes
if (ps.size == 1 && ctMethod.name == "a" && ctMethod.returnType.name == "int") {
println(ctMethod.name)
println(ctMethod.parameterTypes.toList())
println(ctMethod.returnType)
ctMethod.setBody("{return 2;}")
// var methodInfo = ctMethod.getMethodInfo()
// var constPool = methodInfo.getConstPool()
// var bytecode = Bytecode(constPool) // 创建指令码
// bytecode.addIconst(0) // 推送到操作数栈的栈顶
// bytecode.addReturn(CtClass.intType) // 返回int类型的结果
// methodInfo.setCodeAttribute(bytecode.toCodeAttribute()) // 设置到方法指令码中
}
}
//这一步就是将破译完的代码放在桌面上
zzZJJClass.writeFile(desktop.absolutePath)
}

View File

@ -1,12 +1,12 @@
package loli.ball package loli.ball
import com.aspose.psd.Color
import com.aspose.psd.Graphics import com.aspose.psd.Graphics
import com.aspose.psd.Pen
import com.aspose.psd.fileformats.psd.ColorModes import com.aspose.psd.fileformats.psd.ColorModes
import com.aspose.psd.fileformats.psd.CompressionMethod import com.aspose.psd.fileformats.psd.CompressionMethod
import com.aspose.psd.fileformats.psd.PsdImage import com.aspose.psd.fileformats.psd.PsdImage
import com.aspose.psd.fileformats.psd.layers.Layer
import com.aspose.psd.imageoptions.PsdOptions import com.aspose.psd.imageoptions.PsdOptions
import javax.swing.Spring.height
/** /**
@ -15,22 +15,38 @@ import com.aspose.psd.imageoptions.PsdOptions
*/ */
fun main() { fun main() {
val bmpImage = PsdImage(100, 100) val image = PsdImage.load("output1.psd") as PsdImage
Graphics(bmpImage).clear(Color.getRed()) image.layers.forEach {
println(it.displayName)
val psdImage = PsdImage(300, 300) }
// fill image data. // var layer = Layer()
val graphics = Graphics(psdImage) // layer.setBottom(100)
graphics.clear(Color.getWhite()) // layer.setRight(100)
val pen = Pen(Color.getBrown()) // image.addLayer(layer)
graphics.drawRectangle(pen, bmpImage.getBounds())
// create an instance of PsdOptions, Set it's various properties Save image to disk in PSD format // Graphics(image).clear(Color.getRed())
val psdOptions = PsdOptions()
psdOptions.colorMode = ColorModes.Rgb
psdOptions.compressionMethod = CompressionMethod.Raw
psdOptions.version = 4 // val bmpImage = PsdImage(100, 100)
bmpImage.save("output.psd", psdOptions) // Graphics(bmpImage).clear(Color.getRed())
//
// val psdImage = PsdImage(300, 300)
//
//// fill image data.
// val graphics = Graphics(psdImage)
// graphics.clear(Color.getWhite())
// val pen = Pen(Color.getBrown())
// graphics.drawRectangle(pen, bmpImage.getBounds())
//
//
//// create an instance of PsdOptions, Set it's various properties Save image to disk in PSD format
// val psdOptions = PsdOptions()
// psdOptions.colorMode = ColorModes.Rgb
// psdOptions.compressionMethod = CompressionMethod.Raw
// psdOptions.version = 4
// image.save("output1.psd", psdOptions)
} }