提交
This commit is contained in:
parent
195635d2e3
commit
67631e4dbd
@ -12,7 +12,10 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
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 {
|
||||
|
BIN
libs/111.jar
Normal file
BIN
libs/111.jar
Normal file
Binary file not shown.
33
src/main/kotlin/CombineJar.kt
Normal file
33
src/main/kotlin/CombineJar.kt
Normal 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
42
src/main/kotlin/Crack.kt
Normal 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)
|
||||
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package loli.ball
|
||||
|
||||
import com.aspose.psd.Color
|
||||
import com.aspose.psd.Graphics
|
||||
import com.aspose.psd.Pen
|
||||
import com.aspose.psd.fileformats.psd.ColorModes
|
||||
import com.aspose.psd.fileformats.psd.CompressionMethod
|
||||
import com.aspose.psd.fileformats.psd.PsdImage
|
||||
import com.aspose.psd.fileformats.psd.layers.Layer
|
||||
import com.aspose.psd.imageoptions.PsdOptions
|
||||
import javax.swing.Spring.height
|
||||
|
||||
|
||||
/**
|
||||
@ -15,22 +15,38 @@ import com.aspose.psd.imageoptions.PsdOptions
|
||||
*/
|
||||
fun main() {
|
||||
|
||||
val bmpImage = PsdImage(100, 100)
|
||||
Graphics(bmpImage).clear(Color.getRed())
|
||||
val image = PsdImage.load("output1.psd") as PsdImage
|
||||
image.layers.forEach {
|
||||
println(it.displayName)
|
||||
}
|
||||
|
||||
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())
|
||||
// var layer = Layer()
|
||||
// layer.setBottom(100)
|
||||
// layer.setRight(100)
|
||||
// image.addLayer(layer)
|
||||
|
||||
|
||||
// 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
|
||||
bmpImage.save("output.psd", psdOptions)
|
||||
|
||||
// Graphics(image).clear(Color.getRed())
|
||||
|
||||
|
||||
|
||||
// val bmpImage = PsdImage(100, 100)
|
||||
// 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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user