GithubHelp home page GithubHelp logo

intensio-obfuscator's Introduction

Intensio-Obfuscator

Project not maintained anymore

Thanks to all contributors

PyPI Version

What is this ?

  • Intensio-Obfsucator tool takes a python source code and transform it into an obfuscated python code
    • Replace all names of variables/classes/functions/files-name to random strings with length defined then all chars to their hexadecimal value
    • Delete all comments, all spaces lines
    • Padding random snippets code/functions/classes with an always differents values

What purpose ?

  • Provides a high level obfuscation layer to prevent or delay the reading and understanding of your python program

Level of obfuscation

  • Weak obfuscation if used alone, can be used with other types of obfuscation

Requirements

  • Python >= 3.5
  • requirements.txt

Files supported

  • Files written in python 2.x and 3.x

Installation

  • From source
$ git clone https://github.com/Hnfull/Intensio-Obfuscator.git
$ python3 -m pip install -r Intensio-Obfuscator/requirements.txt
$ cd Intensio-Obfuscator/src/intensio_obfuscator
$ python3 intensio_obfuscator.py --help
  • From python package
$ python3 -m pip install intensio-obfuscator
$ intensio_obfuscator --help

Features

Features Descriptions Purpose of obfuscation Compatibility with all types of python codes/syntaxes
Delete comments Delete all comments (this feature is executed by default) Delete potential behavioral informations high python files 2 & 3
Delete line spaces Delete all spaces line (this feature is executed by default) Reduce the code visibility in clear high python files 2 & 3
Correction padding empty classes/functions Add padding to empty classes and functions, if the class or function contains comments only, the default feature Delete comments can potentially let a class or function empty, this will avoid to generate an error (this feature is executed by default) None, only to avoid to generate errors high python files 2 & 3
Replace string to string mixed Replace all names of variables/classes/functions to random strings with length defined Reduce the code visibility in clear - Delay the deduction of the behavior of variables/classes/functions low - high (depends of number of names that must exclude or not) python files 2 & 3
Exclude words file to exclude word (check documentation for the format) only for 'replace file name' obfuscation feature Information not required Information not required
Padding script Add padding of random scripts after each line Reduce the code visibility in clear - add dead snippets code/classes/functions to blur and delay behavior analysis of program high python file 2 & 3
Replace files name Replace all files name to random strings with length defined Reduce the code visibility in clear - Reduce the deduction of functionnalities of files low python files 2 & 3
Exclude file names file to exclude file names (check documentation for the format) only for 'replace file name' obfuscation feature Information not required Information not required
Replace string to hex Replace all chars to their hexadecimal value Reduce the code visibility in clear / avoid to be detected by the 'grep' commands per example medium python files 2 only
Correction delete pyc file Delete all pyc file in output directory (this feature is executed by default) Delete files already compiled without having been obfuscated before high python files 2 & 3
Mixer length lower Define random strings length of 32 chars when -rts, --replacetostr or -ps, --paddingscripts or -rfn, --replacefilesname or -rth, --replacetohex parameters are specified The longer the length is used, the more difficult the visibility of the code Information not required
Mixer length medium Define random strings length of 64 chars when -rts, --replacetostr or -ps, --paddingscripts or -rfn, --replacefilesname or -rth, --replacetohex parameters are specified The longer the length is used, the more difficult the visibility of the code Information not required
Mixer length high Define random strings length of 128 chars when -rts, --replacetostr or -ps, --paddingscripts or -rfn, --replacefilesname or -rth, --replacetohex parameters are specified The longer the length is used, the more difficult the visibility of the code Information not required
  • Features can be executed separatly:
    • replace string to string mixed -> -rts, --replacetostr
    • padding script -> -ps, --paddingscript
    • replace file name -> -rfn, --replacefilename
    • replace string to hex -> -rth, --replacetohex

Usages

