Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Oracle 如何打开批量plsql包?_Oracle_Batch File_Plsql_Cmd_Unwrap - Fatal编程技术网

Oracle 如何打开批量plsql包?

Oracle 如何打开批量plsql包?,oracle,batch-file,plsql,cmd,unwrap,Oracle,Batch File,Plsql,Cmd,Unwrap,我在一个bat文件中有下面的代码,用于包装执行bat文件的文件夹中的所有包 @echo off for /R %%f in (*.pkb) do ( wrap iname="%%~dpnxf" oname="%%~dpnf.plb" DEL %%~dpnxf ) 有人能建议一种方法来打开文件夹中的所有包吗?有一些工具可以帮助您 Python: 爪哇: 也许,Python脚本更易于从终端使用 Java解决方案实际上是一个以*.j

我在一个bat文件中有下面的代码,用于包装执行bat文件的文件夹中的所有包

@echo off
for /R %%f in (*.pkb) do (
                wrap iname="%%~dpnxf" oname="%%~dpnf.plb"
                DEL %%~dpnxf
)

有人能建议一种方法来打开文件夹中的所有包吗?

有一些工具可以帮助您

  • Python:

  • 爪哇:

也许,Python脚本更易于从终端使用

Java解决方案实际上是一个以*.jar表示的插件,但从中提取基本部分非常简单

此任务所需的只是com.trivadis.unwrapper.util包中的5个*.class文件。 也许反编译它们可以让图片更清晰

打开一个包裹只需打电话

String wrappedCode = ???.getPackageCode();
String sourceCode = Unwrapper.unwrap(wrappedCode);
基本算法如下:

package com.trivadis.unwrapper.util;

import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.DataFormatException;

public class Unwrapper {
  private static int[] charmap = new int[]{61, 101, 133, 179, 24, 219, 226, 135, 241, 82, 171, 99, 75, 181, 160, 95, 125, 104, 123, 155, 36, 194, 40, 103, 138, 222, 164, 38, 30, 3, 235, 23, 111, 52, 62, 122, 63, 210, 169, 106, 15, 233, 53, 86, 31, 177, 77, 16, 120, 217, 117, 246, 188, 65, 4, 129, 97, 6, 249, 173, 214, 213, 41, 126, 134, 158, 121, 229, 5, 186, 132, 204, 110, 39, 142, 176, 93, 168, 243, 159, 208, 162, 113, 184, 88, 221, 44, 56, 153, 76, 72, 7, 85, 228, 83, 140, 70, 182, 45, 165, 175, 50, 34, 64, 220, 80, 195, 161, 37, 139, 156, 22, 96, 92, 207, 253, 12, 152, 28, 212, 55, 109, 60, 58, 48, 232, 108, 49, 71, 245, 51, 218, 67, 200, 227, 94, 25, 148, 236, 230, 163, 149, 20, 224, 157, 100, 250, 89, 21, 197, 47, 202, 187, 11, 223, 242, 151, 191, 10, 118, 180, 73, 68, 90, 29, 240, 0, 150, 33, 128, 127, 26, 130, 57, 79, 193, 167, 215, 13, 209, 216, 255, 19, 147, 112, 238, 91, 239, 190, 9, 185, 119, 114, 231, 178, 84, 183, 42, 199, 115, 144, 102, 32, 14, 81, 237, 248, 124, 143, 46, 244, 18, 198, 43, 131, 205, 172, 203, 59, 196, 78, 192, 105, 54, 98, 2, 174, 136, 252, 170, 66, 8, 166, 69, 87, 211, 154, 189, 225, 35, 141, 146, 74, 17, 137, 116, 107, 145, 251, 254, 201, 1, 234, 27, 247, 206};

  public Unwrapper() {
  }

