| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 857453f commit 941e694
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -142,7 +142,7 @@ def main(params=None): | |||
| 142 | 142 | print(general.title(banner.text)) | |
| 143 | 143 | ||
| 144 | 144 | saying_hello = """ | |
| 145 | - Checkfy | Copyright (C) Yaiza Rubio & Félix Brezo (i3visio) 2014-2018 | ||
| 145 | + Checkfy | Copyright (C) Yaiza Rubio & Félix Brezo (i3visio) 2014-2020 | ||
| 146 | 146 | ||
| 147 | 147 | This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you | |
| 148 | 148 | are welcome to redistribute it under certain conditions. For additional info, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -491,7 +491,7 @@ def main(params=None): | |||
| 491 | 491 | print(general.title(banner.text)) | |
| 492 | 492 | ||
| 493 | 493 | saying_hello = f""" | |
| 494 | - Domainfy | Copyright (C) Yaiza Rubio & Félix Brezo (i3visio) 2014-2019 | ||
| 494 | + Domainfy | Copyright (C) Yaiza Rubio & Félix Brezo (i3visio) 2014-2020 | ||
| 495 | 495 | ||
| 496 | 496 | This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you | |
| 497 | 497 | are welcome to redistribute it under certain conditions. For additional info, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,6 @@ | |||
| 1 | - #!/usr/bin/python2 | ||
| 2 | - # -*- coding: utf-8 -*- | ||
| 3 | - # | ||
| 4 | 1 | ################################################################################ | |
| 5 | 2 | # | |
| 6 | - # Copyright 2015-2018 Félix Brezo and Yaiza Rubio | ||
| 3 | + # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | ||
| 7 | 4 | # | |
| 8 | 5 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
| 9 | 6 | # it under the terms of the GNU Affero General Public License as published by | |
@@ -20,7 +17,6 @@ | |||
| 20 | 17 | # | |
| 21 | 18 | ################################################################################ | |
| 22 | 19 | ||
| 23 | - | ||
| 24 | 20 | import argparse | |
| 25 | 21 | import datetime as dt | |
| 26 | 22 | import json | |
@@ -34,93 +30,85 @@ | |||
| 34 | 30 | import osrframework.utils.general as general | |
| 35 | 31 | ||
| 36 | 32 | ||
| 37 | - def processPhoneList(platformNames=[], numbers=[], excludePlatformNames=[]): | ||
| 38 | - """ | ||
| 39 | - Method to perform searchs on a series of numbers. | ||
| 33 | + def process_phone_list(platformNames=[], numbers=[], exclude_platform_names=[]): | ||
| 34 | + """Method to perform searchs on a series of numbers | ||
| 40 | 35 | ||
| 41 | 36 | Args: | |
| 42 | - ----- | ||
| 43 | 37 | platformNames: List of names of the platforms. | |
| 44 | 38 | numbers: List of numbers to be queried. | |
| 45 | - excludePlatformNames: A list of platforms not to be searched. | ||
| 39 | + exclude_platform_names: A list of platforms not to be searched. | ||
| 46 | 40 | ||
| 47 | 41 | Return: | |
| 48 | - ------- | ||
| 49 | 42 | A list of verified emails. | |
| 50 | 43 | """ | |
| 51 | 44 | # Grabbing the <Platform> objects | |
| 52 | - platforms = platform_selection.getPlatformsByName(platformNames, mode="phonefy", excludePlatformNames=excludePlatformNames) | ||
| 45 | + platforms = platform_selection.get_platforms_by_name(platformNames, mode="phonefy", exclude_platform_names=exclude_platform_names) | ||
| 53 | 46 | ||
| 54 | 47 | results = [] | |
| 55 | 48 | for num in numbers: | |
| 56 | 49 | for pla in platforms: | |
| 57 | 50 | # This returns a json.txt! | |
| 58 | - entities = pla.getInfo(query=num, process=True, mode="phonefy") | ||
| 51 | + entities = pla.get_info(query=num, mode="phonefy") | ||
| 59 | 52 | if entities != {}: | |
| 60 | - results+=json.loads(entities) | ||
| 53 | + results += json.loads(entities) | ||
| 61 | 54 | return results | |
| 62 | 55 | ||
| 63 | 56 | ||
| 64 | - def getParser(): | ||
| 65 | - DEFAULT_VALUES = configuration.returnListOfConfigurationValues("phonefy") | ||
| 57 | + def get_parser(): | ||
| 58 | + DEFAULT_VALUES = configuration.get_configuration_values_for("phonefy") | ||
| 66 | 59 | # Capturing errors just in case the option is not found in the configuration | |
| 67 | 60 | try: | |
| 68 | - excludeList = [DEFAULT_VALUES["exclude_platforms"]] | ||
| 61 | + exclude_list = [DEFAULT_VALUES["exclude_platforms"]] | ||
| 69 | 62 | except: | |
| 70 | - excludeList = [] | ||
| 63 | + exclude_list = [] | ||
| 71 | 64 | ||
| 72 | 65 | parser = argparse.ArgumentParser(description='phonefy - Piece of software that checks the existence of a given series of phones in a bunch of phone number lists associated to malicious activities.', prog='phonefy', epilog='Check the README.md file for further details on the usage of this program or follow us on Twitter in <http://twitter.com/i3visio>.', add_help=False, conflict_handler='resolve') | |
| 73 | 66 | parser._optionals.title = "Input options (one required)" | |
| 74 | 67 | ||
| 75 | 68 | # Defining the mutually exclusive group for the main options | |
| 76 | - groupMainOptions = parser.add_mutually_exclusive_group(required=True) | ||
| 69 | + group_main_options = parser.add_mutually_exclusive_group(required=True) | ||
| 77 | 70 | # Adding the main options | |
| 78 | - groupMainOptions.add_argument('--license', required=False, action='store_true', default=False, help='shows the GPLv3+ license and exists.') | ||
| 79 | - groupMainOptions.add_argument('-n', '--numbers', metavar='<phones>', nargs='+', action='store', help='the list of phones to process (at least one is required).') | ||
| 71 | + group_main_options.add_argument('--license', required=False, action='store_true', default=False, help='shows the GPLv3+ license and exists.') | ||
| 72 | + group_main_options.add_argument('-n', '--numbers', metavar='<phones>', nargs='+', action='store', help='the list of phones to process (at least one is required).') | ||
| 80 | 73 | ||
| 81 | - listAll = platform_selection.getAllPlatformNames("phonefy") | ||
| 74 | + list_all = platform_selection.get_all_platform_names("phonefy") | ||
| 82 | 75 | ||
| 83 | 76 | # Configuring the processing options | |
| 84 | - groupProcessing = parser.add_argument_group('Processing arguments', 'Configuring the way in which usufy will process the identified profiles.') | ||
| 85 | - #groupProcessing.add_argument('-L', '--logfolder', metavar='<path_to_log_folder', required=False, default = './logs', action='store', help='path to the log folder. If none was provided, ./logs is assumed.') | ||
| 86 | - groupProcessing.add_argument('-e', '--extension', metavar='<sum_ext>', nargs='+', choices=['csv', 'gml', 'json', 'ods', 'png', 'txt', 'xls', 'xlsx' ], required=False, default=DEFAULT_VALUES["extension"], action='store', help='output extension for the summary files. Default: xls.') | ||
| 87 | - groupProcessing.add_argument('-o', '--output_folder', metavar='<path_to_output_folder>', required=False, default=DEFAULT_VALUES["output_folder"], action='store', help='output folder for the generated documents. While if the paths does not exist, usufy.py will try to create; if this argument is not provided, usufy will NOT write any down any data. Check permissions if something goes wrong.') | ||
| 88 | - groupProcessing.add_argument('-p', '--platforms', metavar='<platform>', choices=listAll, nargs='+', required=False, default=DEFAULT_VALUES["platforms"] ,action='store', help='select the platforms where you want to perform the search amongst the following: ' + str(listAll) + '. More than one option can be selected.') | ||
| 89 | - # Getting a sample header for the output files | ||
| 90 | - groupProcessing.add_argument('-F', '--file_header', metavar='<alternative_header_file>', required=False, default=DEFAULT_VALUES["file_header"], action='store', help='Header for the output filenames to be generated. If None was provided the following will be used: profiles.<extension>.' ) | ||
| 91 | - groupProcessing.add_argument('--quiet', required=False, action='store_true', default=False, help='tells the program not to show anything.') | ||
| 92 | - groupProcessing.add_argument('-w', '--web_browser', required=False, action='store_true', help='opening the URIs returned in the default web browser.') | ||
| 93 | - groupProcessing.add_argument('-x', '--exclude', metavar='<platform>', choices=listAll, nargs='+', required=False, default=excludeList, action='store', help='select the platforms that you want to exclude from the processing.') | ||
| 77 | + group_processing = parser.add_argument_group('Processing arguments', 'Configuring the way in which usufy will process the identified profiles.') | ||
| 78 | + group_processing.add_argument('-e', '--extension', metavar='<sum_ext>', nargs='+', choices=['csv', 'gml', 'json', 'ods', 'png', 'txt', 'xls', 'xlsx' ], required=False, default=DEFAULT_VALUES["extension"], action='store', help='output extension for the summary files. Default: xls.') | ||
| 79 | + group_processing.add_argument('-o', '--output_folder', metavar='<path_to_output_folder>', required=False, default=DEFAULT_VALUES["output_folder"], action='store', help='output folder for the generated documents. While if the paths does not exist, usufy.py will try to create; if this argument is not provided, usufy will NOT write any down any data. Check permissions if something goes wrong.') | ||
| 80 | + group_processing.add_argument('-p', '--platforms', metavar='<platform>', choices=list_all, nargs='+', required=False, default=DEFAULT_VALUES["platforms"] ,action='store', help='select the platforms where you want to perform the search amongst the following: ' + str(list_all) + '. More than one option can be selected.') | ||
| 81 | + group_processing.add_argument('-F', '--file_header', metavar='<alternative_header_file>', required=False, default=DEFAULT_VALUES["file_header"], action='store', help='Header for the output filenames to be generated. If None was provided the following will be used: profiles.<extension>.' ) | ||
| 82 | + group_processing.add_argument('--quiet', required=False, action='store_true', default=False, help='tells the program not to show anything.') | ||
| 83 | + group_processing.add_argument('-w', '--web_browser', required=False, action='store_true', help='opening the URIs returned in the default web browser.') | ||
| 84 | + group_processing.add_argument('-x', '--exclude', metavar='<platform>', choices=list_all, nargs='+', required=False, default=exclude_list, action='store', help='select the platforms that you want to exclude from the processing.') | ||
| 94 | 85 | ||
| 95 | 86 | ||
| 96 | 87 | # About options | |
| 97 | - groupAbout = parser.add_argument_group('About arguments', 'Showing additional information about this program.') | ||
| 98 | - groupAbout.add_argument('-h', '--help', action='help', help='shows this help and exists.') | ||
| 99 | - groupAbout.add_argument('--version', action='version', version='[%(prog)s] OSRFramework ' + osrframework.__version__, help='shows the version of the program and exists.') | ||
| 88 | + group_about = parser.add_argument_group('About arguments', 'Showing additional information about this program.') | ||
| 89 | + group_about.add_argument('-h', '--help', action='help', help='shows this help and exists.') | ||
| 90 | + group_about.add_argument('--version', action='version', version='[%(prog)s] OSRFramework ' + osrframework.__version__, help='shows the version of the program and exists.') | ||
| 100 | 91 | ||
| 101 | 92 | return parser | |
| 102 | 93 | ||
| 103 | 94 | ||
| 104 | 95 | def main(params=None): | |
| 105 | - """ | ||
| 106 | - Main function to launch phonefy. | ||
| 96 | + """Main function to launch phonefy | ||
| 107 | 97 | ||
| 108 | 98 | The function is created in this way so as to let other applications make | |
| 109 | 99 | use of the full configuration capabilities of the application. The | |
| 110 | - parameters received are used as parsed by this modules `getParser()`. | ||
| 100 | + parameters received are used as parsed by this modules `get_parser()`. | ||
| 111 | 101 | ||
| 112 | 102 | Args: | |
| 113 | - ----- | ||
| 114 | 103 | params: A list with the parameters as grabbed by the terminal. It is | |
| 115 | 104 | None when this is called by an entry_point. If it is called by osrf | |
| 116 | 105 | the data is already parsed. | |
| 117 | 106 | ||
| 118 | 107 | Returns: | |
| 119 | - -------- | ||
| 120 | 108 | A list of i3visio entities. | |
| 121 | 109 | """ | |
| 122 | 110 | if params == None: | |
| 123 | - parser = getParser() | ||
| 111 | + parser = get_parser() | ||
| 124 | 112 | args = parser.parse_args(params) | |
| 125 | 113 | else: | |
| 126 | 114 | args = params | |
@@ -130,25 +118,25 @@ def main(params=None): | |||
| 130 | 118 | if not args.quiet: | |
| 131 | 119 | print(general.title(banner.text)) | |
| 132 | 120 | ||
| 133 | - sayingHello = """ | ||
| 134 | - Phonefy | Copyright (C) Yaiza Rubio & Félix Brezo (i3visio) 2014-2018 | ||
| 121 | + saying_hello = f""" | ||
| 122 | + Phonefy | Copyright (C) Yaiza Rubio & Félix Brezo (i3visio) 2014-2020 | ||
| 135 | 123 | ||
| 136 | 124 | This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you | |
| 137 | 125 | are welcome to redistribute it under certain conditions. For additional info, | |
| 138 | - visit <{}>. | ||
| 139 | - """.format(general.LICENSE_URL) | ||
| 140 | - print(general.info(sayingHello)) | ||
| 126 | + visit <{general.LICENSE_URL}>. | ||
| 127 | + """ | ||
| 128 | + print(general.info(saying_hello)) | ||
| 141 | 129 | ||
| 142 | 130 | if args.license: | |
| 143 | 131 | general.showLicense() | |
| 144 | 132 | else: | |
| 145 | 133 | # Showing the execution time... | |
| 146 | - startTime= dt.datetime.now() | ||
| 147 | - #TODO: Get the number searchable platforms in this context | ||
| 148 | - print(str(startTime) + "\tStarting search in different platform(s)... Relax!\n") | ||
| 134 | + start_time = dt.datetime.now() | ||
| 135 | + | ||
| 136 | + print(f"\n{start_time}\tStarting search in different platform(s)... Relax!\n") | ||
| 149 | 137 | print(general.emphasis("\tPress <Ctrl + C> to stop...\n")) | |
| 150 | 138 | try: | |
| 151 | - results = processPhoneList(platformNames=args.platforms, numbers=args.numbers, excludePlatformNames=args.exclude) | ||
| 139 | + results = process_phone_list(platformNames=args.platforms, numbers=args.numbers, exclude_platform_names=args.exclude) | ||
| 152 | 140 | except KeyboardInterrupt: | |
| 153 | 141 | print(general.error("\n[!] Process manually stopped by the user. Workers terminated without providing any result.\n")) | |
| 154 | 142 | ||
@@ -158,32 +146,30 @@ def main(params=None): | |||
| 158 | 146 | if not os.path.exists(args.output_folder): | |
| 159 | 147 | os.makedirs(args.output_folder) | |
| 160 | 148 | # Grabbing the results | |
| 161 | - fileHeader = os.path.join(args.output_folder, args.file_header) | ||
| 149 | + file_header = os.path.join(args.output_folder, args.file_header) | ||
| 162 | 150 | for ext in args.extension: | |
| 163 | 151 | # Generating output files | |
| 164 | - general.exportUsufy(results, ext, fileHeader) | ||
| 152 | + general.export_usufy(results, ext, file_header) | ||
| 165 | 153 | ||
| 166 | 154 | # Showing the information gathered if requested | |
| 167 | 155 | if not args.quiet: | |
| 168 | 156 | now = dt.datetime.now() | |
| 169 | - print("\n{}\tResults obtained:\n".format(str(now))) | ||
| 170 | - print(general.success(general.usufyToTextExport(results))) | ||
| 157 | + print(f"\n{now}\tResults obtained:\n") | ||
| 158 | + print(general.success(general.osrf_to_text_export(results))) | ||
| 171 | 159 | ||
| 172 | 160 | if args.web_browser: | |
| 173 | - general.openResultsInBrowser(results) | ||
| 161 | + general.open_results_in_browser(results) | ||
| 174 | 162 | ||
| 175 | 163 | now = dt.datetime.now() | |
| 176 | - print("\n" + str(now) + "\tYou can find all the information collected in the following files:") | ||
| 164 | + print(f"\n{now}\tYou can find all the information collected in the following files:") | ||
| 177 | 165 | for ext in args.extension: | |
| 178 | 166 | # Showing the output files | |
| 179 | - print("\t" + general.emphasis(fileHeader + "." + ext)) | ||
| 167 | + print("\t" + general.emphasis(file_header + "." + ext)) | ||
| 180 | 168 | ||
| 181 | 169 | # Showing the execution time... | |
| 182 | - endTime= dt.datetime.now() | ||
| 183 | - print("\n" + str(endTime) +"\tFinishing execution...\n") | ||
| 184 | - print("Total time consumed:\t" + general.emphasis(str(endTime-startTime)) + "\n") | ||
| 185 | - #TODO: Get the number searchable platforms in this context | ||
| 186 | - #print("Average seconds/query:\t" + general.emphasis(str((endTime-startTime).total_seconds()/len(listPlatforms))) +" seconds\n") | ||
| 170 | + end_time = dt.datetime.now() | ||
| 171 | + print(f"\n{end_time}\tFinishing execution...\n") | ||
| 172 | + print("Total time consumed:\t" + general.emphasis(str(end_time-start_time)) + "\n") | ||
| 187 | 173 | ||
| 188 | 174 | # Urging users to place an issue on Github... | |
| 189 | 175 | print(banner.footer) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,7 +25,7 @@ | |||
| 25 | 25 | import osrframework.utils.errors as errors | |
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | - def changePermissionsRecursively(path, uid, gid): | ||
| 28 | + def change_permissions_recursively(path, uid, gid): | ||
| 29 | 29 | """Function to recursively change the user id and group id | |
| 30 | 30 | ||
| 31 | 31 | It sets 700 permissions in the different files. | |
@@ -54,7 +54,7 @@ def changePermissionsRecursively(path, uid, gid): | |||
| 54 | 54 | # Setting permissions | |
| 55 | 55 | os.chmod(itempath, 6600) | |
| 56 | 56 | # Recursive function to iterate the files | |
| 57 | - changePermissionsRecursively(itempath, uid, gid) | ||
| 57 | + change_permissions_recursively(itempath, uid, gid) | ||
| 58 | 58 | ||
| 59 | 59 | ||
| 60 | 60 | def get_config_path(config_file_name=None): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,19 +48,19 @@ def export_usufy(data, ext, fileH): | |||
| 48 | 48 | if ext == "csv": | |
| 49 | 49 | osrf_to_csv_export(data, fileH+"."+ext) | |
| 50 | 50 | elif ext == "gml": | |
| 51 | - usufyToGmlExport(data, fileH+"."+ext) | ||
| 51 | + osrf_to_gml_export(data, fileH+"."+ext) | ||
| 52 | 52 | elif ext == "json": | |
| 53 | 53 | osrf_to_json_export(data, fileH+"."+ext) | |
| 54 | 54 | elif ext == "ods": | |
| 55 | 55 | osrf_to_ods_export(data, fileH+"."+ext) | |
| 56 | 56 | elif ext == "png": | |
| 57 | - usufyToPngExport(data, fileH+"."+ext) | ||
| 57 | + osrf_to_png_export(data, fileH+"."+ext) | ||
| 58 | 58 | elif ext == "txt": | |
| 59 | 59 | osrf_to_text_export(data, fileH+"."+ext) | |
| 60 | 60 | elif ext == "xls": | |
| 61 | - usufy_to_xls_export(data, fileH+"."+ext) | ||
| 61 | + osrf_to_xls_export(data, fileH+"."+ext) | ||
| 62 | 62 | elif ext == "xlsx": | |
| 63 | - usufy_to_xlsx_export(data, fileH+"."+ext) | ||
| 63 | + osrf_to_xlsx_export(data, fileH+"."+ext) | ||
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | 66 | def _generate_tabular_data(res, oldtabular_data={}, is_terminal=False): | |
@@ -70,8 +70,8 @@ def _generate_tabular_data(res, oldtabular_data={}, is_terminal=False): | |||
| 70 | 70 | This method is used by: | |
| 71 | 71 | - osrf_to_csv_export | |
| 72 | 72 | - osrf_to_ods_export | |
| 73 | - - usufy_to_xls_export | ||
| 74 | - - usufy_to_xlsx_export | ||
| 73 | + - osrf_to_xls_export | ||
| 74 | + - osrf_to_xlsx_export | ||
| 75 | 75 | ||
| 76 | 76 | Args: | |
| 77 | 77 | res: New data to export. | |
@@ -363,7 +363,7 @@ def osrf_to_ods_export(data, file_path): | |||
| 363 | 363 | save_data(file_path, tabular_data) | |
| 364 | 364 | ||
| 365 | 365 | ||
| 366 | - def usufy_to_xls_export(data, file_path): | ||
| 366 | + def osrf_to_xls_export(data, file_path): | ||
| 367 | 367 | """ | |
| 368 | 368 | Workaround to export to a .xls file. | |
| 369 | 369 | ||
@@ -387,7 +387,7 @@ def usufy_to_xls_export(data, file_path): | |||
| 387 | 387 | save_data(file_path, tabular_data) | |
| 388 | 388 | ||
| 389 | 389 | ||
| 390 | - def usufy_to_xlsx_export(data, file_path): | ||
| 390 | + def osrf_to_xlsx_export(data, file_path): | ||
| 391 | 391 | """ | |
| 392 | 392 | Workaround to export to a .xlsx file. | |
| 393 | 393 | ||
@@ -555,7 +555,7 @@ def _processAttributes(elems, g): | |||
| 555 | 555 | return graphData | |
| 556 | 556 | ||
| 557 | 557 | ||
| 558 | - def usufyToGmlExport(d, file_path): | ||
| 558 | + def osrf_to_gml_export(d, file_path): | ||
| 559 | 559 | """Workaround to export data to a .gml file. | |
| 560 | 560 | ||
| 561 | 561 | Args: | |
@@ -584,7 +584,7 @@ def usufyToGmlExport(d, file_path): | |||
| 584 | 584 | nx.write_gml(newGraph,file_path) | |
| 585 | 585 | ||
| 586 | 586 | ||
| 587 | - def usufyToPngExport(d, file_path): | ||
| 587 | + def osrf_to_png_export(d, file_path): | ||
| 588 | 588 | """Workaround to export to a png file. | |
| 589 | 589 | ||
| 590 | 590 | Args: | |
@@ -688,7 +688,7 @@ def urisToBrowser(uris=[], autoraise=True): | |||
| 688 | 688 | os.dup2(savout2, 2) | |
| 689 | 689 | ||
| 690 | 690 | ||
| 691 | - def openResultsInBrowser(res): | ||
| 691 | + def open_results_in_browser(res): | ||
| 692 | 692 | """Method that collects the URI from a list of entities and opens them | |
| 693 | 693 | ||
| 694 | 694 | Args: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments