Code not being encrypted
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- javascript, react-native
- Bereich
- build-system, mobile-dev
Rechercherichtung
Beginne mit metro.config.js und transformer.js und führe dann den dokumentierten Befehl npx react-native bundle mit den angegebenen React Native- und Transformer-Versionen aus. Vergleiche die Transformer-Logs, die generierte bundle.js und die obfuskierten Dateien mit dem Beispiel screens.js. Erledigt ist die Aufgabe, wenn die konfigurierten Quelldateien im ausgegebenen Bundle sichtbar obfuskierte Bezeichner und Aufrufe erzeugen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
I have spent a good while playing around with multiple options and examples and can't seem to get it to work. My setup is the following:
"metro-react-native-babel-preset": "0.56.0",
"metro-react-native-babel-transformer": "^0.59.0",
"react-native-obfuscating-transformer": "^1.0.0",
"react-native": "^0.61.0",
metro.config.js
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
module.exports = {
transformer: {
babelTransformerPath: require.resolve("./transformer"),
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
transformer.js
const obfuscatingTransformer = require("react-native-obfuscating-transformer")
const filter = filename => {
return filename.startsWith("src");
};
module.exports = obfuscatingTransformer({
// this configuration is based on https://github.com/javascript-obfuscator/javascript-obfuscator
obfuscatorOptions:{
compact: true,
controlFlowFlattening: false,
deadCodeInjection: false,
debugProtection: false,
debugProtectionInterval: false,
disableConsoleOutput: true,
identifierNamesGenerator: 'hexadecimal',
log: false,
renameGlobals: false,
rotateStringArray: true,
selfDefending: true,
shuffleStringArray: true,
splitStrings: false,
stringArray: true,
stringArrayEncoding: false,
stringArrayThreshold: 0.75,
unicodeEscapeSequence: false
},
upstreamTransformer: require('metro-react-native-babel-transformer'),
emitObfuscatedFiles: false,
enableInDevelopment: true,
filter: filter,
trace: true
})
The command I am using to build the output js bundle for testing is the following:
npx react-native bundle --entry-file=index.js --bundle-output='./bundle.js' --dev=false --platform='ios' --assets-dest='./ios' --reset-cache
I can see the output from stdout of the transformer logging which files are being obfuscated, however when I look at the entire bundle and even the sub obfuscated files, the variable names and function calls are not encrypted.
Below is an example of a before and after obfuscation:
Before (screens.js):
import { Navigation } from 'react-native-navigation';
import { Provider } from 'react-redux';
import firebase from 'react-native-firebase';
const crashlytics = firebase.crashlytics();
import configureStore from 'app/store';
// Initialise global store
export const store = configureStore()
export function registerScreens() {
crashlytics.enableCrashlyticsCollection();
crashlytics.log('[utils][screens] - Registering screens...');
// Register screens with redux stores
Navigation.registerComponentWithRedux('Initialising', () => require('screens/Initialising').default, Provider, store);
Navigation.registerComponentWithRedux('Auth', () => require('screens/Auth').default, Provider, store);
Navigation.registerComponentWithRedux('VerifyPhoneNumber', () => require('screens/VerifyPhoneNumber').default, Provider, store);
Navigation.registerComponentWithRedux('SignIn', () => require('screens/SignIn').default, Provider, store);
// Profile Stack
Navigation.registerComponentWithRedux('Profile', () => require('screens/Profile').default, Provider, store);
Navigation.registerComponentWithRedux('QRScanner', () => require('screens/Profile/QRScanner').default, Provider, store);
// Register Stack
Navigation.registerComponentWithRedux('InitialRegister', () => require('screens/Register/InitialRegister').default, Provider, store);
Navigation.registerComponentWithRedux('RegisterDetails', () => require('screens/Register/RegisterDetails').default, Provider, store);
// Rewards Stack
Navigation.registerComponentWithRedux('Rewards', () => require('screens/Rewards').default, Provider, store);
Navigation.registerComponentWithRedux('RewardBack', () => require('screens/Rewards/RewardBack').default, Provider, store);
Navigation.registerComponentWithRedux('RewardRedeemed', () => require('screens/Rewards/RewardRedeemed').default, Provider, store);
// Home stack
Navigation.registerComponentWithRedux('Home', () => require('screens/Home').default, Provider, store);
// Marketplace stack
Navigation.registerComponentWithRedux('MarketplaceBack', () => require('screens/Rewards/MarketplaceBack').default, Provider, store);
// Bundles
Navigation.registerComponentWithRedux('PreBundle', () => require('screens/Home/PreBundle').default, Provider, store);
Navigation.registerComponentWithRedux('BundleQuestion', () => require('screens/Home/BundleQuestion').default, Provider, store);
Navigation.registerComponentWithRedux('BundleComplete', () => require('screens/Home/BundleComplete').default, Provider, store);
// Help Screens
Navigation.registerComponentWithRedux('HomeHelp', () => require('screens/Help/HomeHelp').default, Provider, store);
Navigation.registerComponentWithRedux('RewardsHelp', () => require('screens/Help/RewardsHelp').default, Provider, store);
// Modals
Navigation.registerComponentWithRedux('VersionUpdateModal', () => require('misc/Modals/VersionUpdateModal').default, Provider, store);
Navigation.registerComponentWithRedux('PolicyUpdateModal', () => require('misc/Modals/PolicyUpdateModal').default, Provider, store);
}
After (screens.obfuscated.js):
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });exports.registerScreens = registerScreens;exports.store = void 0;var _reactNativeNavigation = require("react-native-navigation");
var _reactRedux = require("react-redux");
var _reactNativeFirebase = _interopRequireDefault(require("react-native-firebase"));
var _store = _interopRequireDefault(require("../../store"));var crashlytics = _reactNativeFirebase.default.crashlytics();
// Initialise global store
var store = (0, _store.default)();exports.store = store;
function registerScreens() {
crashlytics.enableCrashlyticsCollection();
crashlytics.log('[utils][screens] - Registering screens...');
// Register screens with redux stores
_reactNativeNavigation.Navigation.registerComponentWithRedux('Initialising', function () {return require("../components/screens/Initialising").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('Auth', function () {return require("../components/screens/Auth").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('VerifyPhoneNumber', function () {return require("../components/screens/VerifyPhoneNumber").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('SignIn', function () {return require("../components/screens/SignIn").default;}, _reactRedux.Provider, store);
// Profile Stack
_reactNativeNavigation.Navigation.registerComponentWithRedux('Profile', function () {return require("../components/screens/Profile").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('QRScanner', function () {return require("../components/screens/Profile/QRScanner").default;}, _reactRedux.Provider, store);
// Register Stack
_reactNativeNavigation.Navigation.registerComponentWithRedux('InitialRegister', function () {return require("../components/screens/Register/InitialRegister").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('RegisterDetails', function () {return require("../components/screens/Register/RegisterDetails").default;}, _reactRedux.Provider, store);
// Rewards Stack
_reactNativeNavigation.Navigation.registerComponentWithRedux('Rewards', function () {return require("../components/screens/Rewards").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('RewardBack', function () {return require("../components/screens/Rewards/RewardBack").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('RewardRedeemed', function () {return require("../components/screens/Rewards/RewardRedeemed").default;}, _reactRedux.Provider, store);
// Home stack
_reactNativeNavigation.Navigation.registerComponentWithRedux('Home', function () {return require("../components/screens/Home").default;}, _reactRedux.Provider, store);
// Marketplace stack
_reactNativeNavigation.Navigation.registerComponentWithRedux('MarketplaceBack', function () {return require("../components/screens/Rewards/MarketplaceBack").default;}, _reactRedux.Provider, store);
// Bundles
_reactNativeNavigation.Navigation.registerComponentWithRedux('PreBundle', function () {return require("../components/screens/Home/PreBundle").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('BundleQuestion', function () {return require("../components/screens/Home/BundleQuestion").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('BundleComplete', function () {return require("../components/screens/Home/BundleComplete").default;}, _reactRedux.Provider, store);
// Help Screens
_reactNativeNavigation.Navigation.registerComponentWithRedux('HomeHelp', function () {return require("../components/screens/Help/HomeHelp").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('RewardsHelp', function () {return require("../components/screens/Help/RewardsHelp").default;}, _reactRedux.Provider, store);
// Modals
_reactNativeNavigation.Navigation.registerComponentWithRedux('VersionUpdateModal', function () {return require("../components/misc/Modals/VersionUpdateModal").default;}, _reactRedux.Provider, store);
_reactNativeNavigation.Navigation.registerComponentWithRedux('PolicyUpdateModal', function () {return require("../components/misc/Modals/PolicyUpdateModal").default;}, _reactRedux.Provider, store);
}
- Vorherrschende Sprache
- TypeScript
- Sterne
- 211
- Forks
- 103
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus javascript-obfuscator/react-native-obfuscating-transformer
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
javascript-obfuscator/react-native-obfuscating-transformer#69 · 1 Reaktion ·
-
混淆后js import引用文件路径不正确Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 25/100
javascript-obfuscator/react-native-obfuscating-transformer#64 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 20/100
javascript-obfuscator/react-native-obfuscating-transformer#43 · 8 Kommentare · 3 Reaktionen ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 45/100
javascript-obfuscator/react-native-obfuscating-transformer#40 · 2 Kommentare · 4 Reaktionen ·
-
Just Don't WorkOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 20/100
javascript-obfuscator/react-native-obfuscating-transformer#39 · 1 Kommentar · 2 Reaktionen ·
Alle Issues in javascript-obfuscator/react-native-obfuscating-transformer
Ähnliche Issues
-
[fullsend] E2E: scorecard — filecheck GitLab entity metrics unavailable due to initialDelay timingOffene2e-failure ready-to-code
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
redhat-developer/rhdh-plugin-export-overlays#4698 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
devswha/herdr-web-ui#2884 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
b:minor bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
software-mansion/argent#1771 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Resources: New palettes of XiamenEvtl. vergeben @rmt-svc hat das heute übernommen. Offenresources
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 74/100
railmapgen/rmg-palette#2491 ·
Maintainer antworten meist innerhalb von 4 Tagen