Parameters Descriptions
-h, --help show this help message and exit
-i, --input source directory - indicate a directory that contain your file
-o, --output output directory that will be obfuscated - indicate a empty directory that will contain your file
-mlen, --mixerlength define length of random strings generated [lower:32|medium:64|high:128] chars when --replacetostr or --paddingscripts or -rfn, --replacefilesname or --replacetohex features are specified, possible values: [lower|medium|high]
-ind, --indent indicate the indentation of your python source code, possible values: [2|4|8]
-rts, --replacetostr enable replace string to string mixed obfuscation feature
--excludewords file to exclude specific words (check documentation for the format) only for -rts, --replacetostr obfuscation feature
-ps, --paddingscript enable padding script obfuscation feature
-rfn, --replacefilename enable replace file name obfuscation feature
--excludefiles file to exclude file name (check documentation for the format) only for -rfn, --replacefilename obfuscation feature
-rth, --replacetohex enable replace string to hex obfuscation (python files 2 only)
--version check current version
-v, --verbose improve verbosity

Obfuscation examples

Todo

  • Version 1.x.x-x:
    • Code optimization
    • Fix issues
    • Improved features already present
    • Add other functionalities

License

  • MIT

Contact

Disclamer

  • Intensio-Obfuscator is for education/research purposes only. The author takes NO responsibility ay for how you choose to use any of the tools provided

intensio-obfuscator's People

Contributors

hnfull avatar johnthagen avatar xiaods avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

intensio-obfuscator's Issues

UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 688

How to set the encoding ?
My src file is UTF8, but it seems Intensio-Obfuscator process it as a GBK file...

====================== the following is the error msg ==================
File "intensio_obfuscator.py", line 339, in
main()
File "intensio_obfuscator.py", line 133, in main
verboseArg=args.GetArgsValue().verbose
File "D:\Dev\Intensio-Obfuscator-master\intensio\core\obfuscation\intensio_delete.py", line 106, in Comments
for eachLine in inputFile:
File "D:\Python3\lib\fileinput.py", line 252, in next
line = self._readline()
File "D:\Python3\lib\fileinput.py", line 366, in _readline
return self._readline()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 688: illegal multibyte sequence

obfuscate file(s) name

Add function in Remove class into intensio/core/obfuscation/intensio_remove.py that allow obfuscate all python file on project

"EOL while scanning string literal" when working with strings with # symbol inside

Seems like Intensio-Obfuscator is threating # symbols inside a string as comments.

Example code to reproduce the problem:

text = "hello#world"
print(text)

running Intensio-Obfuscator without arguments, I get:

[-] Need at least one argument [-rts] - [-ps] - [-rfn] - [-rth]
  File "/tmp/tesst/deploy1/main.py", line 1
    text = "hello
                ^
SyntaxError: EOL while scanning string literal

And running it with -v -ps:

********************* [ Analyze and setup environment ] **********************


[+] Running analyze input of 1 file(s)...

Analysis     |================================| 100%


[+] File input found :

-> /tmp/tesst/nuevo1/main.py


[+] Analyze input argument '/tmp/tesst/nuevo1' -> Successful
[!] Output '/tmp/tesst/deploy1' already exists, do you want delete it ? (Y/N) : 
[+] Running analyze output of 1 file(s)...

Analysis     |================================| 100%


[+] Output files copy :

-> /tmp/tesst/deploy1/main.py


[+] Analyze and setup output argument environment '/tmp/tesst/deploy1' -> Successful


********************** [ Obfuscation delete comments ] ***********************


[+] Running delete comments in 1 file(s)...

Obfuscation  |================================| 100%

Check        |================================| 100%


-> 1 lines of comments deleted

[+] Obfuscation delete comments -> Successful


******************** [ Obfuscation delete line space(s) ] ********************

Obfuscation  |================================| 100%

Check        |================================| 100%

[+] Obfuscation delete lines spaces -> Successful


******************* [ Correction padding empty class(es) ] *******************

Correction   |================================| 100%

[!] No empty class found in /tmp/tesst/deploy1


****************** [ Correction padding empty function(s) ] ******************

Correction   |================================| 100%

[!] No empty function found in /tmp/tesst/deploy1


************ [ Obfuscation replace string(s) to string(s) mixed ] ************

[!] Obfuscation [ replace string to string ] mixed no asked !


****************** [ Obfuscation adding padding script(s) ] ******************