  public static String unwrap(String wrapped) throws DataFormatException, IOException, NoSuchAlgorithmException {
    String wrappedUnix = wrapped.replace("\r\n", "\n");
    Pattern lengthPattern = Pattern.compile("([\n][0-9a-f]+[ ])([0-9a-f]+[\n])");
    Matcher m = lengthPattern.matcher(wrappedUnix);
    if (!m.find(0)) {
      throw new RuntimeException("Could not unwrap this code. Most probably it was not wrapped with the Oracle 10g, 11g or 12c wrap utility.");
    } else {
      int encodedCodeLength = Integer.parseInt(m.group(2).trim(), 16);
      int expectedLength = m.end() + encodedCodeLength;
      if (expectedLength > wrappedUnix.length()) {
        throw new RuntimeException("Wrapped code seems to be truncated. Expected length of " + expectedLength + " characters but got only " + wrappedUnix.length() + ".");
      } else {
        String encoded = wrappedUnix.substring(m.end(), expectedLength);
        byte[] decoded = Base64Coder.decodeLines(encoded);
        byte[] remapped = new byte[decoded.length];

        for(int i = 0; i < decoded.length; ++i) {
          int unsignedInteger = decoded[i] & 255;
          remapped[i] = (byte)charmap[unsignedInteger];
        }

        byte[] hash = Arrays.copyOfRange(remapped, 0, 20);
        byte[] zipped = Arrays.copyOfRange(remapped, 20, remapped.length);
        byte[] calculatedHash = HashCalculator.getSHA1(zipped);
        if (!Arrays.equals(hash, calculatedHash)) {
          throw new RuntimeException("SHA-1 hash values do not match. Expected '" + HashCalculator.bytesToHex(hash) + "' but got '" + HashCalculator.bytesToHex(calculatedHash) + "'. Cannot unwrap code.");
        } else {
          byte[] unzipped = Unzipper.unzip(zipped);

          int size;
          for(size = unzipped.length; size > 0 && unzipped[size - 1] == 0; --size) {
          }

          return new String(unzipped, 0, size);
        }
      }
    }
  }
}
package com.trivadis.unwrapper.util;
导入java.io.IOException;
导入java.security.NoSuchAlgorithmException;
导入java.util.array;
导入java.util.regex.Matcher;
导入java.util.regex.Pattern;
导入java.util.zip.DataFormatException;
公共类拆封机{
私有静态int[]charmap=new int[]{61, 101, 133, 179, 24, 219, 226, 135, 241, 82, 171, 99, 75, 181, 160, 95, 125, 104, 123, 155, 36, 194, 40, 103, 138, 222, 164, 38, 30, 3, 235, 23, 111, 52, 62, 122, 63, 210, 169, 106, 15, 233, 53, 86, 31, 177, 77, 16, 120, 217, 117, 246, 188, 65, 4, 129, 97, 6, 249, 173, 214, 213, 41, 126, 134, 158, 121, 229, 5, 186, 132, 204, 110, 39, 142, 176, 93, 168, 243, 159, 208, 162, 113, 184, 88, 221, 44, 56, 153, 76, 72, 7, 85, 228, 83, 140, 70, 182, 45, 165, 175, 50, 34, 64, 220, 80, 195, 161, 37, 139, 156, 22, 96, 92, 207, 253, 12, 152, 28, 212, 55, 109, 60, 58, 48, 232, 108, 49, 71, 245, 51, 218, 67, 200, 227, 94, 25, 148, 236, 230, 163, 149, 20, 224, 157, 100, 250, 89, 21, 197, 47, 202, 187, 11, 223, 242, 151, 191, 10, 118, 180, 73, 68, 90, 29, 240, 0, 150, 33, 128, 127, 26, 130, 57, 79, 193, 167, 215, 13, 209, 216, 255, 19, 147, 112, 238, 91, 239, 190, 9, 185, 119, 114, 231, 178, 84, 183, 42, 199, 115, 144, 102, 32, 14, 81, 237, 248, 124, 143, 46, 244, 18, 198, 43, 131, 205, 172, 203, 59, 196, 78, 192, 105, 54, 98, 2, 174, 136, 252, 170, 66, 8, 166, 69, 87, 211, 154, 189, 225, 35, 141, 146, 74, 17, 137, 116, 107, 145, 251, 254, 201, 1, 234, 27, 247, 206};
公共拆封机(){
}
公共静态字符串展开(字符串包装)抛出DataFormatException、IOException、NoSuchAlgorithmException{
字符串wrappedUnix=wrapped.replace(“\r\n”,“\n”);
模式长度模式=模式。编译(([\n][0-9a-f]+[])([0-9a-f]+[\n]);
匹配器m=长度模式匹配器(wrappedUnix);
如果(!m.find(0)){
抛出新的RuntimeException(“无法打开此代码。很可能它没有使用Oracle 10g、11g或12c wrap实用程序进行包装。”);
}否则{
int encodedCodeLength=Integer.parseInt(m.group(2.trim(),16);
int expectedLength=m.end()+encodedCodeLength;
if(expectedLength>wrappedUnix.length()){
抛出新的RuntimeException(“包装的代码似乎被截断。预期长度为“+expectedLength+”个字符,但仅获得“+wrappedUnix.length()+”);
}否则{
字符串编码=wrappedUnix.substring(m.end(),expectedLength);
字节[]解码=base64编码器。解码行(编码);
字节[]重新映射=新字节[已解码.length];
对于(int i=0;i0&&unzip[size-1]==0;--size){
}
返回新字符串(解压缩,0,大小);
}
}
}
}
}

wrap是文件的单向加密过程。没有解包功能谢谢@Tejash。既然没有解包功能,有没有其他方法可以解包大容量包文件?使用此页面:谢谢,@WernfriedDomscheit。此网页将帮助我们解包单个包文件。但我有100多个包要解包。还有We’有什么方法可以打开批量包或脚本/代码吗?网页非常简单,我认为编写HTML调用脚本应该没什么大不了的。