김성주

fixed some comments

...@@ -40,7 +40,6 @@ def detect_vars(line): # detect variables and return range tuples. except for ke ...@@ -40,7 +40,6 @@ def detect_vars(line): # detect variables and return range tuples. except for ke
40 40
41 def obfuscate(lines, vars, dictionary, mapper): # obfuscate the code 41 def obfuscate(lines, vars, dictionary, mapper): # obfuscate the code
42 ret = list() 42 ret = list()
43 - ### write_file('D:/Develop/ori.py', lines)
44 43
45 for line in lines: 44 for line in lines:
46 var_ranges = detect_vars(line) 45 var_ranges = detect_vars(line)
...@@ -64,7 +63,6 @@ def obfuscate(lines, vars, dictionary, mapper): # obfuscate the code ...@@ -64,7 +63,6 @@ def obfuscate(lines, vars, dictionary, mapper): # obfuscate the code
64 63
65 ret.append(new_line) 64 ret.append(new_line)
66 65
67 - ### write_file('D:/Develop/obf.py', ret)
68 return ret 66 return ret
69 67
70 def create_var_histogram(input, outPath): 68 def create_var_histogram(input, outPath):
...@@ -122,8 +120,6 @@ def obfuscate_files(input, output, var=None, threshold=4000): # obfuscate variab ...@@ -122,8 +120,6 @@ def obfuscate_files(input, output, var=None, threshold=4000): # obfuscate variab
122 dictionary = create_dictionary(var) 120 dictionary = create_dictionary(var)
123 mapper = create_mapper(len(var)) 121 mapper = create_mapper(len(var))
124 122
125 - ### obfuscate(codes[0][1], var, dictionary, mapper)
126 -
127 for path, code in codes: 123 for path, code in codes:
128 obfuscated = obfuscate(code, var, dictionary, mapper) 124 obfuscated = obfuscate(code, var, dictionary, mapper)
129 125
......
...@@ -2,7 +2,7 @@ from utils import * ...@@ -2,7 +2,7 @@ from utils import *
2 import file_parser 2 import file_parser
3 import re 3 import re
4 4
5 -# obfuscator v2 generate random name for methods 5 +# obfuscator v2 generates random name for methods
6 6
7 def random_character(start=False): 7 def random_character(start=False):
8 if start: 8 if start:
...@@ -75,7 +75,6 @@ def detect_vars(line): # detect variables and return range tuples. except for ke ...@@ -75,7 +75,6 @@ def detect_vars(line): # detect variables and return range tuples. except for ke
75 75
76 def obfuscate(lines, vars, dictionary, mapper): # obfuscate the code 76 def obfuscate(lines, vars, dictionary, mapper): # obfuscate the code
77 ret = list() 77 ret = list()
78 - ### write_file('D:/Develop/ori.py', lines)
79 78
80 for line in lines: 79 for line in lines:
81 var_ranges = detect_vars(line) 80 var_ranges = detect_vars(line)
...@@ -99,7 +98,6 @@ def obfuscate(lines, vars, dictionary, mapper): # obfuscate the code ...@@ -99,7 +98,6 @@ def obfuscate(lines, vars, dictionary, mapper): # obfuscate the code
99 98
100 ret.append(new_line) 99 ret.append(new_line)
101 100
102 - ### write_file('D:/Develop/obf.py', ret)
103 return ret 101 return ret
104 102
105 def create_var_histogram(input, outPath): 103 def create_var_histogram(input, outPath):
...@@ -157,8 +155,6 @@ def obfuscate_files(input, output, var=None, threshold=4000): # obfuscate variab ...@@ -157,8 +155,6 @@ def obfuscate_files(input, output, var=None, threshold=4000): # obfuscate variab
157 dictionary = create_dictionary(var) 155 dictionary = create_dictionary(var)
158 mapper = create_mapper_v2(len(var)) 156 mapper = create_mapper_v2(len(var))
159 157
160 - ### obfuscate(codes[0][1], var, dictionary, mapper)
161 -
162 for path, code in codes: 158 for path, code in codes:
163 obfuscated = obfuscate(code, var, dictionary, mapper) 159 obfuscated = obfuscate(code, var, dictionary, mapper)
164 160
......
...@@ -2,10 +2,6 @@ from utils import * ...@@ -2,10 +2,6 @@ from utils import *
2 import re 2 import re
3 import keyword 3 import keyword
4 4
5 -'''
6 - Test multi-line comments
7 -'''
8 -
9 LIBRARYS = list() 5 LIBRARYS = list()
10 6
11 def parse_keywords(line, out): # out : output dictionary to sum up frequencies 7 def parse_keywords(line, out): # out : output dictionary to sum up frequencies
...@@ -26,7 +22,7 @@ def parse_keywords(line, out): # out : output dictionary to sum up frequencies ...@@ -26,7 +22,7 @@ def parse_keywords(line, out): # out : output dictionary to sum up frequencies
26 if not key or is_number(key) or key[0] in "0123456789": 22 if not key or is_number(key) or key[0] in "0123456789":
27 continue 23 continue
28 24
29 - ## Exception code here 25 + ## Exception code here if you want
30 26
31 if key in ['from', 'import']: 27 if key in ['from', 'import']:
32 import_line = True 28 import_line = True
...@@ -56,6 +52,8 @@ def parse_block(lines): # parse to import / def / class / normal (if, for, etc) ...@@ -56,6 +52,8 @@ def parse_block(lines): # parse to import / def / class / normal (if, for, etc)
56 block_stack = [root] 52 block_stack = [root]
57 i = 0 53 i = 0
58 L = len(lines) 54 L = len(lines)
55 +
56 + ### commented because of some exceptions
59 # par_stack = list() 57 # par_stack = list()
60 # multi_string_stack = list() 58 # multi_string_stack = list()
61 59
......