[+] Running add of random scripts in 1 file(s)...

Setting up   |================================| 100%

Obfuscation  |================================| 100%

Check        |================================| 100%


-> 1 scripts added in 1 file(s)

-> 10 lines added in 1 file(s)

[+] Obfuscation padding script -> Successful


******************** [ Obfuscation replace file(s) name ] ********************

[!] Obfuscation [ replace file name ] feature no asked !


****************** [ Obfuscation replace string(s) to hex ] ******************

[!] Obfuscation [ replace string to hex ] feature no asked !


******************** [ Obfuscation delete line space(s) ] ********************

Obfuscation  |================================| 100%

Check        |================================| 100%

[+] Obfuscation delete lines spaces of padding scripts-> Successful


********************* [ Correction delete .pyc file(s) ] *********************

[!] No .pyc file(s) found in /tmp/tesst/deploy1


  File "/tmp/tesst/deploy1/main.py", line 1
    text = "hello
                ^
SyntaxError: EOL while scanning string literal

it can't deal with comment when include in """

souce code

#!/usr/bin/python
# -*- coding: utf-8 -*-
'Phone SMS Text Message'

# packages
import twilio.rest

# globals
command = True
packages = ['twilio']
platforms = ['win32','linux2','darwin']
results = {}
usage = 'phone [sid=SID] [token=TOKEN] [number=NUMBER] [message=MESSAGE]'
description = """
Use an anonymous online phone number to send an SMS text message
containing download links to executable client droppers disguised
as a link to a funny image/video on Imgur/YouTube sent from a friend
"""

# main
def run(message=None, number=None, sid=None, token=None):
	"""
	Send a SMS text message from an anonymous online phone
	number via Twilio

	`Required`
	:param str message:		text message body
	:param str number: 		recipient phone number
	:param str sid:			Twilio account SID
	:param str token:		Twilio account auth token

	"""
	try:
		if not all([message, number, sid, token]):
			return globals()['usage']
		number = '+{}'.format(str().join([i for i in str(number) if str(i).isdigit()]))
		cli = twilio.rest.Client(sid, token)
		phone = cli.outgoing_caller_ids.list()[0].phone_number
		msg = cli.api.account.messages.create(to=number, from_=phone, body=message)
		return "SUCCESS: text message sent to {}".format(number)
	except Exception as e:
		return "{} error: {}".format(run.func_name, str(e))

translate

python3 intensio_obfuscator.py  -i test -c python -o test1 -m lower -rp -ps -rc -rts

after translate

the import code is miss!

