diff --git a/src/README.md b/src/README.md index 9e5fbcc..d7c706c 100644 --- a/src/README.md +++ b/src/README.md @@ -40,21 +40,21 @@ Given A → B, B depends on A ``` digraph Dependency { - "." -> html_root "." -> download_itunes "." -> bundle_combine download_itunes -> index_app_names + index_app_names -> index_categories + index_app_names -> index_rank + index_app_names -> html_index_domains + index_categories -> html_categories + index_categories -> html_index_apps bundle_combine -> index_rank bundle_combine -> index_domains - index_categories -> html_index_apps - index_app_names -> index_rank - index_app_names -> index_categories - index_categories -> html_categories - html_categories -> html_ranking - html_index_apps -> html_ranking index_rank -> html_bundle - index_rank -> html_index_domains index_domains -> html_index_domains + html_index_apps -> html_ranking + html_categories -> html_ranking + html_index_domains -> html_root "." -> download_tracker } ``` diff --git a/src/html_index_domains.py b/src/html_index_domains.py index a026d2d..1b7f37a 100755 --- a/src/html_index_domains.py +++ b/src/html_index_domains.py @@ -5,7 +5,6 @@ import lib_graphs as Graph import lib_html as HTML import index_app_names # get_name import index_domains -import index_rank # get_total_counts, fname_app_rank def dropdown_choose(button): @@ -111,27 +110,6 @@ def gen_lookup(html_dir, doms_dict, names_dict, title): mylib.json_write(mylib.path_add(html_dir, 'doms.json'), doms_dict) -def gen_results(c_apps, c_domains, title): - [c_recordings, c_logs] = index_rank.get_total_counts() - print(' {} apps'.format(c_apps)) - print(' {} domains'.format(c_domains)) - print(' {} recordings'.format(c_recordings)) - print(' {} logs'.format(c_logs)) - HTML.write(mylib.path_out('results'), ''' -

{}

-

The AppCheck database currently contains {:,} apps with a total of {:,} unique domains.

-

Collected through {:,} recordings with {:,} individual requests.

- -'''.format(title, c_apps, c_domains, c_recordings, c_logs), title=title) - mylib.symlink(index_rank.fname_app_rank(), - mylib.path_out('results', 'rank.json')) # after HTML.write - - def process(): # bundle_combine assures domain name is [a-zA-Z0-9.-] print('generating html: domain-index ...') @@ -157,10 +135,8 @@ def process(): gen_html_trinity(mylib.path_out('index', 'domains', 'tracker'), app_count, json=index_domains.load(tracker=True), title='Tracker', symlink=index_domains.fname_tracker()) - # Stats - print(' Results') - gen_results(app_count, dom_count, title='Results') print('') + return app_count, dom_count if __name__ == '__main__': diff --git a/src/html_root.py b/src/html_root.py index 3ce37bf..1e12ffa 100755 --- a/src/html_root.py +++ b/src/html_root.py @@ -3,6 +3,7 @@ import os import lib_common as mylib import lib_html as HTML +import index_rank # get_total_counts def gen_root(): @@ -10,6 +11,22 @@ def gen_root(): HTML.write(mylib.path_out(), fp.read()) +def gen_redirect(): + HTML.write(mylib.path_out(), ''' +

Redirecting …

+''', fname='redirect.html') + + +def gen_404(): + HTML.write(mylib.path_out(), ''' +

404 – Not Found

+

Go back to start page

''', fname='404.html') + + def gen_help(): many = 7 txt = '''

Help needed!

@@ -60,32 +77,41 @@ def gen_help(): HTML.write(mylib.path_out('help'), txt) -def gen_search(): - HTML.write(mylib.path_out(), ''' -

Redirecting …

-''', fname='redirect.html') +def gen_results(base_dir, c_apps, c_domains, title): + [c_recs, c_logs] = index_rank.get_total_counts() + print(' {} apps'.format(c_apps)) + print(' {} domains'.format(c_domains)) + print(' {} recordings'.format(c_recs)) + print(' {} logs'.format(c_logs)) + HTML.write(base_dir, ''' +

{}

+

The AppCheck database currently contains {:,} apps with a total of {:,} unique domains.

+

Collected through {:,} recordings with {:,} individual requests.

+ +'''.format(title, c_apps, c_domains, c_recs, c_logs), title=title) + mylib.symlink(index_rank.fname_app_rank(), + mylib.path_add(base_dir, 'rank.json')) # after HTML.write -def gen_404(): - HTML.write(mylib.path_out(), ''' -

