Zautomatyzuj proces obfuskacji kodów źródłowych Java, wykorzystując dedykowany interfejs Web API JObfuscatora dla PHP, Pythona, JavaScript (npm), Rust i C# (.NET / NuGet).
Możesz skorzystać ze wszystkich opcji JObfuscatora poprzez interfejs Web API. Web API bazuje na prostym zapytaniu POST i odpowiedzi zakodowanej w postaci JSON.
W celu szybszego wdrożenia, paczki instalacyjne interfejsu Web API JObfuscatora zostały wgrane na popularne repozytoria (Packagist, PyPI, npm, crates.io, NuGet), a ich kody źródłowe zostały dodatkowo opublikowane na GitHubie:
| Repozytorium | Język | Instalacja | Paczka | Źródła |
|---|---|---|---|---|
![]() |
PHP | Uruchom komendę:
lub dodaj do sekcji |
Packagist | GitHub |
![]() |
Python | pip install jobfuscator |
PyPI | GitHub |
![]() |
JavaScript | Uruchom:
lub dodaj w pliku |
npm | GitHub |
![]() |
Rust | Uruchom:
lub dodaj w pliku |
Crates | GitHub |
![]() |
C# | Uruchom:
lub dodaj w pliku |
NuGet | GitHub |
<?php
/******************************************************************************
* Przykład użycia JObfuscatora poprzez interfejs WebApi
*
* W tym przykładzie kod Javy poddany zostanie obfuskacji z domyślnymi opcjami.
*
* Version : v1.04
* Language : PHP
* Author : Bartosz Wójcik
* Web page : https://www.pelock.com
*
*****************************************************************************/
//
// załącz klasę JObfuscator
//
use PELock\JObfuscator;
//
// jeśli nie chcesz użyć Composera wykorzystaj include_once
//
//include_once "JObfuscator.php";
//
// utwórz instancję klasy JObfuscator (do inicjalizacji wykorzystamy nasz klucz aktywacyjny)
//
$myJObfuscator = new PELock\JObfuscator("ABCD-ABCD-ABCD-ABCD");
//
// kod źródłowy w języku Java
//
$sourceCode = 'import java.util.*;
import java.lang.*;
import java.io.*;
//
// dodaj adnotację @Obfuscate do kodu,
// aby włączyć obfuskację na poziomie
// całej klasy lub pojedynczej metody
//
@Obfuscate
class Ideone
{
//@Obfuscate
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
//
// poszczególne strategie obfuskacji
// mogą być włączane lub wyłączane
// na poziomie całej klasy lub
// pojedyncznej metody (domyślnie
// wszystkie strategie obfuskacyjne
// są włączone jeśli użyta jest
// sama adnotacja @Obfuscate bez
// wyszczególnionych strategii)
//
//@Obfuscate(
// ints_math_crypt = true,
// dbls_math_crypt = true,
// string_split = true,
// crypt_strings = true,
// string_char_vault = true,
// rename_methods = false,
// rename_variables = true,
// shuffle_methods = true,
// array_int_crypt = true,
// array_double_crypt = true,
// array_char_crypt = true,
// array_string_crypt = true,
// mix_code_flow = true,
// ints_from_double_math = true,
// opaque_mixer_chain = true,
// complexify_booleans = true,
// try_finally_noise = true,
// ints_to_arrays = true,
// dbls_to_arrays = true
// )
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
}';
//
// domyślnie wszystkie opcje obfuskacji są włączone, więc wystarczy wywołać funkcję
//
$result = $myJObfuscator->ObfuscateJavaSource($sourceCode);
//
// możliwa jest również obfuskacja pliku z kodem źródłowym Javy np.
//
// $result = $myJObfuscator->ObfuscateJavaFile("/path/to/project/source.java");
//
// $result[] tablica zawiera wynikowy kod po obfuskacji oraz dodatkowe informacje
//
// $result["error"] - kod błędu
// $result["output"] - zobfuskowany kod
// $result["demo"] - flaga określająca czy użyty był tryb demonstracyjny (albo błędny lub pusty klucz licencyjny)
// $result["credits_left"] - pozostała liczba kredytów użycia po wykonanej operacji
// $result["credits_total"] - całkowita liczba kredytów użycia dla tego kodu aktywacyjnego
// $result["expired"] - jeśli był wykorzystany ostatni kredyt użycia dla kodu aktywacyjnego flaga będzie ustawiona na true
//
if ($result !== false)
{
// wyświetl zobfuskowany kod Javy
if ($result["error"] === \PELock\JObfuscator::ERROR_SUCCESS)
{
// formatuj wyjściowy kod do formatu HTML
echo "<pre>" . htmlentities($result["output"]) . "</pre>";
}
else
{
die("Wystąpił błąd, kod błędu:" . $result["error"]);
}
}
else
{
die("Wystąpił niespodziewany błąd podczas próby obfuskacji kodu Javy.");
}
?>
#!/usr/bin/env python
###############################################################################
#
# Przykład użycia JObfuscatora poprzez interfejs WebApi
#
# W tym przykładzie kod Javy poddany zostanie obfuskacji z domyślnymi opcjami.
#
# Version : v1.04
# Language : Python
# Author : Bartosz Wójcik
# Web page : https://www.pelock.com
#
###############################################################################
#
# załącz modul JObfuscator
#
from jobfuscator import JObfuscator
#
# jeśli nie chcesz użyć modułu Pythona, możesz go po prostu zaimportować z pliku
#
#from pelock.jobfuscator import JObfuscator
#
# utwórz instancję klasy JObfuscator (do inicjalizacji wykorzystamy nasz klucz aktywacyjny)
#
myJObfuscator = JObfuscator("ABCD-ABCD-ABCD-ABCD")
#
# kod źródłowy w języku Java
#
sourceCode = """import java.util.*;
import java.lang.*;
import java.io.*;
//
// dodaj adnotację @Obfuscate do kodu,
// aby włączyć obfuskację na poziomie
// całej klasy lub pojedynczej metody
//
@Obfuscate
class Ideone
{
//@Obfuscate
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
//
// poszczególne strategie obfuskacji
// mogą być włączane lub wyłączane
// na poziomie całej klasy lub
// pojedyncznej metody (domyślnie
// wszystkie strategie obfuskacyjne
// są włączone jeśli użyta jest
// sama adnotacja @Obfuscate bez
// wyszczególnionych strategii)
//
//@Obfuscate(
// ints_math_crypt = true,
// dbls_math_crypt = true,
// string_split = true,
// crypt_strings = true,
// string_char_vault = true,
// rename_methods = false,
// rename_variables = true,
// shuffle_methods = true,
// array_int_crypt = true,
// array_double_crypt = true,
// array_char_crypt = true,
// array_string_crypt = true,
// mix_code_flow = true,
// ints_from_double_math = true,
// opaque_mixer_chain = true,
// complexify_booleans = true,
// try_finally_noise = true,
// ints_to_arrays = true,
// dbls_to_arrays = true
// )
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
}"""
#
# domyślnie wszystkie opcje obfuskacji są włączone, więc wystarczy wywołać funkcję
#
result = myJObfuscator.obfuscate_java_source(sourceCode)
#
# możliwa jest również obfuskacja pliku z kodem źródłowym Javy np.
#
# result = myJObfuscator.obfuscate_java_file("/path/to/project/source.java")
#
# result[] tablica zawiera wynikowy kod po obfuskacji oraz dodatkowe informacje
#
# result["error"] - kod błędu
# result["output"] - zobfuskowany kod
# result["demo"] - flaga określająca czy użyty był tryb demonstracyjny (albo błędny lub pusty klucz licencyjny)
# result["credits_left"] - pozostała liczba kredytów użycia po wykonanej operacji
# result["credits_total"] - całkowita liczba kredytów użycia dla tego kodu aktywacyjnego
# result["expired"] - jeśli był wykorzystany ostatni kredyt użycia dla kodu aktywacyjnego flaga będzie ustawiona na true
#
if result and "error" in result:
# wyświetl zobfuskowany kod Javy
if result["error"] == JObfuscator.ERROR_SUCCESS:
# formatuj wyjściowy kod do formatu HTML
print(result["output"])
else:
print(f'Wystąpił błąd, kod błędu:{result["error"]}')
else:
print("Wystąpił niespodziewany błąd podczas próby obfuskacji kodu Javy.")
/******************************************************************************
* JObfuscator WebApi interface usage example.
*
* In this example we will obfuscate sample source with default options.
*
* Version : v1.0.0
* Language : JavaScript
* Author : Bartosz Wójcik
* Web page : https://www.pelock.com
*
*****************************************************************************/
import JObfuscator from "jobfuscator";
//
// include JObfuscator class
//
//
// if you don't want to use npm use import from a local copy
//
// import JObfuscator from "./jobfuscator.js";
//
// create JObfuscator class instance (we are using our activation key)
//
const myJObfuscator = new JObfuscator("ABCD-ABCD-ABCD-ABCD");
//
// source code in Java format
//
const sourceCode = `import java.util.*;
import java.lang.*;
import java.io.*;
//
// you must include custom annotation
// to enable entire class or a single
// method obfuscation
//
@Obfuscate
class Ideone
{
//@Obfuscate
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
//
// selective obfuscation strategies
// can be applied for the entire
// class or a single method (by
// default all obfuscation strategies
// are enabled when you use @Obfuscate
// annotation alone)
//
//@Obfuscate(
// ints_math_crypt = true,
// dbls_math_crypt = true,
// string_split = true,
// crypt_strings = true,
// string_char_vault = true,
// rename_methods = false,
// rename_variables = true,
// shuffle_methods = true,
// array_int_crypt = true,
// array_double_crypt = true,
// array_char_crypt = true,
// array_string_crypt = true,
// mix_code_flow = true,
// ints_from_double_math = true,
// opaque_mixer_chain = true,
// complexify_booleans = true,
// try_finally_noise = true,
// ints_to_arrays = true,
// dbls_to_arrays = true
// )
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
}`;
//
// by default all obfuscation options are enabled, so we can just simply call:
//
const result = await myJObfuscator.obfuscateJavaSource(sourceCode);
//
// it's also possible to pass a Java source file path instead of a string e.g.
//
// const result = await myJObfuscator.obfuscateJavaFile("/path/to/project/source.java");
//
// result object holds the obfuscation results as well as other information
//
// result.error - error code
// result.output - obfuscated code
// result.demo - was it used in demo mode (invalid or empty activation key was used)
// result.credits_left - usage credits left after this operation
// result.credits_total - total number of credits for this activation code
// result.expired - if this was the last usage credit for the activation key it will be set to true
//
if (result !== null) {
//
// display obfuscated code
//
if (result.error === JObfuscator.ERROR_SUCCESS) {
console.log(result.output);
} else {
throw new Error("An error occurred, error code: " + result.error);
}
} else {
throw new Error("Something unexpected happen while trying to obfuscate the code.");
}
/******************************************************************************
* JObfuscator WebApi interface usage example.
*
* In this example we will obfuscate sample source with default options.
*
* Version : v1.0.0
* Language : Rust
* Author : Bartosz Wójcik
* Web page : https://www.pelock.com
*
*****************************************************************************/
use jobfuscator::{JObfuscator, JObfuscatorResponse};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
//
// include JObfuscator class
//
//
// if you don't want to use crates.io use a path dependency in Cargo.toml
//
// jobfuscator = { path = "../jobfuscator" }
//
// create JObfuscator class instance (we are using our activation key)
//
let my_jobfuscator = JObfuscator::new(Some("ABCD-ABCD-ABCD-ABCD".to_string()));
//
// source code in Java format
//
let source_code = r#"import java.util.*;
import java.lang.*;
import java.io.*;
//
// you must include custom annotation
// to enable entire class or a single
// method obfuscation
//
@Obfuscate
class Ideone
{
//@Obfuscate
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
//
// selective obfuscation strategies
// can be applied for the entire
// class or a single method (by
// default all obfuscation strategies
// are enabled when you use @Obfuscate
// annotation alone)
//
//@Obfuscate(
// ints_math_crypt = true,
// dbls_math_crypt = true,
// string_split = true,
// crypt_strings = true,
// string_char_vault = true,
// rename_methods = false,
// rename_variables = true,
// shuffle_methods = true,
// array_int_crypt = true,
// array_double_crypt = true,
// array_char_crypt = true,
// array_string_crypt = true,
// mix_code_flow = true,
// ints_from_double_math = true,
// opaque_mixer_chain = true,
// complexify_booleans = true,
// try_finally_noise = true,
// ints_to_arrays = true,
// dbls_to_arrays = true
// )
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
}"#;
//
// by default all obfuscation options are enabled, so we can just simply call:
//
let result = my_jobfuscator
.obfuscate_java_source(source_code, true)
.await;
//
// it's also possible to pass a Java source file path instead of a string e.g.
//
// let result = my_jobfuscator
// .obfuscate_java_file(std::path::Path::new("/path/to/project/source.java"), true)
// .await;
//
// result object holds the obfuscation results as well as other information
//
// result.error - error code
// result.output - obfuscated code
// result.demo - was it used in demo mode (invalid or empty activation key was used)
// result.credits_left - usage credits left after this operation
// result.credits_total - total number of credits for this activation code
// result.expired - if this was the last usage credit for the activation key it will be set to true
//
match result {
Some(JObfuscatorResponse::Object(obj)) => {
//
// display obfuscated code
//
if obj.error == JObfuscator::ERROR_SUCCESS {
println!("{}", obj.output.unwrap_or_default());
} else {
return Err(format!("An error occurred, error code: {}", obj.error).into());
}
}
Some(JObfuscatorResponse::Json(_)) => {}
None => {
return Err("Something unexpected happen while trying to obfuscate the code.".into());
}
}
Ok(())
}
/******************************************************************************
* JObfuscator WebApi interface usage example.
*
* In this example we will obfuscate sample source with default options.
*
* Version : v1.0.0
* Language : C#
* Author : Bartosz Wójcik
* Web page : https://www.pelock.com
*
* NuGet PackageReference Include="JObfuscator"
* Sources : https://github.com/PELock/JObfuscator-CSharp
*
*****************************************************************************/
using PELock;
//
// create JObfuscator class instance (we are using our activation key)
//
var myJObfuscator = new JObfuscator("ABCD-ABCD-ABCD-ABCD");
//
// source code in Java format
//
const string SourceCode =
"""
import java.util.*;
import java.lang.*;
import java.io.*;
//
// you must include custom annotation
// to enable entire class or a single
// method obfuscation
//
@Obfuscate
class Ideone
{
//@Obfuscate
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
//
// selective obfuscation strategies
// can be applied for the entire
// class or a single method (by
// default all obfuscation strategies
// are enabled when you use @Obfuscate
// annotation alone)
//
//@Obfuscate(
// ints_math_crypt = true,
// dbls_math_crypt = true,
// string_split = true,
// crypt_strings = true,
// string_char_vault = true,
// rename_methods = false,
// rename_variables = true,
// shuffle_methods = true,
// array_int_crypt = true,
// array_double_crypt = true,
// array_char_crypt = true,
// array_string_crypt = true,
// mix_code_flow = true,
// ints_from_double_math = true,
// opaque_mixer_chain = true,
// complexify_booleans = true,
// try_finally_noise = true,
// ints_to_arrays = true,
// dbls_to_arrays = true
// )
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
}
""";
//
// by default all obfuscation options are enabled, so we can just simply call:
//
var result = await myJObfuscator.ObfuscateJavaSourceAsync(SourceCode);
//
// it's also possible to pass a Java source file path instead of a string e.g.
//
// var result = await myJObfuscator.ObfuscateJavaFileAsync("/path/to/project/source.java");
//
// result object holds the obfuscation results as well as other information
//
// result?.Error - error code (see JObfuscator.Error*)
// result?.Output - obfuscated code
// result?.Demo - was it used in demo mode (invalid or empty activation key was used)
// result?.CreditsLeft - usage credits left after this operation
// result?.CreditsTotal - total number of credits for this activation code
// result?.Expired - if this was the last usage credit for the activation key it will be set to true
//
if (result is not null)
{
//
// display obfuscated code
//
if (result.Error == JObfuscator.ErrorSuccess && result.Output is not null)
Console.WriteLine(result.Output);
else
throw new InvalidOperationException("An error occurred, error code: " + result.Error);
}
else
{
throw new InvalidOperationException("Something unexpected happen while trying to obfuscate the code.");
}
<?php
/******************************************************************************
* Przykład użycia JObfuscatora poprzez interfejs WebApi
*
* W tym przykładzie kod Javy poddany zostanie obfuskacji z własnymi opcjami.
*
* Version : v1.04
* Language : PHP
* Author : Bartosz Wójcik
* Web page : https://www.pelock.com
*
*****************************************************************************/
//
// załącz klasę JObfuscator
//
use PELock\JObfuscator;
//
// jeśli nie chcesz użyć Composera wykorzystaj include_once
//
//include_once "JObfuscator.php";
//
// utwórz instancję klasy JObfuscator (do inicjalizacji wykorzystamy nasz klucz aktywacyjny)
//
$myJObfuscator = new PELock\JObfuscator("ABCD-ABCD-ABCD-ABCD");
//
// czy kod źródłowy powinien być kompresowany (wejściowy i wyjściowy)
//
$myJObfuscator->enableCompression = true;
//
// global obfuscation options
//
// when disabled will discard any @Obfuscate annotation declaration
// in the Java source code
//
// you can disable a particular obfuscation strategy globally if it
// fails or you don't want to use it without modifying the source codes
//
// by default all obfuscation strategies are enabled
//
//
// zmień linearną ścieżkę wykonywania kodu na nielinearną wersję
//
$myJObfuscator->mixCodeFlow = true;
//
// zmień nazwy zmiennych na losowe ciągi znakowe
//
$myJObfuscator->renameVariables = true;
//
// zmień nazwy metod na losowe ciągi znakowe
//
$myJObfuscator->renameMethods = true;
//
// wymieszaj położenie wszystkich metod w wyjściowym kodzie
//
$myJObfuscator->shuffleMethods = true;
//
// szyfruj tablice int/double/char/String z dekodowaniem w czasie działania
//
$myJObfuscator->arrayIntCrypt = true;
$myJObfuscator->arrayDoubleCrypt = true;
$myJObfuscator->arrayCharCrypt = true;
$myJObfuscator->arrayStringCrypt = true;
//
// szyfruj wartości typu integer wykorzystując ponad 15 zmiennoprzecinkowych funkcji matematycznych z klasy java.lang.Math.*
//
$myJObfuscator->intsMathCrypt = true;
//
// szyfruj wartości typu double z użyciem funkcji z klasy java.lang.Math.*
//
$myJObfuscator->dblsMathCrypt = true;
//
// dziel literały tekstowe na łańcuchy String.concat(...) przed opcjonalnym szyfrowaniem
//
$myJObfuscator->stringSplit = true;
//
// zaszyfruj ciągi tekstowe wykorzystując losowo wygenerowane algorytmy polimorficzne
//
$myJObfuscator->cryptStrings = true;
//
// odtwarzaj literały tekstowe z ukrytych tablic typu char
//
$myJObfuscator->stringCharVault = true;
//
// reprezentuj wybrane wartości integer przez wyrażenia typu double
//
$myJObfuscator->intsFromDoubleMath = true;
//
// wstrzykuj łańcuchy mieszające i nieosiągalne warunki
//
$myJObfuscator->opaqueMixerChain = true;
//
// zastępuj literały true/false równoważnymi wyrażeniami
//
$myJObfuscator->complexifyBooleans = true;
//
// dodawaj szumne bloki try/finally przy wybranych instrukcjach
//
$myJObfuscator->tryFinallyNoise = true;
//
// dla każdej metody wyekstrahuj wszystkie możliwe wartości typu integer i przenieś je do tablicy
//
$myJObfuscator->intsToArrays = true;
//
// dla każdej metody wyekstrahuj wszystkie możliwe wartości typu double i przenieś je do tablicy
//
$myJObfuscator->dblsToArrays = true;
//
// kod źródłowy w języku Java
//
$sourceCode = 'import java.util.*;
import java.lang.*;
import java.io.*;
//
// dodaj adnotację @Obfuscate do kodu,
// aby włączyć obfuskację na poziomie
// całej klasy lub pojedynczej metody
//
@Obfuscate
class Ideone
{
//@Obfuscate
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
//
// poszczególne strategie obfuskacji
// mogą być włączane lub wyłączane
// na poziomie całej klasy lub
// pojedyncznej metody (domyślnie
// wszystkie strategie obfuskacyjne
// są włączone jeśli użyta jest
// sama adnotacja @Obfuscate bez
// wyszczególnionych strategii)
//
//@Obfuscate(
// ints_math_crypt = true,
// dbls_math_crypt = true,
// string_split = true,
// crypt_strings = true,
// string_char_vault = true,
// rename_methods = false,
// rename_variables = true,
// shuffle_methods = true,
// array_int_crypt = true,
// array_double_crypt = true,
// array_char_crypt = true,
// array_string_crypt = true,
// mix_code_flow = true,
// ints_from_double_math = true,
// opaque_mixer_chain = true,
// complexify_booleans = true,
// try_finally_noise = true,
// ints_to_arrays = true,
// dbls_to_arrays = true
// )
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
}';
//
// domyślnie wszystkie opcje obfuskacji są włączone, więc wystarczy wywołać funkcję
//
$result = $myJObfuscator->ObfuscateJavaSource($sourceCode);
//
// możliwa jest również obfuskacja pliku z kodem źródłowym Javy np.
//
// $result = $myJObfuscator->ObfuscateJavaFile("/path/to/project/source.java");
//
// $result[] tablica zawiera wynikowy kod po obfuskacji oraz dodatkowe informacje
//
// $result["error"] - kod błędu
// $result["output"] - zobfuskowany kod
// $result["demo"] - flaga określająca czy użyty był tryb demonstracyjny (albo błędny lub pusty klucz licencyjny)
// $result["credits_left"] - pozostała liczba kredytów użycia po wykonanej operacji
// $result["credits_total"] - całkowita liczba kredytów użycia dla tego kodu aktywacyjnego
// $result["expired"] - jeśli był wykorzystany ostatni kredyt użycia dla kodu aktywacyjnego flaga będzie ustawiona na true
//
if ($result !== false)
{
// wyświetl zobfuskowany kod Javy
if ($result["error"] === \PELock\JObfuscator::ERROR_SUCCESS)
{
// formatuj wyjściowy kod do formatu HTML
echo "<pre>" . htmlentities($result["output"]) . "</pre>";
}
else
{
die("Wystąpił błąd, kod błędu:" . $result["error"]);
}
}
else
{
die("Wystąpił niespodziewany błąd podczas próby obfuskacji kodu Javy.");
}
?>
#!/usr/bin/env python
###############################################################################
#
# Przykład użycia JObfuscatora poprzez interfejs WebApi
#
# W tym przykładzie kod Javy poddany zostanie obfuskacji z własnymi opcjami.
#
# Version : v1.04
# Language : Python
# Author : Bartosz Wójcik
# Web page : https://www.pelock.com
#
###############################################################################
#
# załącz modul JObfuscator
#
from jobfuscator import JObfuscator
#
# jeśli nie chcesz użyć modułu Pythona, możesz go po prostu zaimportować z pliku
#
#from pelock.jobfuscator import JObfuscator
#
# utwórz instancję klasy JObfuscator (do inicjalizacji wykorzystamy nasz klucz aktywacyjny)
#
myJObfuscator = JObfuscator("ABCD-ABCD-ABCD-ABCD")
#
# global obfuscation options
#
# when disabled will discard any @Obfuscate annotation declaration
# in the Java source code
#
# you can disable a particular obfuscation strategy globally if it
# fails or you don't want to use it without modifying the source codes
#
# by default all obfuscation strategies are enabled
#
#
# czy kod źródłowy powinien być kompresowany (wejściowy i wyjściowy)
#
myJObfuscator.enableCompression = True
#
# zmień linearną ścieżkę wykonywania kodu na nielinearną wersję
#
myJObfuscator.mixCodeFlow = True
#
# zmień nazwy zmiennych na losowe ciągi znakowe
#
myJObfuscator.renameVariables = True
#
# zmień nazwy metod na losowe ciągi znakowe
#
myJObfuscator.renameMethods = True
#
# wymieszaj położenie wszystkich metod w wyjściowym kodzie
#
myJObfuscator.shuffleMethods = True
#
# encrypt int/double/char/string array literals with runtime decryption
#
myJObfuscator.arrayIntCrypt = True
myJObfuscator.arrayDoubleCrypt = True
myJObfuscator.arrayCharCrypt = True
myJObfuscator.arrayStringCrypt = True
#
# encrypt integers using more than 15 floating point math functions from the java.lang.Math.* class
#
myJObfuscator.intsMathCrypt = True
#
# encrypt doubles using floating point math functions from the java.lang.Math.* class
#
myJObfuscator.dblsMathCrypt = True
#
# split string literals into nested String.concat(...) chains before string encryption
#
myJObfuscator.stringSplit = True
#
# encrypt strings using polymorphic encryption algorithms
#
myJObfuscator.cryptStrings = True
#
# rebuild string literals from hidden char arrays
#
myJObfuscator.stringCharVault = True
#
# express selected integers through equivalent double math expressions
#
myJObfuscator.intsFromDoubleMath = True
#
# inject opaque mixer chains and unreachable guards
#
myJObfuscator.opaqueMixerChain = True
#
# replace boolean literals with equivalent runtime expressions
#
myJObfuscator.complexifyBooleans = True
#
# wrap selected statements in noisy try/finally blocks
#
myJObfuscator.tryFinallyNoise = True
#
# dla każdej metody wyekstrahuj wszystkie możliwe wartości typu integer i przenieś je do tablicy
#
myJObfuscator.intsToArrays = True
#
# dla każdej metody wyekstrahuj wszystkie możliwe wartości typu double i przenieś je do tablicy
#
myJObfuscator.dblsToArrays = True
#
# kod źródłowy w języku Java
#
sourceCode = """import java.util.*;
import java.lang.*;
import java.io.*;
//
// dodaj adnotację @Obfuscate do kodu,
// aby włączyć obfuskację na poziomie
// całej klasy lub pojedynczej metody
//
@Obfuscate
class Ideone
{
//@Obfuscate
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
//
// poszczególne strategie obfuskacji
// mogą być włączane lub wyłączane
// na poziomie całej klasy lub
// pojedyncznej metody (domyślnie
// wszystkie strategie obfuskacyjne
// są włączone jeśli użyta jest
// sama adnotacja @Obfuscate bez
// wyszczególnionych strategii)
//
//@Obfuscate(
// ints_math_crypt = true,
// dbls_math_crypt = true,
// string_split = true,
// crypt_strings = true,
// string_char_vault = true,
// rename_methods = false,
// rename_variables = true,
// shuffle_methods = true,
// array_int_crypt = true,
// array_double_crypt = true,
// array_char_crypt = true,
// array_string_crypt = true,
// mix_code_flow = true,
// ints_from_double_math = true,
// opaque_mixer_chain = true,
// complexify_booleans = true,
// try_finally_noise = true,
// ints_to_arrays = true,
// dbls_to_arrays = true
// )
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
}"""
#
# domyślnie wszystkie opcje obfuskacji są włączone, więc wystarczy wywołać funkcję
#
result = myJObfuscator.obfuscate_java_source(sourceCode)
#
# result[] tablica zawiera wynikowy kod po obfuskacji oraz dodatkowe informacje
#
# result["error"] - kod błędu
# result["output"] - zobfuskowany kod
# result["demo"] - flaga określająca czy użyty był tryb demonstracyjny (albo błędny lub pusty klucz licencyjny)
# result["credits_left"] - pozostała liczba kredytów użycia po wykonanej operacji
# result["credits_total"] - całkowita liczba kredytów użycia dla tego kodu aktywacyjnego
# result["expired"] - jeśli był wykorzystany ostatni kredyt użycia dla kodu aktywacyjnego flaga będzie ustawiona na true
#
if result and "error" in result:
# wyświetl zobfuskowany kod Javy
if result["error"] == JObfuscator.ERROR_SUCCESS:
# formatuj wyjściowy kod do formatu HTML
print(result["output"])
else:
print(f'Wystąpił błąd, kod błędu:{result["error"]}')
else:
print("Wystąpił niespodziewany błąd podczas próby obfuskacji kodu Javy.")
/******************************************************************************
* JObfuscator WebApi interface usage example.
*
* In this example we will obfuscate sample source with custom options.
*
* Version : v1.0.0
* Language : JavaScript
* Author : Bartosz Wójcik
* Web page : https://www.pelock.com
*
*****************************************************************************/
import JObfuscator from "jobfuscator";
//
// include JObfuscator class
//
//
// if you don't want to use npm use import from a local copy
//
// import JObfuscator from "./jobfuscator.js";
//
// create JObfuscator class instance (we are using our activation key)
//
const myJObfuscator = new JObfuscator("ABCD-ABCD-ABCD-ABCD");
//
// should the source code be compressed (both input & compressed)
//
myJObfuscator.enableCompression = true;
//
// global obfuscation options
//
// when disabled will discard any @Obfuscate annotation declaration
// in the Java source code
//
// you can disable a particular obfuscation strategy globally if it
// fails or you don't want to use it without modifying the source codes
//
// by default all obfuscation strategies are enabled
//
//
// change linear code execution flow to non-linear version
//
myJObfuscator.mixCodeFlow = true;
//
// rename variable names to random string values
//
myJObfuscator.renameVariables = true;
//
// rename method names to random string values
//
myJObfuscator.renameMethods = true;
//
// shuffle order of methods in the output source
//
myJObfuscator.shuffleMethods = true;
//
// encrypt int/double/char/string array literals with runtime decryption
//
myJObfuscator.arrayIntCrypt = true;
myJObfuscator.arrayDoubleCrypt = true;
myJObfuscator.arrayCharCrypt = true;
myJObfuscator.arrayStringCrypt = true;
//
// encrypt integers using more than 15 floating point math functions from the java.lang.Math.* class
//
myJObfuscator.intsMathCrypt = true;
//
// encrypt doubles using floating point math functions from the java.lang.Math.* class
//
myJObfuscator.dblsMathCrypt = true;
//
// split string literals into nested String.concat(...) chains before string encryption
//
myJObfuscator.stringSplit = true;
//
// encrypt strings using polymorphic encryption algorithms
//
myJObfuscator.cryptStrings = true;
//
// rebuild string literals from hidden char arrays
//
myJObfuscator.stringCharVault = true;
//
// express selected integers through equivalent double math expressions
//
myJObfuscator.intsFromDoubleMath = true;
//
// inject opaque mixer chains and unreachable guards
//
myJObfuscator.opaqueMixerChain = true;
//
// replace boolean literals with equivalent runtime expressions
//
myJObfuscator.complexifyBooleans = true;
//
// wrap selected statements in noisy try/finally blocks
//
myJObfuscator.tryFinallyNoise = true;
//
// for each method, extract all possible integers from the code and store them in an array
//
myJObfuscator.intsToArrays = true;
//
// for each method, extract all possible doubles from the code and store them in an array
//
myJObfuscator.dblsToArrays = true;
//
// source code in Java format
//
const sourceCode = `import java.util.*;
import java.lang.*;
import java.io.*;
//
// you must include custom annotation
// to enable entire class or a single
// method obfuscation
//
@Obfuscate
class Ideone
{
//@Obfuscate
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
//
// selective obfuscation strategies
// can be applied for the entire
// class or a single method (by
// default all obfuscation strategies
// are enabled when you use @Obfuscate
// annotation alone)
//
//@Obfuscate(
// ints_math_crypt = true,
// dbls_math_crypt = true,
// string_split = true,
// crypt_strings = true,
// string_char_vault = true,
// rename_methods = false,
// rename_variables = true,
// shuffle_methods = true,
// array_int_crypt = true,
// array_double_crypt = true,
// array_char_crypt = true,
// array_string_crypt = true,
// mix_code_flow = true,
// ints_from_double_math = true,
// opaque_mixer_chain = true,
// complexify_booleans = true,
// try_finally_noise = true,
// ints_to_arrays = true,
// dbls_to_arrays = true
// )
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
}`;
//
// by default all options are enabled, both helper random numbers
// generation & obfuscation strategies, so we can just simply call:
//
const result = await myJObfuscator.obfuscateJavaSource(sourceCode);
//
// it's also possible to pass a Java source file path instead of a string e.g.
//
// const result = await myJObfuscator.obfuscateJavaFile("/path/to/project/source.java");
//
// result object holds the obfuscation results as well as other information
//
// result.error - error code
// result.output - obfuscated code
// result.demo - was it used in demo mode (invalid or empty activation key was used)
// result.credits_left - usage credits left after this operation
// result.credits_total - total number of credits for this activation code
// result.expired - if this was the last usage credit for the activation key it will be set to true
//
if (result !== null) {
//
// display obfuscated code
//
if (result.error === JObfuscator.ERROR_SUCCESS) {
console.log(result.output);
} else {
throw new Error("An error occurred, error code: " + result.error);
}
} else {
throw new Error("Something unexpected happen while trying to obfuscate the code.");
}
/******************************************************************************
* JObfuscator WebApi interface usage example.
*
* In this example we will obfuscate sample source with custom options.
*
* Version : v1.0.0
* Language : Rust
* Author : Bartosz Wójcik
* Web page : https://www.pelock.com
*
*****************************************************************************/
use jobfuscator::{JObfuscator, JObfuscatorResponse};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
//
// include JObfuscator class
//
//
// if you don't want to use crates.io use a path dependency in Cargo.toml
//
// jobfuscator = { path = "../jobfuscator" }
//
// create JObfuscator class instance (we are using our activation key)
//
let mut my_jobfuscator = JObfuscator::new(Some("ABCD-ABCD-ABCD-ABCD".to_string()));
//
// should the source code be compressed (both input & compressed)
//
my_jobfuscator.enable_compression = true;
//
// global obfuscation options
//
// when disabled will discard any @Obfuscate annotation declaration
// in the Java source code
//
// you can disable a particular obfuscation strategy globally if it
// fails or you don't want to use it without modifying the source codes
//
// by default all obfuscation strategies are enabled
//
//
// change linear code execution flow to non-linear version
//
my_jobfuscator.mix_code_flow = true;
//
// rename variable names to random string values
//
my_jobfuscator.rename_variables = true;
//
// rename method names to random string values
//
my_jobfuscator.rename_methods = true;
//
// shuffle order of methods in the output source
//
my_jobfuscator.shuffle_methods = true;
//
// encrypt int/double/char/string array literals with runtime decryption
//
my_jobfuscator.array_int_crypt = true;
my_jobfuscator.array_double_crypt = true;
my_jobfuscator.array_char_crypt = true;
my_jobfuscator.array_string_crypt = true;
//
// encrypt integers using more than 15 floating point math functions from the java.lang.Math.* class
//
my_jobfuscator.ints_math_crypt = true;
//
// encrypt doubles using floating point math functions from the java.lang.Math.* class
//
my_jobfuscator.dbls_math_crypt = true;
//
// split string literals into nested String.concat(...) chains before string encryption
//
my_jobfuscator.string_split = true;
//
// encrypt strings using polymorphic encryption algorithms
//
my_jobfuscator.crypt_strings = true;
//
// rebuild string literals from hidden char arrays
//
my_jobfuscator.string_char_vault = true;
//
// express selected integers through equivalent double math expressions
//
my_jobfuscator.ints_from_double_math = true;
//
// inject opaque mixer chains and unreachable guards
//
my_jobfuscator.opaque_mixer_chain = true;
//
// replace boolean literals with equivalent runtime expressions
//
my_jobfuscator.complexify_booleans = true;
//
// wrap selected statements in noisy try/finally blocks
//
my_jobfuscator.try_finally_noise = true;
//
// for each method, extract all possible integers from the code and store them in an array
//
my_jobfuscator.ints_to_arrays = true;
//
// for each method, extract all possible doubles from the code and store them in an array
//
my_jobfuscator.dbls_to_arrays = true;
//
// source code in Java format
//
let source_code = r#"import java.util.*;
import java.lang.*;
import java.io.*;
//
// you must include custom annotation
// to enable entire class or a single
// method obfuscation
//
@Obfuscate
class Ideone
{
//@Obfuscate
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
//
// selective obfuscation strategies
// can be applied for the entire
// class or a single method (by
// default all obfuscation strategies
// are enabled when you use @Obfuscate
// annotation alone)
//
//@Obfuscate(
// ints_math_crypt = true,
// dbls_math_crypt = true,
// string_split = true,
// crypt_strings = true,
// string_char_vault = true,
// rename_methods = false,
// rename_variables = true,
// shuffle_methods = true,
// array_int_crypt = true,
// array_double_crypt = true,
// array_char_crypt = true,
// array_string_crypt = true,
// mix_code_flow = true,
// ints_from_double_math = true,
// opaque_mixer_chain = true,
// complexify_booleans = true,
// try_finally_noise = true,
// ints_to_arrays = true,
// dbls_to_arrays = true
// )
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
}"#;
//
// by default all options are enabled, both helper random numbers
// generation & obfuscation strategies, so we can just simply call:
//
let result = my_jobfuscator
.obfuscate_java_source(source_code, true)
.await;
//
// it's also possible to pass a Java source file path instead of a string e.g.
//
// let result = my_jobfuscator
// .obfuscate_java_file(std::path::Path::new("/path/to/project/source.java"), true)
// .await;
//
// result object holds the obfuscation results as well as other information
//
// result.error - error code
// result.output - obfuscated code
// result.demo - was it used in demo mode (invalid or empty activation key was used)
// result.credits_left - usage credits left after this operation
// result.credits_total - total number of credits for this activation code
// result.expired - if this was the last usage credit for the activation key it will be set to true
//
match result {
Some(JObfuscatorResponse::Object(obj)) => {
//
// display obfuscated code
//
if obj.error == JObfuscator::ERROR_SUCCESS {
println!("{}", obj.output.unwrap_or_default());
} else {
return Err(format!("An error occurred, error code: {}", obj.error).into());
}
}
Some(JObfuscatorResponse::Json(_)) => {}
None => {
return Err("Something unexpected happen while trying to obfuscate the code.".into());
}
}
Ok(())
}
/******************************************************************************
* Przykład użycia JObfuscator Web API z własnymi ustawieniami (C# / NuGet).
* Źródła: https://github.com/PELock/JObfuscator-CSharp
*****************************************************************************/
using PELock;
var myJObfuscator = new JObfuscator("ABCD-ABCD-ABCD-ABCD");
myJObfuscator.EnableCompression = true;
myJObfuscator.MixCodeFlow = true;
myJObfuscator.RenameVariables = true;
myJObfuscator.RenameMethods = true;
myJObfuscator.ShuffleMethods = true;
myJObfuscator.ArrayIntCrypt = true;
myJObfuscator.ArrayDoubleCrypt = true;
myJObfuscator.ArrayCharCrypt = true;
myJObfuscator.ArrayStringCrypt = true;
myJObfuscator.IntsMathCrypt = true;
myJObfuscator.DblsMathCrypt = true;
myJObfuscator.StringSplit = true;
myJObfuscator.CryptStrings = true;
myJObfuscator.StringCharVault = true;
myJObfuscator.IntsFromDoubleMath = true;
myJObfuscator.OpaqueMixerChain = true;
myJObfuscator.ComplexifyBooleans = true;
myJObfuscator.TryFinallyNoise = true;
myJObfuscator.IntsToArrays = true;
myJObfuscator.DblsToArrays = true;
const string SourceCode =
"""
import java.util.*;
import java.lang.*;
import java.io.*;
//
// you must include custom annotation
// to enable entire class or a single
// method obfuscation
//
@Obfuscate
class Ideone
{
//@Obfuscate
public static double calculateSD(double numArray[])
{
double sum = 0.0, standardDeviation = 0.0;
int length = numArray.length;
for(double num : numArray) {
sum += num;
}
double mean = sum/length;
for(double num: numArray) {
standardDeviation += Math.pow(num - mean, 2);
}
return Math.sqrt(standardDeviation/length);
}
//
// selective obfuscation strategies
// can be applied for the entire
// class or a single method (by
// default all obfuscation strategies
// are enabled when you use @Obfuscate
// annotation alone)
//
//@Obfuscate(
// ints_math_crypt = true,
// dbls_math_crypt = true,
// string_split = true,
// crypt_strings = true,
// string_char_vault = true,
// rename_methods = false,
// rename_variables = true,
// shuffle_methods = true,
// array_int_crypt = true,
// array_double_crypt = true,
// array_char_crypt = true,
// array_string_crypt = true,
// mix_code_flow = true,
// ints_from_double_math = true,
// opaque_mixer_chain = true,
// complexify_booleans = true,
// try_finally_noise = true,
// ints_to_arrays = true,
// dbls_to_arrays = true
// )
public static void main(String[] args) {
double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
double SD = calculateSD(numArray);
System.out.format("Standard Deviation = %.6f", SD);
}
}
""";
var result = await myJObfuscator.ObfuscateJavaSourceAsync(SourceCode);
if (result is not null)
{
if (result.Error == JObfuscator.ErrorSuccess && result.Output is not null)
Console.WriteLine(result.Output);
else
throw new InvalidOperationException("An error occurred, error code: " + result.Error);
}
else
{
throw new InvalidOperationException("Something unexpected happen while trying to obfuscate the code.");
}
<?php
/******************************************************************************
* Przykład użycia JObfuscatora poprzez interfejs WebApi
*
* W tym przykładzie zweryfikujemy status naszego klucza aktywacyjnego.
*
* Version : v1.04
* Language : PHP
* Author : Bartosz Wójcik
* Web page : https://www.pelock.com
*
*****************************************************************************/
//
// załącz klasę JObfuscator
//
use PELock\JObfuscator;
//
// jeśli nie chcesz użyć Composera wykorzystaj include_once
//
//include_once "JObfuscator.php";
//
// utwórz instancję klasy JObfuscator (do inicjalizacji wykorzystamy nasz klucz aktywacyjny)
//
$myJObfuscator = new PELock\JObfuscator("ABCD-ABCD-ABCD-ABCD");
//
// zaloguj się do usługi
//
$result = $myJObfuscator->Login();
//
// $result[] tablica zawiera informację o licencji
//
// $result["demo"] - czy to licencja demonstracyjna (został użyty błędny lub pusty klucz aktywacyjny)
// $result["credits_left"] - pozostała liczba kredytów użycia po wykonanej operacji
// $result["credits_total"] - całkowita liczba kredytów użycia dla tego kodu aktywacyjnego
// $result["string_limit"] - maksymalny dozwolony rozmiar kodu źródłowego (dla wersji demonstracyjnej to 1500 bajtów)
//
if ($result !== false)
{
echo "Status wersji demonstracyjnej - " . ($result["demo"] ? "true" : "false") . "<br>";
echo "Pozostałych kredytów użycia -" . $result["credits_left"] . "<br>";
echo "Całkowita liczba kredytów użycia - " . $result["credits_total"] . "<br>";
echo "Maksymalny dozwolony rozmiar kodu źródłowego - " . $result["string_limit"] . "<br>";
}
else
{
die("Wystąpił nieoczekiwany błąd podczas próby zalogowania się do usługi.");
}
?>
#!/usr/bin/env python
###############################################################################
#
# Przykład użycia JObfuscatora poprzez interfejs WebApi
#
# W tym przykładzie zweryfikujemy status naszego klucza aktywacyjnego.
#
# Version : v1.04
# Language : Python
# Author : Bartosz Wójcik
# Web page : https://www.pelock.com
#
###############################################################################
#
# załącz modul JObfuscator
#
from jobfuscator import JObfuscator
#
# jeśli nie chcesz użyć modułu Pythona, możesz go po prostu zaimportować z pliku
#
#from pelock.jobfuscator import JObfuscator
#
# utwórz instancję klasy JObfuscator (do inicjalizacji wykorzystamy nasz klucz aktywacyjny)
#
myJObfuscator = JObfuscator("ABCD-ABCD-ABCD-ABCD")
#
# login to the service
#
result = myJObfuscator.login()
#
# result[] tablica zawiera informację o licencji
#
# result["demo"] - czy to licencja demonstracyjna (został użyty błędny lub pusty klucz aktywacyjny)
# result["credits_left"] - pozostała liczba kredytów użycia po wykonanej operacji
# result["credits_total"] - całkowita liczba kredytów użycia dla tego kodu aktywacyjnego
# result["string_limit"] - maksymalny dozwolony rozmiar kodu źródłowego (dla wersji demonstracyjnej to 1500 bajtów)
#
if result:
print(f'Status wersji demonstracyjnej - {"True" if result["demo"] else "False"}')
print(f'Pozostałych kredytów użycia -{result["credits_left"]}')
print(f'Całkowita liczba kredytów użycia - {result["credits_total"]}')
print(f'Maksymalny dozwolony rozmiar kodu źródłowego - {result["string_limit"]}')
else:
print("Wystąpił nieoczekiwany błąd podczas próby zalogowania się do usługi.")
/******************************************************************************
* JObfuscator WebApi interface usage example.
*
* In this example we will verify our activation key status.
*
* Version : v1.0.0
* Language : JavaScript
* Author : Bartosz Wójcik
* Web page : https://www.pelock.com
*
*****************************************************************************/
import JObfuscator from "jobfuscator";
//
// include JObfuscator class
//
//
// if you don't want to use npm use import from a local copy
//
// import JObfuscator from "./jobfuscator.js";
//
// create JObfuscator class instance (we are using our activation key)
//
const myJObfuscator = new JObfuscator("ABCD-ABCD-ABCD-ABCD");
//
// login to the service
//
const result = await myJObfuscator.login();
//
// result object holds the information about the license
//
// result.demo - is it a demo mode (invalid or empty activation key was used)
// result.credits_left - usage credits left after this operation
// result.credits_total - total number of credits for this activation code
// result.string_limit - max. source code size allowed (it's 1500 bytes for demo mode)
//
if (result !== null) {
console.log("Demo version status - " + (result.demo ? "true" : "false"));
console.log("Usage credits left - " + result.credits_left);
console.log("Total usage credits - " + result.credits_total);
console.log("Max. source code size - " + result.string_limit);
} else {
throw new Error("Something unexpected happen while trying to login to the service.");
}
/******************************************************************************
* JObfuscator WebApi interface usage example.
*
* In this example we will verify our activation key status.
*
* Version : v1.0.0
* Language : Rust
* Author : Bartosz Wójcik
* Web page : https://www.pelock.com
*
*****************************************************************************/
use jobfuscator::{JObfuscator, JObfuscatorResponse};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
//
// include JObfuscator class
//
//
// if you don't want to use crates.io use a path dependency in Cargo.toml
//
// jobfuscator = { path = "../jobfuscator" }
//
// create JObfuscator class instance (we are using our activation key)
//
let my_jobfuscator = JObfuscator::new(Some("ABCD-ABCD-ABCD-ABCD".to_string()));
//
// login to the service
//
let result = my_jobfuscator.login(true).await;
//
// result object holds the information about the license
//
// result.demo - is it a demo mode (invalid or empty activation key was used)
// result.credits_left - usage credits left after this operation
// result.credits_total - total number of credits for this activation code
// result.string_limit - max. source code size allowed (it's 1500 bytes for demo mode)
//
match result {
Some(JObfuscatorResponse::Object(obj)) => {
println!(
"Demo version status - {}",
if obj.demo.unwrap_or(false) {
"true"
} else {
"false"
}
);
println!(
"Usage credits left - {}",
obj.credits_left.unwrap_or(0)
);
println!(
"Total usage credits - {}",
obj.credits_total.unwrap_or(0)
);
println!(
"Max. source code size - {}",
obj.string_limit.unwrap_or(0)
);
}
Some(JObfuscatorResponse::Json(_)) => {}
None => {
return Err("Something unexpected happen while trying to login to the service.".into());
}
}
Ok(())
}
/******************************************************************************
* JObfuscator WebApi interface usage example — login (C# / NuGet).
* Sources: https://github.com/PELock/JObfuscator-CSharp
*****************************************************************************/
using PELock;
var myJObfuscator = new JObfuscator("ABCD-ABCD-ABCD-ABCD");
var result = await myJObfuscator.LoginAsync();
if (result is not null)
{
Console.WriteLine("Demo version status - " + (result.Demo == true ? "true" : "false"));
Console.WriteLine("Usage credits left - " + result.CreditsLeft);
Console.WriteLine("Total usage credits - " + result.CreditsTotal);
Console.WriteLine("Max. source code size - " + result.StringLimit);
}
else
{
throw new InvalidOperationException("Something unexpected happen while trying to login to the service.");
}
$result["error"] [wyj]| Nazwa | Wartość | Opis |
|---|---|---|
| ERROR_SUCCESS | 0 |
Wszystko się udało. |
| ERROR_INPUT_SIZE | 1 |
Kod źródłowy jest zbyt duży. Najczęściej zwracana wartość w przypadku działania w trybie demo (limit 2000 znaków). |
| ERROR_INPUT | 2 |
Uszkodzony wejściowy kod źródłowy, sprawdź składnię. |
| ERROR_PARSING | 3 |
Błąd parsowania kodu źródłowego Java. |
| ERROR_OBFUSCATION | 4 |
Błąd obfuskacji sparsowanego już kodu źródłowego. |
| ERROR_OUTPUT | 5 |
Błąd podczas generowania zobfuskowanego kodu wyjściowego. |
$result["output"] [wyj, opcjonalnie]$result["demo"] [wyj]$result["credits_left"] [wyj]$result["credits_total"] [wyj]$result["expired"] [wyj, opcjonalnie]true oznacza to, że kod aktywacyjny wygasł (było to jego ostatnie wykorzystanie).$result["string_limit"] [wyj, opcjonalnie]| Biblioteka PHP | JObfuscator |
| Moduł dla Pythona 3 | JObfuscator |
| JavaScript (npm) | JObfuscator |
| Crate Rust | JObfuscator |
| Pakiet NuGet (C# / .NET) | JObfuscator |
Jeśli masz jakieś pytania dotyczące obfuskatora JObfuscator, masz jakieś uwagi, coś jest niejasne, napisz do mnie, chętnie odpowiem na każde Twoje pytanie.