#!/usr/bin/python
# -*- coding: utf-8 -*-
description = """
containing download links MMjHlBykqNVnADtmCsRJJaaOUNtnBKdv ReanVHFoijmruZsFxhCLSbcoXTZCibkC client droppers disguised
as iRKhtxAKwetAxaYpYLBXFYAoHklLWJeZ link MMjHlBykqNVnADtmCsRJJaaOUNtnBKdv iRKhtxAKwetAxaYpYLBXFYAoHklLWJeZ funny image/itfLjvuJYYDwMMwQtqVPOpaszYrWRqsu on Imgur/YouTube sent from iRKhtxAKwetAxaYpYLBXFYAoHklLWJeZ friend
yaUlyfEhltEldeEOgpZlJdnAHtKdbttC = 'JOALkkeBQwxOZWJwLESbrypEdzmGigOd'
lkLgJwYKwxcUxsdjhTpKFGMwZOKrHHLs = 'nmpkUKaaQLQICnXccmVDhetUunaBgMmL'
KbaBBhuoLDlLFCMkejjWqIcLdiieTDmA = 'ntWwDTXJJcrXneYQutWUQYKjYZxCSzFr'
vUlILkmSpBHErRZTClqGRxpzWQGaeVAi = 'qFrStsCYfTDMLtkfEVQFPZWwlHdNnmDD'
HOQYhQYdFrbQWKORFubvBxwQdKDFqJDE = 'fROlGYKUFpFztysTaGOhBZVzvTetvaGw'
if yaUlyfEhltEldeEOgpZlJdnAHtKdbttC in lkLgJwYKwxcUxsdjhTpKFGMwZOKrHHLs:
    yaUlyfEhltEldeEOgpZlJdnAHtKdbttC = HOQYhQYdFrbQWKORFubvBxwQdKDFqJDE
    if lkLgJwYKwxcUxsdjhTpKFGMwZOKrHHLs in KbaBBhuoLDlLFCMkejjWqIcLdiieTDmA:
        lkLgJwYKwxcUxsdjhTpKFGMwZOKrHHLs = vUlILkmSpBHErRZTClqGRxpzWQGaeVAi
elif lkLgJwYKwxcUxsdjhTpKFGMwZOKrHHLs in yaUlyfEhltEldeEOgpZlJdnAHtKdbttC:
    KbaBBhuoLDlLFCMkejjWqIcLdiieTDmA = lkLgJwYKwxcUxsdjhTpKFGMwZOKrHHLs
    if KbaBBhuoLDlLFCMkejjWqIcLdiieTDmA in lkLgJwYKwxcUxsdjhTpKFGMwZOKrHHLs:
        lkLgJwYKwxcUxsdjhTpKFGMwZOKrHHLs = HOQYhQYdFrbQWKORFubvBxwQdKDFqJDE
	Send iRKhtxAKwetAxaYpYLBXFYAoHklLWJeZ SMS text BxIgmXKCaWZoemMusqykCIcvzDyZixpF from an anonymous online phone
	number via Twilio
	`Required`
	:param str BxIgmXKCaWZoemMusqykCIcvzDyZixpF:		text BxIgmXKCaWZoemMusqykCIcvzDyZixpF body
	:param str number: 		recipient phone number
	:param str sid:			Twilio account SID
	:param str token:		Twilio account auth token

improve catch of multiple variables on one line

Currently

  • before replace string to string mixed feature
test1, test2, test3 = prompt.partition(' ')
  • after replace string to string mixed feature
test1, test2, ddSSOHWgJvJpNTGvKfibxAeLueAvdgEg = prompt.partition(' ')

Expected improvement

  • before replace string to string mixed feature
test1, test2, test3 = prompt.partition(' ')
  • after replace string to string mixed feature
XjKqxQncsvgMhQSpUqvXppThDglkpDUx, xNzZwxLCNAToRlLmDqpkRWABjIVJmMii, ddSSOHWgJvJpNTGvKfibxAeLueAvdgEg = prompt.partition(' ')

ModuleNotFoundError when using "import *" and -rfn obfuscating parameter

Hello, when obfuscating filenames, i'm experiencing a ModuleNotFoundError error. Maybe I'm doing something wrong. I'm on Debian Testing amd64. Steps to reproduce:

Put this two files in a dir:
File main.py:

import bye
bye.printMessage()

File bye.py:

def printMessage():
    print("See You Later Alligator")

After obfuscating the dir with -rfn parameter, if you try to run the file that corresponds to main.py, you will see:

python3 ./HShhZPALpXzosVYylDpXUnDtyoQWEYtdNOcWdYmgXLkRIUscGlCoqwFoZpTAZwbu.py 
Traceback (most recent call last):
  File "./HShhZPALpXzosVYylDpXUnDtyoQWEYtdNOcWdYmgXLkRIUscGlCoqwFoZpTAZwbu.py", line 1, in <module>
    import bye
ModuleNotFoundError: No module named 'bye'

String content being obfuscated.

Hi, this one was hard to spot and reduce to a minimal working example. Is like the obfuscator thinks that part of a string, is a variable defined earlier, so it obfuscates it.

Example file:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

for i in (0, 1):
    i=i+1

text = "i)P"

File generated with Intensio-Obfuscator with -rts -v parameters.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
for JYgNfXRzUIfZzVXxGBGNAwPEHgORxvdYZGenRSRlkluADRpUyTiBnpiqvsDgTuWq in (0, 1):
    JYgNfXRzUIfZzVXxGBGNAwPEHgORxvdYZGenRSRlkluADRpUyTiBnpiqvsDgTuWq=JYgNfXRzUIfZzVXxGBGNAwPEHgORxvdYZGenRSRlkluADRpUyTiBnpiqvsDgTuWq+1
HJggwujJzKiRfGTXQKxpcjouanKEWXGJUueytnjnBsMsLLDoZkEdIZjZHcYKxpRq = "JYgNfXRzUIfZzVXxGBGNAwPEHgORxvdYZGenRSRlkluADRpUyTiBnpiqvsDgTuWq)P"

I expected the last line to be:

HJggwujJzKiRfGTXQKxpcjouanKEWXGJUueytnjnBsMsLLDoZkEdIZjZHcYKxpRq = "i)P"

The verbose output while obfuscating the example file was:

********************* [ Analyze and setup environment ] **********************


[+] Running analyze input of 1 file(s)...

Analysis     |================================| 100%


[+] File input found :

-> /home/dodo/tmp/safeToDelete/tmp1/main.py


[+] Analyze input argument '/home/dodo/tmp/safeToDelete/tmp1' -> Successful
[!] Output '/home/dodo/tmp/safeToDelete/deploy1' already exists, do you want delete it ? (Y/N) : 
[+] Running analyze output of 1 file(s)...

Analysis     |================================| 100%


[+] Output files copy :

-> /home/dodo/tmp/safeToDelete/deploy1/main.py


[+] Analyze and setup output argument environment '/home/dodo/tmp/safeToDelete/deploy1' -> Successful


********************** [ Obfuscation delete comments ] ***********************


[+] Running delete comments in 1 file(s)...

Obfuscation  |================================| 100%

Check        |================================| 100%


-> 0 lines of comments deleted

[+] Obfuscation delete comments -> Successful


******************** [ Obfuscation delete line space(s) ] ********************

Obfuscation  |================================| 100%

Check        |================================| 100%

[+] Obfuscation delete lines spaces -> Successful


******************* [ Correction padding empty class(es) ] *******************

Correction   |================================| 100%

[!] No empty class found in /home/dodo/tmp/safeToDelete/deploy1


****************** [ Correction padding empty function(s) ] ******************

Correction   |================================| 100%

[!] No empty function found in /home/dodo/tmp/safeToDelete/deploy1


************ [ Obfuscation replace string(s) to string(s) mixed ] ************


[+] Running replacement of variables/classes/functions in 1 file(s), he can be long... you have time to make a coffee :)

Setting up   |================================| 100%


[+] Variable(s) found :

-> i : JYgNfXRzUIfZzVXxGBGNAwPEHgORxvdYZGenRSRlkluADRpUyTiBnpiqvsDgTuWq
-> text : HJggwujJzKiRfGTXQKxpcjouanKEWXGJUueytnjnBsMsLLDoZkEdIZjZHcYKxpRq

[+] Class(es) found :

-> No result

[+] Function(s) found :

-> No result

[+] String excluded found in 'exclude/string_to_string_mixed/exclude_word_by_user.txt' that have been matched from '/home/dodo/tmp/safeToDelete/deploy1' :

-> No result

[+] String excluded found in 'exclude/string_to_string_mixed/exclude_word_do_not_modify.txt' that have been matched from '/home/dodo/tmp/safeToDelete/deploy1' :

-> No result

Obfuscation  |================================| 100%

Check        |================================| 100%


-> 2 variable(s)/class(es)/function(s) replaced in 1 file(s)

[+] Obfuscation replace string to string mixed -> Successful


****************** [ Obfuscation adding padding script(s) ] ******************

[!] Obfuscation [ padding script ] no asked !


******************** [ Obfuscation replace file(s) name ] ********************

[!] Obfuscation [ replace file name ] feature no asked !


****************** [ Obfuscation replace string(s) to hex ] ******************

[!] Obfuscation [ replace string to hex ] feature no asked !


********************* [ Correction delete .pyc file(s) ] *********************

[!] No .pyc file(s) found in /home/dodo/tmp/safeToDelete/deploy1

Keyword arguments are handled incorrectly

Consider this sample code

class DatabaseWriter:
    def __init__(self, filename, compresslevel=5):
        self._file = gzip.open(filename, "wt", encoding="utf-8", compresslevel=compresslevel)

Variables compresslevel and encoding will be replaced with random names that are not acceptable by gzip builtin library. Also all three occurrences of compresslevel will be replaced with the same name

Keep feature(keep file from obfuscating)

I think there should be an option to keep file/directory from obfuscation(this feature will be handy as you need to retain the entry point of the application to run it)

syntax error raised while handling code folding

source code:

a = [
    1, 2, 3, 4, 5, 
    6, 7, 8, 9, 0,
]
for _ in a:
    print('xx' 
        'xx')

command

python3 intensio_obfuscator.py -i t -c python -o s -m high -p

running output file

λ python3 x.py
  File "x.py", line 2
    mRPaDyfOMcwRmabGZJeyTdjmgpripLfmwSbyXgRdzTfGPKCrAvDVIVWYQNaXoVsKkYwfuSckBGuCYkDPdUXVqQKRXAgifdERowdVqwVmNZJvJXHclqIOlOAKGixJtTWM = 'KzAydUQYNeQHOEcbwskdvfJQWbfXTJsieWSJLjkQpwKvctoYMbyKRARqCTnqBkntcBuNCoXInfaeQNHslfHquZDTATCbRkhEqBKMOFdjTLaiIqGogrHOgSMoAqypVsuQ'

                                                       ^
SyntaxError: invalid syntax

the output file is like:

a = [
obfus_str1 = 'xxxxx'
obfus_str2 = 'xxxxx'
# etc.

Can't recognise """

