forked from jdanceze/cg_parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapk_location.py
44 lines (35 loc) · 1.34 KB
/
apk_location.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
import sys
def read_mapping_file(mapping_file):
mapping = {}
with open(mapping_file, 'r') as file:
for line in file:
apk_location, name = line.strip().split(',')
mapping[name] = apk_location
return mapping
def lookup_apk_location(mapping, name):
return mapping.get(name, None)
def get_apk_name(apk_location):
return apk_location.split('/')[-1]
def create_directory(apk_name):
directory_name = apk_name.split('.apk')[0] # Remove the ".apk" extension
#os.makedirs(directory_name, exist_ok=True)
return directory_name
def process_data(data_file, mapping_file):
mapping = read_mapping_file(mapping_file)
with open(data_file, 'r') as file:
for line in file:
parts = line.strip().split(',')
name = parts[0]
apk_location = lookup_apk_location(mapping, name)
if apk_location:
apk_name = get_apk_name(apk_location)
directory_name = create_directory(apk_name)
print(f"{apk_location}")
else:
print(f"Name: {name} | APK Location not found")
# Get the data file path and mapping file path from command-line arguments
data_file_path = sys.argv[1]
mapping_file_path = './ella_name_map.txt'
# Process the data
process_data(data_file_path, mapping_file_path)