404 – Not Found

-

Go back to start page

''', fname='404.html') - - -def process(): +def process(app_count, dom_count, inclStatic=False): print('generating root html ...') - print(' index.html') - gen_root() # root index.thml - print(' redirect.html') - gen_search() # root redirect.html?id=my.bundle.id - print(' 404.html') - gen_404() - print(' /help/') + if inclStatic: + print(' index.html') + gen_root() # root index.thml + print(' redirect.html') + gen_redirect() # root redirect.html?id=my.bundle.id + print(' 404.html') + gen_404() + print(' /help/') # dynamic content gen_help() + print(' /results/') # dynamic content + gen_results(mylib.path_out('results'), app_count, dom_count, + title='Results') print('') diff --git a/src/main.py b/src/main.py index d02c48d..9f35fad 100755 --- a/src/main.py +++ b/src/main.py @@ -36,14 +36,13 @@ def rebuild_html(bundle_ids=None, cat_ids=None, inclIApp=True, inclRoot=False): if bundle_ids: html_bundle.process(bundle_ids) # after index_rank html_categories.process(affected=cat_ids) # after index_categories - html_index_domains.process() # after index_domains & index_rank if inclIApp: html_index_apps.process() # after index_categories else: print('no new bundle, not rebuilding index') html_ranking.process() # after html_categories & html_index_apps - if inclRoot: # TODO: remove check if root contains dynamic content - html_root.process() + app_count, dom_count = html_index_domains.process() # after index_domains + html_root.process(app_count, dom_count, inclStatic=inclRoot) def del_id(bundle_ids): @@ -98,7 +97,6 @@ def import_update(): print('') if len(needs_update) > 0: combine_and_update(needs_update) - html_root.gen_help() if len(then_delete) > 0: print('cleanup _in folder ...') for x in then_delete: diff --git a/src/z_dependency.svg b/src/z_dependency.svg index 4ae51db..5a58206 100644 --- a/src/z_dependency.svg +++ b/src/z_dependency.svg @@ -1,156 +1,156 @@ - + Dependency - + . - -. - - -html_root - -html_root - - -.->html_root - - + +. -download_itunes - -download_itunes +download_itunes + +download_itunes -.->download_itunes - - +.->download_itunes + + -bundle_combine - -bundle_combine +bundle_combine + +bundle_combine -.->bundle_combine - - +.->bundle_combine + + download_tracker - -download_tracker + +download_tracker .->download_tracker - - + + -index_app_names - -index_app_names +index_app_names + +index_app_names -download_itunes->index_app_names - - +download_itunes->index_app_names + + index_rank - -index_rank + +index_rank -bundle_combine->index_rank - - +bundle_combine->index_rank + + -index_domains - -index_domains +index_domains + +index_domains -bundle_combine->index_domains - - - - -index_app_names->index_rank - - +bundle_combine->index_domains + + -index_categories - -index_categories +index_categories + +index_categories -index_app_names->index_categories - - +index_app_names->index_categories + + - -html_bundle - -html_bundle - - -index_rank->html_bundle - - + +index_app_names->index_rank + + -html_index_domains - -html_index_domains +html_index_domains + +html_index_domains - -index_rank->html_index_domains - - - - -index_domains->html_index_domains - - - - -html_index_apps - -html_index_apps - - -index_categories->html_index_apps - - + +index_app_names->html_index_domains + + -html_categories - -html_categories +html_categories + +html_categories -index_categories->html_categories - - +index_categories->html_categories + + + + +html_index_apps + +html_index_apps + + +index_categories->html_index_apps + + + + +html_bundle + +html_bundle + + +index_rank->html_bundle + + + + +html_root + +html_root + + +html_index_domains->html_root + + -html_ranking - -html_ranking - - -html_index_apps->html_ranking - - +html_ranking + +html_ranking -html_categories->html_ranking - - +html_categories->html_ranking + + + + +html_index_apps->html_ranking + + + + +index_domains->html_index_domains + + \ No newline at end of file