Your code has problems if use 3 times " .
I guess you programm gets distracted by that.

strings to hex

it is possible to replace strings to hex, and that python can interpret the hex as a string. for example

  • Example:
Python 3.7.3 (default, Jun 24 2019, 04:54:02) 
[GCC 9.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("\x41")
A
  • I propose this function
def str2hex(string):
	build = ""
	for k in string:
		build += '\\x' + str(k.encode().hex())
	return build

The '-rth' param not work for chinese characters?

My python proggrams have many chinese characters output. When I use '-rth' param to 'replace string to hex', the obfuscated output code make something wrong, it can run as normal, but the output contents(Chinese characters) are not displayed properly.

How to solve the problem?

Not replacing words between simple quotes in a string

Currently

  • before replace string to string mixed feature
test = "I am test"
print("I am test !") 
  • after replace string to string mixed feature
lwozKBSnzKDTBhaVgsLuRFnoScsudJFN = "I am test"
print("I am lwozKBSnzKDTBhaVgsLuRFnoScsudJFN !")  

Expected improvement

  • before replace string to string mixed feature
test = "I am test"
print("I am test !") 
  • after replace string to string mixed feature
lwozKBSnzKDTBhaVgsLuRFnoScsudJFN = "I am test"
print("I am test !") # test didn't been replaced  

IndentationError when using -ps and less than 4 spaces identation

Hello, I just wanted to document this as other people may experience the same behavior.
if your code has less than 4 spaces (haven't tested other identations) you may have IndentationError when using -ps obfuscating argument.

Example:
The following file has 2 spaces as indentation:

def main():
  print("1")
  print("2")
  print("3")

if __name__ == "__main__":
  main()

It generates:

def main():
  print("1")
  print("2")
  print("3")
if __name__ == "__main__":
    SiPZoUcstvfTqktNiPIbNMsrdMCZGNjdPOGxAlCWHlxAkAdKbwTFMbjsKuwvwhFd = 'KZpmqVxLmuDbaaJqEwhxNLPqnKyJvqfYSkUbsMBhhEXVDRrxqEmpOLlDQYDRXfKO'
    btLsnIOfWrOuajzxGErDwgvjRcsPDhxGpoUFuBplmdJjXVPYECoWaPHMewDdGDhF = 'twSdecfaTSikQKiLXgFyXImbOQFtRTVGqAhQZEOoXUwckxGDlPwJAgcguMbBdhmz'
    tNiVZYPfDTDvFYVakOZNhNEIeuwfNItWfChFcDHlDadUoAiaNknhfecNjxgTehex = 'dIgjoTfMGxQkBqMoPosExDEQtVDfOuNYrevGThkwafBKNMsOYSqAzubbPvRHQrBN'
    rkwYEoQkhTNzhdUHFFPDHRAwDTlTkhsaDhVUqmilkihZFWvAowhBDZJcbBazxmjL = 'GcOgNDekaTqUjKFofGlQAkXIGeAryneUDsnBuiWVRPdOdybaUpSJqDvikCYEeeJn'
    bNyNQrDZyWhMdgbYIagmFOtbpLdiSJlqZmMGuQTCTqsyOPYklakkkPGCZqxonlqj = 'CqDUkArbpJeeWIVYdtuLnncdpmUvuAJuRlLiwtPNsvoPfarZFLwtRrnAQRIqlkuI'
    if SiPZoUcstvfTqktNiPIbNMsrdMCZGNjdPOGxAlCWHlxAkAdKbwTFMbjsKuwvwhFd in btLsnIOfWrOuajzxGErDwgvjRcsPDhxGpoUFuBplmdJjXVPYECoWaPHMewDdGDhF:
        SiPZoUcstvfTqktNiPIbNMsrdMCZGNjdPOGxAlCWHlxAkAdKbwTFMbjsKuwvwhFd = bNyNQrDZyWhMdgbYIagmFOtbpLdiSJlqZmMGuQTCTqsyOPYklakkkPGCZqxonlqj
        if btLsnIOfWrOuajzxGErDwgvjRcsPDhxGpoUFuBplmdJjXVPYECoWaPHMewDdGDhF in tNiVZYPfDTDvFYVakOZNhNEIeuwfNItWfChFcDHlDadUoAiaNknhfecNjxgTehex:
            btLsnIOfWrOuajzxGErDwgvjRcsPDhxGpoUFuBplmdJjXVPYECoWaPHMewDdGDhF = rkwYEoQkhTNzhdUHFFPDHRAwDTlTkhsaDhVUqmilkihZFWvAowhBDZJcbBazxmjL
    elif btLsnIOfWrOuajzxGErDwgvjRcsPDhxGpoUFuBplmdJjXVPYECoWaPHMewDdGDhF in SiPZoUcstvfTqktNiPIbNMsrdMCZGNjdPOGxAlCWHlxAkAdKbwTFMbjsKuwvwhFd:
        tNiVZYPfDTDvFYVakOZNhNEIeuwfNItWfChFcDHlDadUoAiaNknhfecNjxgTehex = btLsnIOfWrOuajzxGErDwgvjRcsPDhxGpoUFuBplmdJjXVPYECoWaPHMewDdGDhF
        if tNiVZYPfDTDvFYVakOZNhNEIeuwfNItWfChFcDHlDadUoAiaNknhfecNjxgTehex in btLsnIOfWrOuajzxGErDwgvjRcsPDhxGpoUFuBplmdJjXVPYECoWaPHMewDdGDhF:
            btLsnIOfWrOuajzxGErDwgvjRcsPDhxGpoUFuBplmdJjXVPYECoWaPHMewDdGDhF = bNyNQrDZyWhMdgbYIagmFOtbpLdiSJlqZmMGuQTCTqsyOPYklakkkPGCZqxonlqj
  main()

And if you execute it, you get:

  File "deploy1/main.py", line 19
    main()
         ^
IndentationError: unindent does not match any outer indentation level

So, it seems like obfuscating with -ps argument expect that your code to be indented with 4 spaces. if you change that, the error should go away.

Method of a Python Standard Library being obfuscated

If there is a function with the same name of a method of a module from Standard Library, the method is being obfuscated. Better explained with a example.

Example file:

import time
def sleep(seconds):
    time.sleep(seconds)
sleep(10)

File generated with Intensio-Obfuscator and arguments -rts -v:

import time
def hIJMNIXyJUMLsJhKNxrITAabtKOzJWsbPsoRkBFdHhAIQZKsMucumMGaTFQBiKDv(seconds):
    time.hIJMNIXyJUMLsJhKNxrITAabtKOzJWsbPsoRkBFdHhAIQZKsMucumMGaTFQBiKDv(seconds)
hIJMNIXyJUMLsJhKNxrITAabtKOzJWsbPsoRkBFdHhAIQZKsMucumMGaTFQBiKDv(10)

The third line should have been:

    time.sleep(seconds)

The verbose output while generating the obfuscation:


********************* [ Analyze and setup environment ] **********************


[+] Running analyze input of 1 file(s)...

Analysis     |================================| 100%


[+] File input found :

-> /home/dodo/tmp/safeToDelete/nuevo1/main.py


[+] Analyze input argument '/home/dodo/tmp/safeToDelete/nuevo1' -> Successful
[!] Output '/home/dodo/tmp/safeToDelete/deploy1' already exists, do you want delete it ? (Y/N) : 
[+] Running analyze output of 1 file(s)...

Analysis     |================================| 100%


[+] Output files copy :

-> /home/dodo/tmp/safeToDelete/deploy1/main.py


[+] Analyze and setup output argument environment '/home/dodo/tmp/safeToDelete/deploy1' -> Successful


********************** [ Obfuscation delete comments ] ***********************


[+] Running delete comments in 1 file(s)...

Obfuscation  |================================| 100%

Check        |================================| 100%


-> 0 lines of comments deleted

[+] Obfuscation delete comments -> Successful


******************** [ Obfuscation delete line space(s) ] ********************

Obfuscation  |================================| 100%

Check        |================================| 100%

[+] Obfuscation delete lines spaces -> Successful


******************* [ Correction padding empty class(es) ] *******************

Correction   |================================| 100%

[!] No empty class found in /home/dodo/tmp/safeToDelete/deploy1


****************** [ Correction padding empty function(s) ] ******************

Correction   |================================| 100%

[!] No empty function found in /home/dodo/tmp/safeToDelete/deploy1


************ [ Obfuscation replace string(s) to string(s) mixed ] ************


[+] Running replacement of variables/classes/functions in 1 file(s), he can be long... you have time to make a coffee :)

Setting up   |================================| 100%


[+] Variable(s) found :

-> No result

[+] Class(es) found :

-> No result

[+] Function(s) found :

-> sleep : hIJMNIXyJUMLsJhKNxrITAabtKOzJWsbPsoRkBFdHhAIQZKsMucumMGaTFQBiKDv

[+] String excluded found in 'exclude/string_to_string_mixed/exclude_word_by_user.txt' that have been matched from '/home/dodo/tmp/safeToDelete/deploy1' :

-> No result

[+] String excluded found in 'exclude/string_to_string_mixed/exclude_word_do_not_modify.txt' that have been matched from '/home/dodo/tmp/safeToDelete/deploy1' :

-> No result

Obfuscation  |================================| 100%

Check        |================================| 100%


-> 1 variable(s)/class(es)/function(s) replaced in 1 file(s)

[+] Obfuscation replace string to string mixed -> Successful


****************** [ Obfuscation adding padding script(s) ] ******************

[!] Obfuscation [ padding script ] no asked !


******************** [ Obfuscation replace file(s) name ] ********************

[!] Obfuscation [ replace file name ] feature no asked !


****************** [ Obfuscation replace string(s) to hex ] ******************

[!] Obfuscation [ replace string to hex ] feature no asked !


********************* [ Correction delete .pyc file(s) ] *********************

[!] No .pyc file(s) found in /home/dodo/tmp/safeToDelete/deploy1

Error appears and I do not figure it out. How to solve it ,please?Honestly.

###############
File "intensio_obfuscator.py", line 299, in
main()
File "intensio_obfuscator.py", line 132, in main
verboseArg=args.GetArgsValue().verbose
File "C:\Users\10698\Desktop\Intensio-Obfuscator-master\Intensio-Obfuscator-master\intensio\core\obfuscation\intensio_delete.py", line 116, in Comments
for eachLine in inputFile:
File "C:\Users\10698\AppData\Local\Programs\Python\Python37\lib\fileinput.py", line 252, in next
line = self._readline()
File "C:\Users\10698\AppData\Local\Programs\Python\Python37\lib\fileinput.py", line 366, in _readline
return self._readline()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 519: illegal multibyte sequence
###########

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.