Import upstream version 0.20.2
Kali Janitor
3 years ago
0 | 0 | Metadata-Version: 2.1 |
1 | 1 | Name: osrframework |
2 | Version: 0.20.1 | |
2 | Version: 0.20.2 | |
3 | 3 | Summary: OSRFramework - A set of AGPLv3+ OSINT tools developed by i3visio analysts for online research. |
4 | 4 | Home-page: http://github.com/i3visio/osrframework |
5 | 5 | Author: Felix Brezo and Yaiza Rubio |
6 | 6 | Author-email: [email protected] |
7 | 7 | License: COPYING |
8 | Description: OSRFramework | |
9 | ============ | |
10 | ||
11 | OSRFramework: Open Sources Research Framework | |
12 | ||
13 | Copyright (C) 2014-2020 F. Brezo and Y. Rubio, i3visio | |
14 | ||
15 | [![Version in PyPI](https://img.shields.io/pypi/v/osrframework.svg)]() | |
16 | [![License](https://img.shields.io/badge/license-GNU%20Affero%20General%20Public%20License%20Version%203%20or%20Later-blue.svg)]() | |
17 | ||
18 | 1 - Description | |
19 | --------------- | |
20 | ||
21 | OSRFramework is a GNU AGPLv3+ set of libraries developed by i3visio to perform Open Source Intelligence collection tasks. | |
22 | They include references to a bunch of different applications related to username checking, DNS lookups, information leaks research, deep web search, regular expressions extraction and many others. | |
23 | At the same time, by means of ad-hoc Maltego transforms, OSRFramework provides a way of making these queries graphically as well as several interfaces to interact with like OSRFConsole or a Web interface. | |
24 | ||
25 | 2 - License: GNU AGPLv3+ | |
26 | ------------------------ | |
27 | ||
28 | This is free software, and you are welcome to redistribute it under certain conditions. | |
29 | ||
30 | This program is free software: you can redistribute it and/or modify | |
31 | it under the terms of the GNU Affero General Public License as published by | |
32 | the Free Software Foundation, either version 3 of the License, or | |
33 | (at your option) any later version. | |
34 | ||
35 | This program is distributed in the hope that it will be useful, | |
36 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
37 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
38 | GNU Affero General Public License for more details. | |
39 | ||
40 | You should have received a copy of the GNU Affero General Public License | |
41 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
42 | ||
43 | ||
44 | For more details on this issue, check the [COPYING](COPYING) file. | |
45 | ||
46 | 3 - Installation | |
47 | ---------------- | |
48 | ||
49 | Fast way to do it on any system for a user with administration privileges: | |
50 | ``` | |
51 | pip3 install osrframework | |
52 | ``` | |
53 | You can upgrade to the latest release of the framework with: | |
54 | ``` | |
55 | pip3 install osrframework --upgrade | |
56 | ``` | |
57 | This will manage all the dependencies for you and install the latest version of the framework. | |
58 | ||
59 | If you needed further information on how to install OSRFramework on certain systems, note that you may need to add `export PATH=$PATH:$HOME/.local/bin` to your `~/.bashrc_profile`). This has been confirmed in some distributions, including MacOS. | |
60 | In any case, we recommend you yo have a look at the [INSTALL.md](doc/INSTALL.md) file where we provide additional details for these cases. | |
61 | ||
62 | 4 - Basic usage | |
63 | --------------- | |
64 | ||
65 | If everything went correctly (we hope so!), it's time for trying usufy., mailfy and so on. | |
66 | But we are they | |
67 | ? They are installed in your path meaning that you can open a terminal anywhere and typing the name of the program (seems to be an improvement from previous installations...). Examples: | |
68 | ``` | |
69 | osrf --help | |
70 | usufy -n i3visio febrezo yrubiosec -p twitter facebook | |
71 | searchfy -q "i3visio" | |
72 | mailfy -n i3visio | |
73 | ``` | |
74 | ||
75 | Type -h or --help to get more information about which are the parameters of each application. | |
76 | ||
77 | The tools installed in this package include: | |
78 | ||
79 | - `alais_generator`. Generates candidate nicknames based on known info about the target. **Input**: information about the target. **Output**: list of possible nicknames. | |
80 | - `checkfy`. Guesses possible emails based on a list of candidate nicknames and a pattern. **Input**: list of nicknames and an email pattern. **Output**. list of emails matching the pattern.. | |
81 | - `domainfy`. Finds domains that currently resolve using a given word or nickname. **Input**: liat of words. **Output**: domains using that word that currently resolve. | |
82 | - `mailfy`. Find more information about emails taken as a reference either a nickname (to generate a list of possible emails) or the email list. **Input**: list of nicknames or emails. **Output**: found information about the email. | |
83 | - `osrf`. Shared wrapper for the rest of the applications. All commands can also be used as `osrf usufy…`, `osrf mailfy…`, etc. | |
84 | - `phonefy`. Recovers information about mobile phones linked to known spam practices. **Inputs**: list of phones. **Outputs**: Phones linked to spam. | |
85 | - `searchfy`. Finds profiles linked to a fullname. **Inputs**: list of phones. **Outputs**: Known profiles linked to the query. | |
86 | - `usufy`. Identifies socialmedia profiles using a given nickname. **Inputs**: list of nicknames. **Outputs**: Known profiles in socialmedia using those nicknames. | |
87 | ||
88 | You can find the configuration files in a folder created in your user home to define the default behaviour of the applications: | |
89 | ``` | |
90 | # Configuration files for Linux and MacOS | |
91 | ~/.config/OSRFramework/ | |
92 | # Configuration files for Windows | |
93 | C:\Users\<User>\OSRFramework\ | |
94 | ``` | |
95 | ||
96 | OSRFramework will look for the configuration settings for each application stored there. | |
97 | You can add new credentials there and if something goes wrong, you can always restore the files stored in the `defaults` subfolder. | |
98 | ||
99 | If you are experiencing problems, you might fight relevant information in the (FAQ Section)[doc/FAQ.md]. | |
100 | ||
101 | 5 - HACKING | |
102 | ----------- | |
103 | ||
104 | If you want to extend the functionalities of OSRFramework and you do not know where to start from, check the [HACKING.md](doc/HACKING.md) file. | |
105 | ||
106 | 6 - AUTHORS | |
107 | ----------- | |
108 | ||
109 | More details about the authors in the [AUTHORS.md](AUTHORS.md) file. | |
110 | ||
8 | Description: UNKNOWN | |
111 | 9 | Keywords: python osint harvesting profiling username socialmedia forums |
112 | 10 | Platform: UNKNOWN |
113 | 11 | Classifier: Development Status :: 4 - Beta |
40 | 40 | |
41 | 41 | Fast way to do it on any system for a user with administration privileges: |
42 | 42 | ``` |
43 | pip3 install osrframework | |
43 | sudo pip3 install osrframework | |
44 | 44 | ``` |
45 | 45 | You can upgrade to the latest release of the framework with: |
46 | 46 | ``` |
47 | pip3 install osrframework --upgrade | |
47 | sudo pip3 install osrframework --upgrade | |
48 | 48 | ``` |
49 | 49 | This will manage all the dependencies for you and install the latest version of the framework. |
50 | 50 | |
55 | 55 | --------------- |
56 | 56 | |
57 | 57 | If everything went correctly (we hope so!), it's time for trying usufy., mailfy and so on. |
58 | But we are they | |
59 | ? They are installed in your path meaning that you can open a terminal anywhere and typing the name of the program (seems to be an improvement from previous installations...). Examples: | |
58 | But where are they locally? They are installed in your path meaning that you can open a terminal anywhere and typing the name of the program (seems to be an improvement from previous installations...). Examples: | |
59 | ||
60 | 60 | ``` |
61 | 61 | osrf --help |
62 | 62 | usufy -n i3visio febrezo yrubiosec -p twitter facebook |
0 | ################################################################################ | |
0 | # !/usr/bin/python | |
1 | # -*- coding: utf-8 -*- | |
1 | 2 | # |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | ################################################################################## | |
4 | # | |
5 | # Copyright 2016-2017 Félix Brezo and Yaiza Rubio (i3visio, [email protected]) | |
3 | 6 | # |
4 | 7 | # This program is part of OSRFramework. You can redistribute it and/or modify |
5 | 8 | # it under the terms of the GNU Affero General Public License as published by |
14 | 17 | # You should have received a copy of the GNU Affero General Public License |
15 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 19 | # |
17 | ################################################################################ | |
20 | ################################################################################## | |
18 | 21 | |
19 | 22 | __author__ = "John Doe <[email protected]>" |
20 | 23 | __version__ = "1.0" |
23 | 26 | import json |
24 | 27 | import re |
25 | 28 | import sys |
29 | import urllib2 | |
26 | 30 | |
27 | 31 | import osrframework.utils.browser as browser |
28 | 32 | from osrframework.utils.platforms import Platform |
0 | # -*- coding: utf-8 -*- | |
1 | # | |
0 | 2 | ################################################################################ |
1 | 3 | # |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
4 | # Copyright 2018 Félix Brezo and Yaiza Rubio (i3visio, [email protected]) | |
3 | 5 | # |
4 | 6 | # This program is part of OSRFramework. You can redistribute it and/or modify |
5 | 7 | # it under the terms of the GNU Affero General Public License as published by |
20 | 22 | __version__ = "2.0" |
21 | 23 | |
22 | 24 | from osrframework.utils.platforms import Platform |
23 | ||
25 | import urllib2 | |
24 | 26 | |
25 | 27 | class Demo(Platform): |
26 | 28 | """ |
75 | 77 | ------- |
76 | 78 | Returns the collected data if exists or None if not. |
77 | 79 | """ |
78 | return query if query urllib3.open("https://demo.demo/{}".format(query)) else None | |
80 | return query if query urllib2.open("https://demo.demo/{}".format(query)) else None |
9 | 9 | ``` |
10 | 10 | python --version |
11 | 11 | ``` |
12 | ||
13 | 12 | If you get errors at this point or the Python version is not appeating, your system is not yet prepared. You will need to install Python 3.6 from the official website: |
14 | ||
15 | 13 | ``` |
16 | 14 | https://www.python.org/downloads/ |
17 | 15 | ``` |
18 | ||
19 | 16 | Follow the installation steps for your system. Note that in one step of the Windows installation process you WILL NEED to manually add c:\Python36 and C:\Python36\scripts to the system. Try again after completing this task. |
20 | ||
21 | If using OSRFramework < 0.20.0 (Python 2) only, it is recommemded to uninstall the Python 2 package. | |
22 | ||
23 | ``` | |
24 | pip2 uninstall osrframework | |
25 | ``` | |
26 | 17 | |
27 | 18 | Now it's the turn of the package manager. Check that you have the pip version installed. `pip` SHOULD mostly work, but just in case and for legacy compatibilities with systems also using `pip` for Python 2, `pip3` is preferred: |
28 | 19 |
16 | 16 | # |
17 | 17 | ################################################################################ |
18 | 18 | |
19 | __version__ = "0.20.1" | |
19 | __version__ = "0.20.2" |
0 | ################################################################################ | |
0 | #!/usr/bin/env python | |
1 | # encoding: utf-8 | |
1 | 2 | # |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | ################################################################################## | |
3 | 4 | # |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
5 | # Copyright 2015 Félix Brezo and Yaiza Rubio (i3visio, [email protected]) | |
6 | # | |
7 | # This file is part of OSRFramework. You can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
6 | 9 | # the Free Software Foundation, either version 3 of the License, or |
7 | 10 | # (at your option) any later version. |
8 | 11 | # |
9 | 12 | # This program is distributed in the hope that it will be useful, |
10 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | # GNU Affero General Public License for more details. | |
15 | # GNU General Public License for more details. | |
13 | 16 | # |
14 | # You should have received a copy of the GNU Affero General Public License | |
17 | # You should have received a copy of the GNU General Public License | |
15 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 19 | # |
17 | ################################################################################ | |
20 | ################################################################################## | |
18 | 21 | |
19 | 22 | import argparse |
20 | 23 | import json |
480 | 483 | except: |
481 | 484 | # Error... We will have to wait |
482 | 485 | waiting = True |
483 | print("No more queries remaining, sleeping for " + str(waitTime) +" seconds...") | |
486 | print "No more queries remaining, sleeping for " + str(waitTime) +" seconds..." | |
484 | 487 | time.sleep(waitTime) """ |
485 | 488 | |
486 | 489 | new_tweets = _getNewTweets(api, screen_name, oldest=oldest) |
737 | 740 | |
738 | 741 | page = 0 |
739 | 742 | |
743 | # print "Getting page %s of new users..." % page+1 | |
740 | 744 | # Making the call to the API |
741 | 745 | try: |
742 | 746 | newUsers = api.search_users(query, n, page) |
445 | 445 | |
446 | 446 | # Configuring the processing options |
447 | 447 | group_processing = parser.add_argument_group('Processing arguments', 'Configuring the way in which mailfy will process the identified profiles.') |
448 | 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.') | |
449 | 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.') | |
450 | group_processing.add_argument('-t', '--tlds', metavar='<tld_type>', nargs='+', choices=["all", "none"] + list(TLD.keys()), action='store', help='list of TLD types where the nick will be looked for.', required=False, default=DEFAULT_VALUES["tlds"]) | |
451 | group_processing.add_argument('-u', '--user-defined', metavar='<new_tld>', nargs='+', action='store', help='additional TLD that will be searched.', required=False, default=DEFAULT_VALUES["user_defined"]) | |
448 | group_processing.add_argument('-e', '--extension', metavar='<sum_ext>', nargs='+', choices=['csv', 'gml', 'json', 'ods', 'png', 'txt', 'xls', 'xlsx' ], required=False, default=DEFAULT_VALUES.get("extension", ["csv"]), action='store', help='output extension for the summary files. Default: xls.') | |
449 | group_processing.add_argument('-o', '--output-folder', metavar='<path_to_output_folder>', required=False, default=DEFAULT_VALUES.get("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.') | |
450 | group_processing.add_argument('-t', '--tlds', metavar='<tld_type>', nargs='+', choices=["all", "none"] + list(TLD.keys()), action='store', help='list of TLD types where the nick will be looked for.', required=False, default=DEFAULT_VALUE.get("tlds", []) | |
451 | group_processing.add_argument('-u', '--user-defined', metavar='<new_tld>', nargs='+', action='store', help='additional TLD that will be searched.', required=False, default=DEFAULT_VALUES.get("user_defined", [])) | |
452 | 452 | group_processing.add_argument('-x', '--exclude', metavar='<domain>', nargs='+', required=False, default=exclude_list, action='store', help="select the domains to be avoided. The format should include the initial '.'.") |
453 | 453 | 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>.' ) |
454 | 454 | group_processing.add_argument('-T', '--threads', metavar='<num_threads>', required=False, action='store', default=int(DEFAULT_VALUES["threads"]), type=int, help='write down the number of threads to be used (default 16). If 0, the maximum number possible will be used, which may make the system feel unstable.') |
345 | 345 | print(f"\n\t[*] {i+1}/{len(emails)} Checking '{general.title(e)}'...") |
346 | 346 | for pla in platforms: |
347 | 347 | # This returns a json.txt! |
348 | entities = pla.get_info(query=e, mode="mailfy") | |
349 | data = json.loads(entities) | |
350 | if data: | |
351 | results += data | |
348 | entities = pla.do_mailfy(query=e) | |
349 | if entities: | |
350 | results += entities | |
352 | 351 | return results |
353 | 352 | |
354 | 353 | |
377 | 376 | |
378 | 377 | # Configuring the processing options |
379 | 378 | group_processing = parser.add_argument_group('Processing arguments', 'Configuring the way in which mailfy will process the identified profiles.') |
380 | 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.') | |
381 | group_processing.add_argument('-d', '--domains', metavar='<candidate_domains>', nargs='+', choices=['all'] + EMAIL_DOMAINS, action='store', help='list of domains where the nick will be looked for.', required=False, default=DEFAULT_VALUES["domains"]) | |
382 | 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.') | |
379 | group_processing.add_argument('-e', '--extension', metavar='<sum_ext>', nargs='+', choices=['csv', 'gml', 'json', 'ods', 'png', 'txt', 'xls', 'xlsx'], required=False, default=DEFAULT_VALUES.get("extension", ["csv"]), action='store', help='output extension for the summary files. Default: csv.') | |
380 | group_processing.add_argument('-d', '--domains', metavar='<candidate_domains>', nargs='+', choices=['all'] + EMAIL_DOMAINS, action='store', help='list of domains where the nick will be looked for.', required=False, default=DEFAULT_VALUES.get("domains", [])) | |
381 | group_processing.add_argument('-o', '--output-folder', metavar='<path_to_output_folder>', required=False, default=DEFAULT_VALUES.get("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.') | |
383 | 382 | group_processing.add_argument('-p', '--platforms', metavar='<platform>', choices=plat_options, nargs='+', required=False, default=["all"], action='store', help='select the platforms where you want to perform the search amongst the following: {}. More than one option can be selected.'.format(str(plat_options))) |
384 | 383 | group_processing.add_argument('-x', '--exclude', metavar='<domain>', choices=EMAIL_DOMAINS, nargs='+', required=False, default=exclude_list, action='store', help="select the domains to be excluded from the search.") |
385 | 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>.' ) | |
386 | group_processing.add_argument('-T', '--threads', metavar='<num_threads>', required=False, action='store', default = int(DEFAULT_VALUES["threads"]), type=int, help='write down the number of threads to be used (default 16). If 0, the maximum number possible will be used, which may make the system feel unstable.') | |
384 | group_processing.add_argument('-F', '--file-header', metavar='<alternative_header_file>', required=False, default=DEFAULT_VALUES.get("file_header", "profiles"), action='store', help='Header for the output filenames to be generated. If None was provided the following will be used: profiles.<extension>.' ) | |
385 | group_processing.add_argument('-T', '--threads', metavar='<num_threads>', required=False, action='store', default = int(DEFAULT_VALUES.get("threads", 0)), type=int, help='write down the number of threads to be used (default 16). If 0, the maximum number possible will be used, which may make the system feel unstable.') | |
387 | 386 | group_processing.add_argument('--quiet', required=False, action='store_true', default=False, help='tells the program not to show anything.') |
388 | 387 | |
389 | 388 | # About options |
534 | 533 | except KeyError: |
535 | 534 | # API_Key not found |
536 | 535 | config_path = os.path.join(configuration.get_config_path()["appPath"], "api_keys.cfg") |
537 | print(general.warning(f"No API found for HaveIBeenPwned. Request one at <https://haveibeenpwned.com/API/Key> and add it to '{config_path}'.")) | |
536 | print("\t[*] " + general.warning("No API found for HaveIBeenPwned") + f". Request one at <https://haveibeenpwned.com/API/Key> and add it to '{config_path}'.") | |
538 | 537 | except KeyboardInterrupt: |
539 | 538 | print(general.warning("\tStep 3 manually skipped by the user...\n")) |
540 | 539 | |
604 | 603 | print(general.success(general.osrf_to_text_export(results))) |
605 | 604 | |
606 | 605 | now = dt.datetime.now() |
606 | """#TODO fix | |
607 | 607 | print(f"\n{now}\tYou can find all the information collected in the following files:") |
608 | fileHeader = os.path.join(args.output_folder, args.file_header) | |
608 | 609 | for ext in args.extension: |
609 | 610 | # Showing the output files |
610 | print(general.emphasis("\t" + fileHeader + "." + ext)) | |
611 | print(general.emphasis("\t" + fileHeader + "." + ext))""" | |
611 | 612 | |
612 | 613 | # Showing the execution time... |
613 | 614 | if not args.quiet: |
614 | 615 | end_time = dt.datetime.now() |
615 | print("\n{end_time}\tFinishing execution...\n") | |
616 | print(f"\n{end_time}\tFinishing execution...\n") | |
616 | 617 | print("Total time used:\t" + general.emphasis(str(end_time - start_time))) |
617 | 618 | |
618 | 619 | if not args.quiet: |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
0 | # !/usr/bin/python | |
1 | # -*- coding: cp1252 -*- | |
2 | # | |
3 | ################################################################################## | |
3 | 4 | # |
4 | 5 | # This program is part of OSRFramework. You can redistribute it and/or modify |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # it under the terms of the GNU General Public License as published by | |
6 | 7 | # the Free Software Foundation, either version 3 of the License, or |
7 | 8 | # (at your option) any later version. |
8 | 9 | # |
9 | 10 | # This program is distributed in the hope that it will be useful, |
10 | 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
13 | # GNU General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
15 | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 17 | # |
17 | ################################################################################ | |
18 | ################################################################################## | |
18 | 19 | |
19 | 20 | __all__ = ['search'] |
20 | 21 | |
31 | 32 | else: |
32 | 33 | from cookielib import LWPCookieJar |
33 | 34 | from urllib import quote_plus |
34 | from urllib3 import Request, urlopen | |
35 | from urllib2 import Request, urlopen | |
35 | 36 | from urlparse import urlparse, parse_qs |
36 | 37 | |
37 | 38 | # Lazy import of BeautifulSoup. |
68 | 69 | @return: Web page retrieved for the given URL. |
69 | 70 | |
70 | 71 | @raise IOError: An exception is raised on error. |
71 | @raise urllib3.URLError: An exception is raised on error. | |
72 | @raise urllib3.HTTPError: An exception is raised on error. | |
72 | @raise urllib2.URLError: An exception is raised on error. | |
73 | @raise urllib2.HTTPError: An exception is raised on error. | |
73 | 74 | """ |
74 | 75 | request = Request(url) |
75 | 76 | request.add_header('User-Agent', |
233 | 234 | |
234 | 235 | # Returns a generator that yields URLs. |
235 | 236 | def processSearch(query, tld='com', lang='en', num=10, start=0, stop=50, pause=2.0, only_standard=False): |
236 | """Method that recovers the URI for a search returning an i3visio-compliant json object. | |
237 | ||
238 | Returns: | |
239 | dict.json-like object.""" | |
240 | ||
241 | uriList = search(query, tld=tld, lang=lang, num=int(num), start=int(start), stop=int(stop), pause=float(pause),only_standard=only_standard) | |
242 | ||
237 | ''' | |
238 | Method that recovers the URI for a search returning an i3visio-compliant json object. | |
239 | ||
240 | :return: A json-like object. | |
241 | ||
242 | ''' | |
243 | uriList = search(query, tld=tld, lang=lang, num=int(num), start=int(start), stop=int(stop), pause=float(pause),only_standard=only_standard) | |
244 | ||
243 | 245 | # Dictionary containing the URI objects |
244 | 246 | results = [] |
245 | ||
247 | ||
246 | 248 | # Building the objects |
247 | 249 | for uri in uriList: |
248 | 250 | aux = {} |
249 | aux["type"] = "com.i3visio.URI" | |
250 | aux["value"] = uri | |
251 | aux["type"] = "i3visio.uri" | |
252 | aux["value"] = uri | |
251 | 253 | aux["attributes"] = [] |
252 | 254 | results.append(aux) |
253 | 255 | |
254 | 256 | return results |
255 | ||
257 | ||
256 | 258 | # When run as a script... |
257 | 259 | if __name__ == "__main__": |
258 | 260 | parser = argparse.ArgumentParser(description='A package that allows the execution of searches in Google.', prog='google.py', add_help=False) |
270 | 272 | groupAbout.add_argument('--version', action='version', version='%(prog)s 0.1.0', help='shows the version of the program and exists.') |
271 | 273 | args = parser.parse_args() |
272 | 274 | |
273 | print("Searching..." ) | |
274 | ||
275 | print "Searching..." | |
276 | ||
275 | 277 | results = processSearch(args.query, tld=args.tld, lang=args.lang, num=int(args.num), start=int(args.start), stop=int(args.stop), pause=float(args.pause),only_standard=args.only_standard) |
276 | 278 | |
277 | print(json.dumps(results, indent=2)) | |
279 | print json.dumps(results, indent=2) | |
280 |
76 | 76 | |
77 | 77 | # Configuring the processing options |
78 | 78 | group_processing = parser.add_argument_group('Processing arguments', 'Configuring the way in which searchfy will process the identified profiles.') |
79 | 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.') | |
80 | 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>' ) | |
81 | 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.') | |
82 | group_processing.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.') | |
79 | group_processing.add_argument('-e', '--extension', metavar='<sum_ext>', nargs='+', choices=['csv', 'gml', 'json', 'ods', 'png', 'txt', 'xls', 'xlsx' ], required=False, default=DEFAULT_VALUES.get("extension", ["csv"]), action='store', help='output extension for the summary files. Default: xls.') | |
80 | group_processing.add_argument('-F', '--file_header', metavar='<alternative_header_file>', required=False, default=DEFAULT_VALUES.get("file_header", "profiles"), action='store', help='Header for the output filenames to be generated. If None was provided the following will be used: profiles.<extension>' ) | |
81 | group_processing.add_argument('-o', '--output_folder', metavar='<path_to_output_folder>', required=False, default=DEFAULT_VALUES.get("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.') | |
82 | group_processing.add_argument('-p', '--platforms', metavar='<platform>', choices=listAll, nargs='+', required=False, default=DEFAULT_VALUES.get("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.') | |
83 | 83 | group_processing.add_argument('-w', '--web_browser', required=False, action='store_true', help='opening the URIs returned in the default web browser.') |
84 | 84 | group_processing.add_argument('-x', '--exclude', metavar='<platform>', choices=listAll, nargs='+', required=False, default=exclude_list, action='store', help='select the platforms that you want to exclude from the processing.') |
85 | 85 | |
171 | 171 | end_time = dt.datetime.now() |
172 | 172 | print(f"\n{end_time}\tFinishing execution...\n") |
173 | 173 | print("Total time used:\t" + general.emphasis(str(end_time-start_time))) |
174 | print("Average seconds/query:\t" + general.emphasis(str((end_time-start_time).total_seconds()/len(args.platforms))) +" seconds\n") | |
174 | try: | |
175 | print("Average seconds/query:\t" + general.emphasis(str((end_time-start_time).total_seconds()/len(args.platforms))) +" seconds\n") | |
176 | except: | |
177 | pass | |
175 | 178 | |
176 | 179 | # Urging users to place an issue on Github... |
177 | 180 | print(banner.footer) |
16 | 16 | # |
17 | 17 | ################################################################################ |
18 | 18 | |
19 | ||
19 | 20 | import argparse |
20 | 21 | import json |
21 | 22 | import sys |
22 | import urllib3 | |
23 | import urllib2 | |
23 | 24 | |
24 | 25 | |
25 | 26 | def getBitcoinAddressDetails(address=None): |
42 | 43 | apiURL = "https://blockchain.info/rawaddr/" + str(address) |
43 | 44 | |
44 | 45 | # Accessing the HIBP API |
45 | data = urllib3.urlopen(apiURL).read() | |
46 | data = urllib2.urlopen(apiURL).read() | |
46 | 47 | |
47 | 48 | # Reading the text data onto python structures |
48 | 49 | jsonData = json.loads(data) |
20 | 20 | |
21 | 21 | import osrframework.thirdparties.md5crack_com.checkIfHashIsCracked as md5crack_com |
22 | 22 | |
23 | ||
24 | 23 | if __name__ == "__main__": |
25 | 24 | parser = argparse.ArgumentParser(description='A library that wraps a search onto md5crack.com.', prog='checkIfHashIsCracked.py', epilog="NOTE: if not provided, the API key will be searched in the config_api_keys.py file.", add_help=False) |
26 | 25 | # Adding the main options |
21 | 21 | |
22 | 22 | import osrframework.thirdparties.resolvethem_com.processing as resolvethem_com |
23 | 23 | |
24 | ||
25 | 24 | if __name__ == "__main__": |
26 | 25 | parser = argparse.ArgumentParser(description='A library that wraps a search onto resolvethem.com.', prog='checkIPFromAlias.py', epilog="", add_help=False) |
27 | 26 | # Adding the main options |
18 | 18 | |
19 | 19 | import argparse |
20 | 20 | import json |
21 | import sys | |
22 | import urllib2 | |
21 | 23 | |
22 | 24 | import osrframework.thirdparties.infobel_com.checkPhoneDetails as infobel_com |
23 | ||
24 | 25 | |
25 | 26 | if __name__ == "__main__": |
26 | 27 | parser = argparse.ArgumentParser(description='A library that wraps a search onto infobel.com via Google.', prog='checkPhoneDetails.py', add_help=False) |
16 | 16 | # |
17 | 17 | ################################################################################ |
18 | 18 | |
19 | ||
19 | 20 | import argparse |
20 | 21 | import json |
21 | 22 | |
22 | 23 | import osframework.thirdparties.blockchain_info as blockchain_info |
23 | ||
24 | 24 | |
25 | 25 | if __name__ == "__main__": |
26 | 26 | parser = argparse.ArgumentParser(description='A library that wraps the search about a Bitcoin address in blockchain.info.', prog='getBitcoinAddressDetails.py', epilog="", add_help=False) |
19 | 19 | import argparse |
20 | 20 | import json |
21 | 21 | import sys |
22 | import urllib2 | |
22 | 23 | |
23 | 24 | import osrframework.searchengines.google as google |
24 | 25 | import osrframework.thirdparties.infobel_com.processing as processing |
89 | 90 | |
90 | 91 | args = parser.parse_args() |
91 | 92 | |
92 | print(json.dumps(checkPhoneDetails(query=args.query), indent=2)) | |
93 | print json.dumps(checkPhoneDetails(query=args.query), indent=2) |
23 | 23 | import sys |
24 | 24 | |
25 | 25 | import osrframework.utils.browser as browser |
26 | ||
27 | 26 | |
28 | 27 | def extractFieldsFromResult(data): |
29 | 28 | ''' |
20 | 20 | import argparse |
21 | 21 | import json |
22 | 22 | import sys |
23 | import urllib3 | |
23 | import urllib2 | |
24 | 24 | |
25 | 25 | |
26 | 26 | def checkIpDetails(query=None): |
27 | """Method that checks if the given hash is stored in the md5crack.com website. An example of the json received: | |
27 | ''' | |
28 | Method that checks if the given hash is stored in the md5crack.com website. An example of the json received: | |
28 | 29 | { |
29 | 30 | "as": "AS8560 1\u00261 Internet AG", |
30 | 31 | "city": "", |
42 | 43 | "zip": "" |
43 | 44 | } |
44 | 45 | |
45 | Args: | |
46 | query (str): Query to verify. It can be either a domain or an IPv4 address. | |
46 | :param query: Query to verify. It can be either a domain or an IPv4 address. | |
47 | 47 | |
48 | Returns: | |
49 | list. Python structure for the json received. If nothing was found, it will return an empty dictionary. | |
48 | :return: Python structure for the json received. If nothing was found, it will return an empty dictionary. | |
50 | 49 | [ |
51 | 50 | { |
52 | 51 | "attributes": [ |
75 | 74 | "value": "51, 9" |
76 | 75 | } |
77 | 76 | ] |
78 | """ | |
77 | ''' | |
79 | 78 | try: |
80 | 79 | apiURL = "http://ip-api.com/json/" + query |
81 | 80 | |
82 | 81 | |
83 | 82 | # Accessing the ip-api.com RESTful API |
84 | data = urllib3.urlopen(apiURL).read() | |
83 | data = urllib2.urlopen(apiURL).read() | |
85 | 84 | |
86 | 85 | # Reading the text data onto python structures |
87 | 86 | apiData = json.loads(data) |
153 | 152 | # Appending to the list of results |
154 | 153 | jsonData.append(aux) |
155 | 154 | |
155 | #print json.dumps(jsonData, indent = 2) | |
156 | 156 | return jsonData |
157 | 157 | except: |
158 | 158 | # No information was found, then we return a null entity |
159 | 159 | return {} |
160 | ||
161 | 160 | |
162 | 161 | if __name__ == "__main__": |
163 | 162 | parser = argparse.ArgumentParser(description='A library that wraps a search onto ip-api.com.', prog='checkIPDetails.py', epilog="", add_help=False) |
172 | 171 | |
173 | 172 | args = parser.parse_args() |
174 | 173 | |
175 | print(json.dumps(checkIpDetails(query=args.query), indent=2)) | |
174 | print json.dumps(checkIpDetails(query=args.query), indent=2) |
18 | 18 | |
19 | 19 | import argparse |
20 | 20 | import json |
21 | import osrframework.utils.config_api_keys as config_api_keys | |
21 | 22 | import sys |
22 | import urllib3 | |
23 | ||
24 | import osrframework.utils.config_api_keys as config_api_keys | |
23 | import urllib2 | |
25 | 24 | |
26 | 25 | |
27 | 26 | def checkIfHashIsCracked(hash=None, api_key=None): |
28 | """Method that checks if the given hash is stored in the md5crack.com website. | |
27 | ''' | |
28 | Method that checks if the given hash is stored in the md5crack.com website. | |
29 | 29 | |
30 | 30 | :param hash: hash to verify. |
31 | 31 | :param api_key: api_key to be used in md5crack.com. If not provided, the API key will be searched in the config_api_keys.py file. |
37 | 37 | "parsed": "hola", |
38 | 38 | "response": "The MD5 hash was cracked." |
39 | 39 | } |
40 | """ | |
40 | ''' | |
41 | 41 | # This is for i3visio |
42 | 42 | if api_key is None: |
43 | 43 | #api_key = raw_input("Insert the API KEY here:\t") |
52 | 52 | apiURL = "http://api.md5crack.com/crack/"+ api_key +"/" + hash |
53 | 53 | |
54 | 54 | # Accessing the HIBP API |
55 | data = urllib3.urlopen(apiURL).read() | |
55 | data = urllib2.urlopen(apiURL).read() | |
56 | 56 | if "\"parsed\":null" in data: |
57 | 57 | data = data.replace("\"parsed\":null", "\"parsed\":\"\"") |
58 | 58 | |
59 | 59 | # Reading the text data onto python structures |
60 | 60 | jsonData = json.loads(data) |
61 | #print json.dumps(jsonData, indent = 2) | |
61 | 62 | return jsonData |
62 | ||
63 | 63 | |
64 | 64 | if __name__ == "__main__": |
65 | 65 | parser = argparse.ArgumentParser(description='A library that wraps a search onto md5crack.com.', prog='checkIfHashIsCracked.py', epilog="NOTE: if not provided, the API key will be searched in the config_api_keys.py file.", add_help=False) |
19 | 19 | import argparse |
20 | 20 | import json |
21 | 21 | import sys |
22 | import urllib3 | |
22 | import urllib2 | |
23 | 23 | |
24 | 24 | |
25 | 25 | def checkIfHashIsCracked(hash=None): |
37 | 37 | try: |
38 | 38 | |
39 | 39 | # Getting the result of the query from MD5db.net |
40 | data = urllib3.urlopen(apiURL).read() | |
40 | data = urllib2.urlopen(apiURL).read() | |
41 | 41 | return data |
42 | 42 | |
43 | 43 | except: |
21 | 21 | import json |
22 | 22 | import osrframework.utils.config_api_keys as config_api_keys |
23 | 23 | import sys |
24 | import urllib2 | |
24 | 25 | |
25 | 26 | from osrframework.thirdparties.pipl_com.lib.search import SearchAPIRequest, SearchAPIError |
26 | 27 | from osrframework.thirdparties.pipl_com.lib import Person, Name, Address, Job |
27 | ||
28 | 28 | |
29 | 29 | def checkInfo(email=None, username=None, api_key=None): |
30 | 30 | ''' |
0 | 0 | """Python wrapper for easily making calls to Pipl's Search API. |
1 | 1 | |
2 | 2 | Pipl's Search API allows you to query with the information you have about |
3 | a person (his name, address, email, phone, username and more) and in response | |
3 | a person (his name, address, email, phone, username and more) and in response | |
4 | 4 | get all the data available on him on the web. |
5 | 5 | |
6 | 6 | The classes contained in this module are: |
13 | 13 | |
14 | 14 | """ |
15 | 15 | import urllib |
16 | import urllib3 | |
16 | import urllib2 | |
17 | 17 | import itertools |
18 | 18 | import threading |
19 | 19 | |
23 | 23 | from osrframework.thirdparties.pipl_com.lib.utils import Serializable |
24 | 24 | |
25 | 25 | |
26 | # Default API key value, you can set your key globally in this variable instead | |
26 | # Default API key value, you can set your key globally in this variable instead | |
27 | 27 | # of passing it to each request object. |
28 | 28 | # >>> import osrframework.thirdparties.pipl_com.lib.search |
29 | 29 | # >>> osrframework.thirdparties.pipl_com.lib.search.default_api_key = '<your_key>' |
31 | 31 | |
32 | 32 | |
33 | 33 | class SearchAPIRequest(object): |
34 | ||
34 | ||
35 | 35 | """A request to Pipl's Search API. |
36 | ||
36 | ||
37 | 37 | Building the request from the query parameters can be done in two ways: |
38 | ||
39 | Option 1 - directly and quickly (for simple requests with only few | |
38 | ||
39 | Option 1 - directly and quickly (for simple requests with only few | |
40 | 40 | parameters): |
41 | ||
41 | ||
42 | 42 | >>> from osrframework.thirdparties.pipl_com.lib.search import SearchAPIRequest |
43 | >>> request = SearchAPIRequest(api_key='samplekey', | |
43 | >>> request = SearchAPIRequest(api_key='samplekey', | |
44 | 44 | email='[email protected]') |
45 | 45 | >>> response = request.send() |
46 | ||
47 | Option 2 - using the data-model (useful for more complex queries; for | |
48 | example, when there are multiple parameters of the same type | |
49 | such as few phones or a few addresses or when you'd like to use | |
50 | information beyond the usual identifiers such as name or email, | |
46 | ||
47 | Option 2 - using the data-model (useful for more complex queries; for | |
48 | example, when there are multiple parameters of the same type | |
49 | such as few phones or a few addresses or when you'd like to use | |
50 | information beyond the usual identifiers such as name or email, | |
51 | 51 | information like education, job, relationships etc): |
52 | ||
52 | ||
53 | 53 | >>> from osrframework.thirdparties.pipl_com.lib.search import SearchAPIRequest |
54 | 54 | >>> from osrframework.thirdparties.pipl_com.lib import Person, Name, Address, Job |
55 | 55 | >>> fields = [Name(first='Eric', last='Cartman'), |
56 | 56 | Address(country='US', state='CO', city='South Park'), |
57 | 57 | Address(country='US', state='NY'), |
58 | 58 | Job(title='Actor')] |
59 | >>> request = SearchAPIRequest(api_key='samplekey', | |
59 | >>> request = SearchAPIRequest(api_key='samplekey', | |
60 | 60 | person=Person(fields=fields)) |
61 | 61 | >>> response = request.send() |
62 | 62 | |
63 | 63 | The request also supports prioritizing/filtering the type of records you |
64 | prefer to get in the response (see the append_priority_rule and | |
64 | prefer to get in the response (see the append_priority_rule and | |
65 | 65 | add_records_filter methods). |
66 | ||
66 | ||
67 | 67 | Sending the request and getting the response is very simple and can be done |
68 | by either making a blocking call to request.send() or by making | |
69 | a non-blocking call to request.send_async(callback) which sends the request | |
68 | by either making a blocking call to request.send() or by making | |
69 | a non-blocking call to request.send_async(callback) which sends the request | |
70 | 70 | asynchronously. |
71 | ||
71 | ||
72 | 72 | """ |
73 | ||
73 | ||
74 | 74 | HEADERS = {'User-Agent': 'osrframework.thirdparties.pipl_com/python/%s' % osrframework.thirdparties.pipl_com.lib.__version__} |
75 | 75 | BASE_URL = 'http://api.pipl.com/search/v3/json/?' |
76 | 76 | # HTTPS is also supported: |
77 | 77 | #BASE_URL = 'https://api.pipl.com/search/v3/json/?' |
78 | ||
79 | def __init__(self, api_key=None, first_name=None, middle_name=None, | |
80 | last_name=None, raw_name=None, email=None, phone=None, | |
81 | username=None, country=None, state=None, city=None, | |
78 | ||
79 | def __init__(self, api_key=None, first_name=None, middle_name=None, | |
80 | last_name=None, raw_name=None, email=None, phone=None, | |
81 | username=None, country=None, state=None, city=None, | |
82 | 82 | raw_address=None, from_age=None, to_age=None, person=None, |
83 | 83 | query_params_mode='and', exact_name=False): |
84 | 84 | """Initiate a new request object with given query params. |
85 | ||
86 | Each request must have at least one searchable parameter, meaning | |
87 | a name (at least first and last name), email, phone or username. | |
88 | Multiple query params are possible (for example querying by both email | |
85 | ||
86 | Each request must have at least one searchable parameter, meaning | |
87 | a name (at least first and last name), email, phone or username. | |
88 | Multiple query params are possible (for example querying by both email | |
89 | 89 | and phone of the person). |
90 | ||
90 | ||
91 | 91 | Args: |
92 | ||
92 | ||
93 | 93 | api_key -- str, a valid API key (use "samplekey" for experimenting). |
94 | Note that you can set a default API key | |
95 | (osrframework.thirdparties.pipl_com.lib.search.default_api_key = '<your_key>') instead of | |
96 | passing it to each request object. | |
94 | Note that you can set a default API key | |
95 | (osrframework.thirdparties.pipl_com.lib.search.default_api_key = '<your_key>') instead of | |
96 | passing it to each request object. | |
97 | 97 | first_name -- unicode, minimum 2 chars. |
98 | middle_name -- unicode. | |
98 | middle_name -- unicode. | |
99 | 99 | last_name -- unicode, minimum 2 chars. |
100 | raw_name -- unicode, an unparsed name containing at least a first name | |
100 | raw_name -- unicode, an unparsed name containing at least a first name | |
101 | 101 | and a last name. |
102 | 102 | email -- unicode. |
103 | phone -- int/long. If a unicode/str is passed instead then it'll be | |
103 | phone -- int/long. If a unicode/str is passed instead then it'll be | |
104 | 104 | striped from all non-digit characters and converted to int. |
105 | 105 | IMPORTANT: Currently only US/Canada phones can be searched by |
106 | so country code is assumed to be 1, phones with different | |
106 | so country code is assumed to be 1, phones with different | |
107 | 107 | country codes are considered invalid and will be ignored. |
108 | 108 | username -- unicode, minimum 4 chars. |
109 | 109 | country -- unicode, a 2 letter country code from: |
117 | 117 | to_age -- int. |
118 | 118 | person -- A Person object (available at osrframework.thirdparties.pipl_com.lib.Person). |
119 | 119 | The person can contain every field allowed by the data-model |
120 | (see osrframework.thirdparties.pipl_com.lib.fields) and can hold multiple fields of | |
120 | (see osrframework.thirdparties.pipl_com.lib.fields) and can hold multiple fields of | |
121 | 121 | the same type (for example: two emails, three addresses etc.) |
122 | 122 | query_params_mode -- str, one of "and"/"or" (default "and"). |
123 | Advanced parameter, use only if you care about the | |
124 | value of record.query_params_match in the response | |
123 | Advanced parameter, use only if you care about the | |
124 | value of record.query_params_match in the response | |
125 | 125 | records. |
126 | Each record in the response has an attribute | |
127 | "query_params_match" which indicates whether the | |
126 | Each record in the response has an attribute | |
127 | "query_params_match" which indicates whether the | |
128 | 128 | record has the all fields from the query or not. |
129 | When set to "and" all query params are required in | |
130 | order to get query_params_match=True, when set to | |
129 | When set to "and" all query params are required in | |
130 | order to get query_params_match=True, when set to | |
131 | 131 | "or" it's enough that the record has at least one |
132 | of each field type (so if you search with a name | |
133 | and two addresses, a record with the name and one | |
132 | of each field type (so if you search with a name | |
133 | and two addresses, a record with the name and one | |
134 | 134 | of the addresses will have query_params_match=True) |
135 | 135 | exact_name -- bool (default False). |
136 | If set to True the names in the query will be matched | |
136 | If set to True the names in the query will be matched | |
137 | 137 | "as is" without compensating for nicknames or multiple |
138 | family names. For example "Jane Brown-Smith" won't return | |
138 | family names. For example "Jane Brown-Smith" won't return | |
139 | 139 | results for "Jane Brown" in the same way "Alexandra Pitt" |
140 | 140 | won't return results for "Alex Pitt". |
141 | ||
142 | Each of the arguments that should have a unicode value accepts both | |
141 | ||
142 | Each of the arguments that should have a unicode value accepts both | |
143 | 143 | unicode objects and utf8 encoded str (will be decoded automatically). |
144 | ||
144 | ||
145 | 145 | """ |
146 | 146 | if person is None: |
147 | 147 | person = Person() |
167 | 167 | if from_age is not None or to_age is not None: |
168 | 168 | dob = DOB.from_age_range(from_age or 0, to_age or 1000) |
169 | 169 | person.add_fields([dob]) |
170 | ||
170 | ||
171 | 171 | self.api_key = api_key |
172 | 172 | self.person = person |
173 | 173 | self.query_params_mode = query_params_mode |
174 | 174 | self.exact_name = exact_name |
175 | 175 | self._filter_records_by = [] |
176 | 176 | self._prioritize_records_by = [] |
177 | ||
177 | ||
178 | 178 | @staticmethod |
179 | def _prepare_filtering_params(domain=None, category=None, | |
179 | def _prepare_filtering_params(domain=None, category=None, | |
180 | 180 | sponsored_source=None, has_field=None, |
181 | has_fields=None, query_params_match=None, | |
181 | has_fields=None, query_params_match=None, | |
182 | 182 | query_person_match=None, **kwargs): |
183 | 183 | """Transform the params to the API format, return a list of params.""" |
184 | 184 | if query_params_match not in (None, True): |
185 | 185 | raise ValueError('query_params_match can only be `True`') |
186 | 186 | if query_person_match not in (None, True): |
187 | 187 | raise ValueError('query_person_match can only be `True`') |
188 | ||
188 | ||
189 | 189 | params = [] |
190 | 190 | if domain is not None: |
191 | 191 | params.append('domain:%s' % domain) |
204 | 204 | for has_field in has_fields: |
205 | 205 | params.append('has_field:%s' % has_field.__name__) |
206 | 206 | return params |
207 | ||
208 | def add_records_filter(self, domain=None, category=None, | |
209 | sponsored_source=None, has_fields=None, | |
207 | ||
208 | def add_records_filter(self, domain=None, category=None, | |
209 | sponsored_source=None, has_fields=None, | |
210 | 210 | query_params_match=None, query_person_match=None): |
211 | 211 | """Add a new "and" filter for the records returned in the response. |
212 | ||
213 | IMPORTANT: This method can be called multiple times per request for | |
214 | adding multiple "and" filters, each of these "and" filters is | |
212 | ||
213 | IMPORTANT: This method can be called multiple times per request for | |
214 | adding multiple "and" filters, each of these "and" filters is | |
215 | 215 | interpreted as "or" with the other filters. |
216 | 216 | For example: |
217 | ||
217 | ||
218 | 218 | >>> from osrframework.thirdparties.pipl_com.lib.search import SearchAPIRequest |
219 | 219 | >>> from osrframework.thirdparties.pipl_com.lib import Phone, Job |
220 | 220 | >>> request = SearchAPIRequest('samplekey', username='eric123') |
221 | 221 | >>> request.add_records_filter(domain='linkedin', has_fields=[Phone]) |
222 | 222 | >>> request.add_records_filter(has_fields=[Phone, Job]) |
223 | ||
223 | ||
224 | 224 | The above request is only for records that are: |
225 | 225 | (from LinkedIn AND has a phone) OR (has a phone AND has a job). |
226 | 226 | Records that don't match this rule will not come back in the response. |
227 | ||
228 | Please note that in case there are too many results for the query, | |
227 | ||
228 | Please note that in case there are too many results for the query, | |
229 | 229 | adding filters to the request can significantly improve the number of |
230 | 230 | useful results; when you define which records interest you, you'll |
231 | 231 | get records that would have otherwise be cut-off by the limit on the |
232 | 232 | number of records per query. |
233 | ||
233 | ||
234 | 234 | Args: |
235 | ||
235 | ||
236 | 236 | domain -- str, for example "linkedin.com", you may also use "linkedin" |
237 | but note that it'll match "linkedin.*" and "*.linkedin.*" | |
237 | but note that it'll match "linkedin.*" and "*.linkedin.*" | |
238 | 238 | (any sub-domain and any TLD). |
239 | 239 | category -- str, any one of the categories defined in |
240 | 240 | osrframework.thirdparties.pipl_com.lib.source.Source.categories. |
241 | sponsored_source -- bool, True means you want just the records that | |
242 | come from a sponsored source and False means you | |
241 | sponsored_source -- bool, True means you want just the records that | |
242 | come from a sponsored source and False means you | |
243 | 243 | don't want these records. |
244 | has_fields -- A list of fields classes from osrframework.thirdparties.pipl_com.lib.fields, | |
244 | has_fields -- A list of fields classes from osrframework.thirdparties.pipl_com.lib.fields, | |
245 | 245 | records must have content in all these fields. |
246 | For example: [Name, Phone] means you only want records | |
246 | For example: [Name, Phone] means you only want records | |
247 | 247 | that has at least one name and at least one phone. |
248 | query_params_match -- True is the only possible value and it means you | |
249 | want records that match all the params you passed | |
248 | query_params_match -- True is the only possible value and it means you | |
249 | want records that match all the params you passed | |
250 | 250 | in the query. |
251 | 251 | query_person_match -- True is the only possible value and it means you |
252 | want records that are the same person you | |
253 | queried by (only records with | |
254 | query_person_match == 1.0, see the documentation | |
252 | want records that are the same person you | |
253 | queried by (only records with | |
254 | query_person_match == 1.0, see the documentation | |
255 | 255 | of record.query_person_match for more details). |
256 | ||
256 | ||
257 | 257 | ValueError is raised in any case of an invalid parameter. |
258 | ||
258 | ||
259 | 259 | """ |
260 | 260 | params = SearchAPIRequest._prepare_filtering_params(**locals()) |
261 | 261 | if params: |
262 | 262 | self._filter_records_by.append(' AND '.join(params)) |
263 | ||
264 | def append_priority_rule(self, domain=None, category=None, | |
265 | sponsored_source=None, has_field=None, | |
263 | ||
264 | def append_priority_rule(self, domain=None, category=None, | |
265 | sponsored_source=None, has_field=None, | |
266 | 266 | query_params_match=None, query_person_match=None): |
267 | 267 | """Append a new priority rule for the records returned in the response. |
268 | ||
269 | IMPORTANT: This method can be called multiple times per request for | |
268 | ||
269 | IMPORTANT: This method can be called multiple times per request for | |
270 | 270 | adding multiple priority rules, each call can be with only one argument |
271 | and the order of the calls matter (the first rule added is the highest | |
271 | and the order of the calls matter (the first rule added is the highest | |
272 | 272 | priority, the second is second priority etc). |
273 | 273 | For example: |
274 | ||
274 | ||
275 | 275 | >>> from osrframework.thirdparties.pipl_com.lib.search import SearchAPIRequest |
276 | 276 | >>> from osrframework.thirdparties.pipl_com.lib import Phone |
277 | 277 | >>> request = SearchAPIRequest('samplekey', username='eric123') |
278 | 278 | >>> request.append_priority_rule(domain='linkedin') |
279 | 279 | >>> request.append_priority_rule(has_field=Phone) |
280 | ||
281 | In the response to the above request records from LinkedIn will be | |
282 | returned before records that aren't from LinkedIn and records with | |
283 | phone will be returned before records without phone. | |
284 | ||
280 | ||
281 | In the response to the above request records from LinkedIn will be | |
282 | returned before records that aren't from LinkedIn and records with | |
283 | phone will be returned before records without phone. | |
284 | ||
285 | 285 | Please note that in case there are too many results for the query, |
286 | adding priority rules to the request does not only affect the order | |
287 | of the records but can significantly improve the number of useful | |
286 | adding priority rules to the request does not only affect the order | |
287 | of the records but can significantly improve the number of useful | |
288 | 288 | results; when you define which records interest you, you'll get records |
289 | 289 | that would have otherwise be cut-off by the limit on the number |
290 | of records per query. | |
290 | of records per query. | |
291 | 291 | |
292 | 292 | Args: |
293 | ||
294 | domain -- str, for example "linkedin.com", "linkedin" is also possible | |
293 | ||
294 | domain -- str, for example "linkedin.com", "linkedin" is also possible | |
295 | 295 | and it'll match "linkedin.*". |
296 | 296 | category -- str, any one of the categories defined in |
297 | 297 | osrframework.thirdparties.pipl_com.lib.source.Source.categories. |
298 | sponsored_source -- bool, True will bring the records that | |
299 | come from a sponsored source first and False | |
298 | sponsored_source -- bool, True will bring the records that | |
299 | come from a sponsored source first and False | |
300 | 300 | will bring the non-sponsored records first. |
301 | 301 | has_fields -- A field class from osrframework.thirdparties.pipl_com.lib.fields. |
302 | For example: has_field=Phone means you want to give | |
302 | For example: has_field=Phone means you want to give | |
303 | 303 | a priority to records that has at least one phone. |
304 | query_params_match -- True is the only possible value and it means you | |
305 | want to give a priority to records that match all | |
304 | query_params_match -- True is the only possible value and it means you | |
305 | want to give a priority to records that match all | |
306 | 306 | the params you passed in the query. |
307 | 307 | query_person_match -- True is the only possible value and it means you |
308 | 308 | want to give a priority to records with higher |
309 | query_person_match (see the documentation of | |
309 | query_person_match (see the documentation of | |
310 | 310 | record.query_person_match for more details). |
311 | ||
311 | ||
312 | 312 | ValueError is raised in any case of an invalid parameter. |
313 | ||
313 | ||
314 | 314 | """ |
315 | 315 | params = SearchAPIRequest._prepare_filtering_params(**locals()) |
316 | 316 | if len(params) > 1: |
317 | 317 | raise ValueError('The function should be called with one argument') |
318 | 318 | if params: |
319 | 319 | self._prioritize_records_by.append(params[0]) |
320 | ||
320 | ||
321 | 321 | def validate_query_params(self, strict=True): |
322 | """Check if the request is valid and can be sent, raise ValueError if | |
322 | """Check if the request is valid and can be sent, raise ValueError if | |
323 | 323 | not. |
324 | ||
325 | `strict` is a boolean argument that defaults to True which means an | |
324 | ||
325 | `strict` is a boolean argument that defaults to True which means an | |
326 | 326 | exception is raised on every invalid query parameter, if set to False |
327 | 327 | an exception is raised only when the search request cannot be performed |
328 | 328 | because required query params are missing. |
329 | ||
329 | ||
330 | 330 | """ |
331 | 331 | if not (self.api_key or default_api_key): |
332 | 332 | raise ValueError('API key is missing') |
335 | 335 | if not self.person.is_searchable: |
336 | 336 | raise ValueError('No valid name/username/phone/email in request') |
337 | 337 | if strict and self.person.unsearchable_fields: |
338 | raise ValueError('Some fields are unsearchable: %s' | |
338 | raise ValueError('Some fields are unsearchable: %s' | |
339 | 339 | % self.person.unsearchable_fields) |
340 | ||
340 | ||
341 | 341 | @property |
342 | 342 | def url(self): |
343 | 343 | """The URL of the request (str).""" |
350 | 350 | 'filter_records_by': self._filter_records_by, |
351 | 351 | } |
352 | 352 | return SearchAPIRequest.BASE_URL + urllib.urlencode(query, doseq=True) |
353 | ||
353 | ||
354 | 354 | def send(self, strict_validation=True): |
355 | 355 | """Send the request and return the response or raise SearchAPIError. |
356 | ||
356 | ||
357 | 357 | Calling this method blocks the program until the response is returned, |
358 | if you want the request to be sent asynchronously please refer to the | |
359 | send_async method. | |
360 | ||
358 | if you want the request to be sent asynchronously please refer to the | |
359 | send_async method. | |
360 | ||
361 | 361 | The response is returned as a SearchAPIResponse object. |
362 | ||
363 | `strict_vailidation` is a bool argument that's passed to the | |
362 | ||
363 | `strict_vailidation` is a bool argument that's passed to the | |
364 | 364 | validate_query_params method. |
365 | ||
366 | Raises ValueError (raised from validate_query_params), | |
367 | HttpError/URLError and SearchAPIError (when the response is returned | |
365 | ||
366 | Raises ValueError (raised from validate_query_params), | |
367 | HttpError/URLError and SearchAPIError (when the response is returned | |
368 | 368 | but contains an error). |
369 | ||
369 | ||
370 | 370 | Example: |
371 | ||
371 | ||
372 | 372 | >>> from osrframework.thirdparties.pipl_com.lib.search import SearchAPIRequest, SearchAPIError |
373 | 373 | >>> request = SearchAPIRequest('samplekey', email='[email protected]') |
374 | 374 | >>> try: |
375 | 375 | ... response = request.send() |
376 | 376 | ... except SearchAPIError as e: |
377 | ... print(e.http_status_code, e) | |
378 | ||
377 | ... print e.http_status_code, e | |
378 | ||
379 | 379 | """ |
380 | 380 | self.validate_query_params(strict=strict_validation) |
381 | 381 | query = { |
386 | 386 | 'prioritize_records_by': ','.join(self._prioritize_records_by), |
387 | 387 | 'filter_records_by': self._filter_records_by, |
388 | 388 | } |
389 | request = urllib3.Request(url=SearchAPIRequest.BASE_URL, data=urllib.urlencode(query, True), headers=SearchAPIRequest.HEADERS) | |
389 | request = urllib2.Request(url=SearchAPIRequest.BASE_URL, data=urllib.urlencode(query, True), headers=SearchAPIRequest.HEADERS) | |
390 | 390 | try: |
391 | json_response = urllib3.urlopen(request).read() | |
392 | except urllib3.HTTPError as e: | |
391 | json_response = urllib2.urlopen(request).read() | |
392 | except urllib2.HTTPError as e: | |
393 | 393 | json_error = e.read() |
394 | 394 | if not json_error: |
395 | 395 | raise e |
398 | 398 | except ValueError: |
399 | 399 | raise e |
400 | 400 | return SearchAPIResponse.from_json(json_response) |
401 | ||
401 | ||
402 | 402 | def send_async(self, callback, strict_validation=True): |
403 | 403 | """Same as send() but in a non-blocking way. |
404 | ||
405 | Use this method if you want to send the request asynchronously so your | |
404 | ||
405 | Use this method if you want to send the request asynchronously so your | |
406 | 406 | program can do other things while waiting for the response. |
407 | ||
408 | `callback` is a function (or other callable) with the following | |
407 | ||
408 | `callback` is a function (or other callable) with the following | |
409 | 409 | signature: |
410 | 410 | callback(response=None, error=None) |
411 | ||
411 | ||
412 | 412 | Example: |
413 | ||
413 | ||
414 | 414 | >>> from osrframework.thirdparties.pipl_com.lib.search import SearchAPIRequest |
415 | 415 | >>> |
416 | 416 | >>> def my_callback(response=None, error=None): |
417 | ... print(response or error) | |
417 | ... print response or error | |
418 | 418 | ... |
419 | 419 | >>> request = SearchAPIRequest('samplekey', email='[email protected]') |
420 | 420 | >>> request.send_async(my_callback) |
421 | 421 | >>> do_other_things() |
422 | ||
422 | ||
423 | 423 | """ |
424 | 424 | def target(): |
425 | 425 | try: |
431 | 431 | |
432 | 432 | |
433 | 433 | class SearchAPIResponse(Serializable): |
434 | ||
434 | ||
435 | 435 | """A response from Pipl's Search API. |
436 | ||
436 | ||
437 | 437 | A response comprises the two things returned as a result to your query: |
438 | ||
439 | - A person (osrframework.thirdparties.pipl_com.lib.containers.Person) that is the deta object | |
440 | representing all the information available for the person you were | |
438 | ||
439 | - A person (osrframework.thirdparties.pipl_com.lib.containers.Person) that is the deta object | |
440 | representing all the information available for the person you were | |
441 | 441 | looking for. |
442 | 442 | This object will only be returned when our identity-resolution engine is |
443 | 443 | convinced that the information is of the person represented by your query. |
447 | 447 | that the response will not contain a person object. |
448 | 448 | On the other hand, if you search by a unique identifier such as email or |
449 | 449 | a combination of identifiers that only lead to one person, such as |
450 | "Eric Cartman, Age 22, From South Park, CO, US", you can expect to get | |
450 | "Eric Cartman, Age 22, From South Park, CO, US", you can expect to get | |
451 | 451 | a response containing a single person object. |
452 | ||
453 | - A list of records (osrframework.thirdparties.pipl_com.lib.containers.Record) that fully/partially | |
454 | match the person from your query, if the query was for "Eric Cartman from | |
455 | Colorado US" the response might also contain records of "Eric Cartman | |
456 | from US" (without Colorado), if you need to differentiate between records | |
452 | ||
453 | - A list of records (osrframework.thirdparties.pipl_com.lib.containers.Record) that fully/partially | |
454 | match the person from your query, if the query was for "Eric Cartman from | |
455 | Colorado US" the response might also contain records of "Eric Cartman | |
456 | from US" (without Colorado), if you need to differentiate between records | |
457 | 457 | with full match to the query and partial match or if you want to get a |
458 | 458 | score on how likely is that record to be related to the person you are |
459 | searching please refer to the record's attributes | |
459 | searching please refer to the record's attributes | |
460 | 460 | record.query_params_match and record.query_person_match. |
461 | ||
462 | The response also contains the query as it was interpreted by Pipl. This | |
463 | part is useful for verification and debugging, if some query parameters | |
464 | were invalid you can see in response.query that they were ignored, you can | |
465 | also see how the name/address from your query were parsed in case you | |
461 | ||
462 | The response also contains the query as it was interpreted by Pipl. This | |
463 | part is useful for verification and debugging, if some query parameters | |
464 | were invalid you can see in response.query that they were ignored, you can | |
465 | also see how the name/address from your query were parsed in case you | |
466 | 466 | passed raw_name/raw_address in the query. |
467 | ||
468 | In some cases when the query isn't focused enough and can't be matched to | |
469 | a specific person, such as "John Smith from US", the response also contains | |
470 | a list of suggested searches. This is a list of Record objects, each of | |
471 | these is an expansion of the original query, giving additional query | |
467 | ||
468 | In some cases when the query isn't focused enough and can't be matched to | |
469 | a specific person, such as "John Smith from US", the response also contains | |
470 | a list of suggested searches. This is a list of Record objects, each of | |
471 | these is an expansion of the original query, giving additional query | |
472 | 472 | parameters so the you can zoom in on the right person. |
473 | ||
473 | ||
474 | 474 | """ |
475 | ||
476 | def __init__(self, query=None, person=None, records=None, | |
475 | ||
476 | def __init__(self, query=None, person=None, records=None, | |
477 | 477 | suggested_searches=None, warnings_=None): |
478 | 478 | """Args: |
479 | ||
479 | ||
480 | 480 | query -- A Person object with the query as interpreted by Pipl. |
481 | 481 | person -- A Person object with data about the person in the query. |
482 | records -- A list of Record objects with full/partial match to the | |
482 | records -- A list of Record objects with full/partial match to the | |
483 | 483 | query. |
484 | suggested_searches -- A list of Record objects, each of these is an | |
484 | suggested_searches -- A list of Record objects, each of these is an | |
485 | 485 | expansion of the original query, giving additional |
486 | 486 | query parameters to zoom in on the right person. |
487 | warnings_ -- A list of unicodes. A warning is returned when the query | |
487 | warnings_ -- A list of unicodes. A warning is returned when the query | |
488 | 488 | contains a non-critical error and the search can still run. |
489 | ||
489 | ||
490 | 490 | """ |
491 | 491 | self.query = query |
492 | 492 | self.person = person |
493 | 493 | self.records = records or [] |
494 | 494 | self.suggested_searches = suggested_searches or [] |
495 | 495 | self.warnings = warnings_ or [] |
496 | ||
496 | ||
497 | 497 | @property |
498 | 498 | def query_params_matched_records(self): |
499 | 499 | """Records that match all the params in the query.""" |
500 | 500 | return [rec for rec in self.records if rec.query_params_match] |
501 | ||
501 | ||
502 | 502 | @property |
503 | 503 | def query_person_matched_records(self): |
504 | 504 | """Records that match the person from the query. |
505 | ||
506 | Note that the meaning of "match the person from the query" means "Pipl | |
507 | is convinced that these records hold data about the person you're | |
508 | looking for". | |
509 | Remember that when Pipl is convinced about which person you're looking | |
510 | for, the response also contains a Person object. This person is | |
511 | created by merging all the fields and sources of these records. | |
512 | ||
505 | ||
506 | Note that the meaning of "match the person from the query" means "Pipl | |
507 | is convinced that these records hold data about the person you're | |
508 | looking for". | |
509 | Remember that when Pipl is convinced about which person you're looking | |
510 | for, the response also contains a Person object. This person is | |
511 | created by merging all the fields and sources of these records. | |
512 | ||
513 | 513 | """ |
514 | 514 | return [rec for rec in self.records if rec.query_person_match == 1.] |
515 | ||
515 | ||
516 | 516 | def group_records(self, key_function): |
517 | """Return a dict with the records grouped by the key returned by | |
517 | """Return a dict with the records grouped by the key returned by | |
518 | 518 | `key_function`. |
519 | ||
519 | ||
520 | 520 | `key_function` takes a record and returns the value from the record to |
521 | 521 | group by (see examples in the group_records_by_* methods below). |
522 | ||
522 | ||
523 | 523 | The return value is a dict, a key in this dict is a key returned by |
524 | 524 | `key_function` and the value is a list of all the records with this key. |
525 | ||
525 | ||
526 | 526 | """ |
527 | 527 | sorted_records = sorted(self.records, key=key_function) |
528 | 528 | grouped_records = itertools.groupby(sorted_records, key=key_function) |
529 | 529 | return dict([(key, list(group)) for key, group in grouped_records]) |
530 | ||
530 | ||
531 | 531 | def group_records_by_domain(self): |
532 | 532 | """Return the records grouped by the domain they came from. |
533 | ||
533 | ||
534 | 534 | The return value is a dict, a key in this dict is a domain |
535 | 535 | and the value is a list of all the records with this domain. |
536 | ||
536 | ||
537 | 537 | """ |
538 | 538 | key_function = lambda record: record.source.domain |
539 | 539 | return self.group_records(key_function) |
540 | ||
540 | ||
541 | 541 | def group_records_by_category(self): |
542 | 542 | """Return the records grouped by the category of their source. |
543 | ||
543 | ||
544 | 544 | The return value is a dict, a key in this dict is a category |
545 | 545 | and the value is a list of all the records with this category. |
546 | ||
546 | ||
547 | 547 | """ |
548 | 548 | Source.validate_categories(categories) |
549 | 549 | key_function = lambda record: record.source.category |
550 | 550 | return self.group_records(key_function) |
551 | ||
551 | ||
552 | 552 | def group_records_by_query_params_match(self): |
553 | 553 | """Return the records grouped by their query_params_match attribute. |
554 | ||
554 | ||
555 | 555 | The return value is a dict, a key in this dict is a query_params_match |
556 | bool (so the keys can be just True or False) and the value is a list | |
556 | bool (so the keys can be just True or False) and the value is a list | |
557 | 557 | of all the records with this query_params_match value. |
558 | ||
558 | ||
559 | 559 | """ |
560 | 560 | key_function = lambda record: record.query_params_match |
561 | 561 | return self.group_records(key_function) |
562 | ||
562 | ||
563 | 563 | def group_records_by_query_person_match(self): |
564 | 564 | """Return the records grouped by their query_person_match attribute. |
565 | ||
565 | ||
566 | 566 | The return value is a dict, a key in this dict is a query_person_match |
567 | float and the value is a list of all the records with this | |
567 | float and the value is a list of all the records with this | |
568 | 568 | query_person_match value. |
569 | ||
569 | ||
570 | 570 | """ |
571 | 571 | key_function = lambda record: record.query_person_match |
572 | 572 | return self.group_records(key_function) |
573 | ||
573 | ||
574 | 574 | @staticmethod |
575 | 575 | def from_dict(d): |
576 | 576 | """Transform the dict to a response object and return the response.""" |
586 | 586 | records = [Record.from_dict(record) for record in records] |
587 | 587 | suggested_searches = d.get('suggested_searches') |
588 | 588 | if suggested_searches: |
589 | suggested_searches = [Record.from_dict(record) | |
589 | suggested_searches = [Record.from_dict(record) | |
590 | 590 | for record in suggested_searches] |
591 | return SearchAPIResponse(query=query, person=person, records=records, | |
591 | return SearchAPIResponse(query=query, person=person, records=records, | |
592 | 592 | suggested_searches=suggested_searches, |
593 | 593 | warnings_=warnings_) |
594 | ||
594 | ||
595 | 595 | def to_dict(self): |
596 | 596 | """Return a dict representation of the response.""" |
597 | 597 | d = {} |
604 | 604 | if self.records: |
605 | 605 | d['records'] = [record.to_dict() for record in self.records] |
606 | 606 | if self.suggested_searches: |
607 | d['suggested_searches'] = [record.to_dict() | |
607 | d['suggested_searches'] = [record.to_dict() | |
608 | 608 | for record in self.suggested_searches] |
609 | 609 | return d |
610 | ||
610 | ||
611 | 611 | |
612 | 612 | class SearchAPIError(APIError): |
613 | ||
614 | """An exception raised when the response from the search API contains an | |
613 | ||
614 | """An exception raised when the response from the search API contains an | |
615 | 615 | error.""" |
616 | ||
616 | ||
617 | 617 | pass |
20 | 20 | import argparse |
21 | 21 | import re |
22 | 22 | import requests |
23 | ||
23 | import urllib | |
24 | 24 | |
25 | 25 | def checkIPFromAlias(alias=None): |
26 | """Method that checks if the given alias is currently connected to Skype and returns its IP address. | |
26 | """ | |
27 | Method that checks if the given alias is currently connected to Skype and returns its IP address. | |
27 | 28 | |
28 | Args: | |
29 | alias (str): Alias to be searched. | |
29 | :param alias: Alias to be searched. | |
30 | 30 | |
31 | Returns: | |
32 | dict. Python structure for the Json received. It has the following structure: | |
31 | :return: Python structure for the Json received. It has the following structure: | |
33 | 32 | { |
34 | 33 | "type": "i3visio.ip", |
35 | 34 | "value": "1.1.1.1", |
334 | 334 | |
335 | 335 | # Selecting the platforms where performing the search |
336 | 336 | groupPlatforms = parser.add_argument_group('Platform selection arguments', 'Criteria for selecting the platforms where performing the search.') |
337 | groupPlatforms.add_argument('-p', '--platforms', metavar='<platform>', choices=platOptions, nargs='+', required=False, default=DEFAULT_VALUES["platforms"], action='store', help='select the platforms where you want to perform the search amongst the following: ' + str(platOptions) + '. More than one option can be selected.') | |
337 | groupPlatforms.add_argument('-p', '--platforms', metavar='<platform>', choices=platOptions, nargs='+', required=False, default=DEFAULT_VALUES.get("platforms", []), action='store', help='select the platforms where you want to perform the search amongst the following: ' + str(platOptions) + '. More than one option can be selected.') | |
338 | 338 | groupPlatforms.add_argument('-t', '--tags', metavar='<tag>', default = [], nargs='+', required=False, action='store', help='select the list of tags that fit the platforms in which you want to perform the search. More than one option can be selected.') |
339 | 339 | groupPlatforms.add_argument('-x', '--exclude', metavar='<platform>', choices=platOptions, nargs='+', required=False, default=excludeList, action='store', help='select the platforms that you want to exclude from the processing.') |
340 | 340 | |
344 | 344 | group_processing.add_argument('--avoid_processing', required=False, action='store_true', default=False, help='argument to force usufy NOT to perform any processing task with the valid profiles.') |
345 | 345 | group_processing.add_argument('--fuzz_config', metavar='<path_to_fuzz_list>', action='store', type=argparse.FileType('r'), help='path to the fuzzing config details. Wildcards such as the domains or the nicknames should come as: <DOMAIN>, <USERNAME>.') |
346 | 346 | group_processing.add_argument('--nonvalid', metavar='<not_valid_characters>', required=False, default = '\\|<>=', action='store', help="string containing the characters considered as not valid for nicknames." ) |
347 | 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.') | |
347 | group_processing.add_argument('-e', '--extension', metavar='<sum_ext>', nargs='+', choices=['csv', 'gml', 'json', 'ods', 'png', 'txt', 'xls', 'xlsx' ], required=False, default=DEFAULT_VALUES.get("extension", ["csv"]), action='store', help='output extension for the summary files. Default: csv.') | |
348 | 348 | group_processing.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.') |
349 | 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 will try to create; if this argument is not provided, usufy will NOT write any down any data. Check permissions if something goes wrong.') | |
349 | group_processing.add_argument('-o', '--output_folder', metavar='<path_to_output_folder>', required=False, default=DEFAULT_VALUES.get("output_folder", "."), action='store', help='output folder for the generated documents. While if the paths does not exist, usufy will try to create; if this argument is not provided, usufy will NOT write any down any data. Check permissions if something goes wrong.') | |
350 | 350 | group_processing.add_argument('-w', '--web_browser', required=False, action='store_true', help='opening the uris returned in the default web browser.') |
351 | 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>.' ) | |
352 | group_processing.add_argument('-T', '--threads', metavar='<num_threads>', required=False, action='store', default=int(DEFAULT_VALUES["threads"]), type=int, help='write down the number of threads to be used (default 32). If 0, the maximum number possible will be used, which may make the system feel unstable.') | |
351 | group_processing.add_argument('-F', '--file_header', metavar='<alternative_header_file>', required=False, default=DEFAULT_VALUES.get("file_header", "profiles"), action='store', help='Header for the output filenames to be generated. If None was provided the following will be used: profiles.<extension>.' ) | |
352 | group_processing.add_argument('-T', '--threads', metavar='<num_threads>', required=False, action='store', default=int(DEFAULT_VALUES.get("threads", 0)), type=int, help='write down the number of threads to be used (default 32). If 0, the maximum number possible will be used, which may make the system feel unstable.') | |
353 | 353 | |
354 | 354 | # About options |
355 | 355 | group_about = parser.add_argument_group('About arguments', 'Showing additional information about this program.') |
426 | 426 | # performing the test |
427 | 427 | elif args.benchmark: |
428 | 428 | platforms = platform_selection.get_all_platform_names("usufy") |
429 | res = benchmark.doBenchmark(platforms) | |
429 | res = benchmark.do_benchmark(platforms) | |
430 | 430 | str_times = "" |
431 | 431 | for e in sorted(res.keys()): |
432 | 432 | str_times += str(e) + "\t" + str(res[e]) + "\n" |
434 | 434 | |
435 | 435 | # showing the tags of the usufy platforms |
436 | 436 | elif args.show_tags: |
437 | tags = platform_selection.get_all_platform_namesByTag("usufy") | |
437 | tags = platform_selection.get_all_platform_names_by_tag("usufy") | |
438 | 438 | print(general.info("This is the list of platforms grouped by tag.\n")) |
439 | 439 | print(json.dumps(tags, indent=2, sort_keys=True)) |
440 | 440 | print(general.info("[Tip] Remember that you can always launch the platform using the -t option followed by any of the aforementioned.\n")) |
441 | return tags | |
442 | 441 | |
443 | 442 | # Executing the corresponding process... |
444 | 443 | else: |
26 | 26 | |
27 | 27 | |
28 | 28 | def testFunctionWeb(): |
29 | """Benchmarcking function... | |
29 | 30 | """ |
30 | Benchmarcking function... | |
31 | """ | |
31 | #print p | |
32 | 32 | resp = urllib3.urlopen('http://www.i3visio.com') |
33 | 33 | html = resp.read() |
34 | 34 | return |
35 | 35 | |
36 | ||
37 | 36 | def testFunction2(): |
38 | """ | |
39 | Benchmarcking function... | |
37 | """Benchmarcking function... | |
40 | 38 | """ |
41 | 39 | a = 1 |
42 | 40 | for i in range(1000): |
43 | 41 | a+=1 |
44 | 42 | return |
45 | 43 | |
44 | def multi_run_wrapper(args): | |
45 | """ Wrapper for being able to launch all the threads of getPageWrapper. | |
46 | 46 | |
47 | def multi_run_wrapper(args): | |
48 | """ | |
49 | Wrapper for being able to launch all the threads of getPageWrapper. | |
50 | Parameters: | |
47 | Args: | |
51 | 48 | We receive the parameters for getPageWrapper as a tuple. |
52 | 49 | """ |
50 | #print args | |
53 | 51 | return testFunctionWeb(*args) |
54 | 52 | |
55 | ||
56 | def doBenchmark(plats): | |
57 | """ | |
58 | Perform the benchmark... | |
53 | def do_benchmark(plats): | |
54 | """Perform the benchmark... | |
59 | 55 | """ |
60 | 56 | logger = logging.getLogger("osrframework.utils") |
61 | 57 | # defining the results dict |
97 | 97 | # Configuring the proxy as it will be used by br.set_proxies |
98 | 98 | for p in proxy.keys(): |
99 | 99 | # p ~= ProxyHTTP --> Protocol = p.lower()[5:] |
100 | #print p, p.lower()[5:], proxy[p] | |
100 | 101 | try: |
101 | 102 | # Adding credentials if they exist |
102 | 103 | self.proxies[ p.lower()[5:] ] = proxy[p]["username"] + ":" + proxy[p]["password"] + "@" + proxy[p]["host"] + ":" + proxy[p]["port"] |
47 | 47 | with open(config_path, "w") as output_file: |
48 | 48 | output_file.write(cont) |
49 | 49 | except Exception as e: |
50 | raise errors.ConfigurationFileNotFoundError(config_path, default_config_path); | |
50 | #raise errors.ConfigurationFileNotFoundError(config_path, default_config_path); | |
51 | 51 | return dict_api_keys |
52 | 52 | |
53 | 53 | # Reading the configuration file |
56 | 56 | creds[plat] = [c] |
57 | 57 | else: |
58 | 58 | creds[plat] = creds[plat].append(c) |
59 | ||
60 | if len(creds) > 0: | |
61 | print(f"\n\t[*] {general.info(str(len(creds)))} credentials have been loaded.") | |
59 | print(f"\t[*] {general.info(str(len(creds_tuples)))} credentials have been loaded.") | |
62 | 60 | return creds |
113 | 113 | return platform_list |
114 | 114 | |
115 | 115 | |
116 | def get_all_platform_names_by_tag (mode = None): | |
116 | def get_all_platform_names_by_tag(mode=None): | |
117 | 117 | """Returns the platforms in the framework grouped by tags |
118 | 118 | |
119 | 119 | Args: |
20 | 20 | import random |
21 | 21 | import re |
22 | 22 | import urllib |
23 | import tempfile | |
23 | 24 | |
24 | 25 | import osrframework.utils.browser as browser |
25 | 26 | import osrframework.utils.general as general |
68 | 69 | def create_url(self, word, mode="phonefy"): |
69 | 70 | """Method to create the URL replacing the word in the appropriate URL |
70 | 71 | |
72 | Depending on the module it returns the corresponding URL. However, | |
73 | a special keyword can be provided as mode ("base") to use a different | |
74 | URL instead. This is useful when the check is performed towards a | |
75 | different platform (e. g., tweettunnel.com) but the URI to be shown is | |
76 | expected to be the original one (e. g., twitter.com). | |
77 | ||
71 | 78 | Args: |
72 | 79 | word (str): Word to be searched. |
73 | 80 | mode (str): Mode to be executed. |
74 | 81 | |
75 | 82 | Returns: |
76 | The URL to be queried. | |
77 | """ | |
78 | try: | |
79 | return self.modes[mode]["url"].replace("{placeholder}", word) | |
80 | except: | |
83 | The URL to be queried. It returns None if no base has been provided. | |
84 | """ | |
85 | try: | |
81 | 86 | if mode == "base": |
82 | 87 | if word[0] == "/": |
83 | return self.baseURL + word[1:], word | |
88 | return self.baseURL + word[1:] | |
84 | 89 | else: |
85 | 90 | return self.baseURL + word |
86 | 91 | else: |
87 | 92 | try: |
93 | return self.modes[mode]["url"].replace("{placeholder}", word) | |
94 | except: | |
88 | 95 | return self.url[mode].replace("<"+mode+">", word) |
89 | except: | |
90 | pass | |
91 | return None | |
96 | except: | |
97 | return None | |
92 | 98 | |
93 | 99 | def launch_query_for_mode(self, query=None, mode=None): |
94 | 100 | """Method that launches an i3Browser to collect data |
119 | 125 | else: |
120 | 126 | # Accessing the resources |
121 | 127 | data = i3Browser.recover_url(qURL) |
128 | ||
129 | try: | |
130 | if self.modes[mode]["debug"]: | |
131 | with open(os.path.join(tempfile.gettempdir(), self.platformName) + ".html", "w") as file: | |
132 | print(f"DEBUG mode is active for '{general.emphasis(self.platformName)}'. Data grabbed saved to: '{general.warning(file.name)}'") | |
133 | file.write(data) | |
134 | except: | |
135 | pass | |
136 | ||
122 | 137 | return data |
123 | 138 | except KeyError: |
124 | print(general.error("[*] '{}' is not a valid mode for this wrapper ({}).".format(mode, self.__class__.__name__))) | |
139 | print(general.error("\t[*] '{}' is not a valid mode for this wrapper ({}).".format(mode, self.__class__.__name__))) | |
125 | 140 | |
126 | 141 | return None |
127 | 142 | |
349 | 364 | ] |
350 | 365 | """ |
351 | 366 | if self.check_mailfy(query, **kwargs): |
352 | expandedEntities = general.expand_entities_from_email(query) | |
367 | expanded_entities = general.expand_entities_from_email(query) | |
353 | 368 | r = { |
354 | 369 | "type": "com.i3visio.Profile", |
355 | 370 | "value": self.platformName + " - " + query, |
356 | "attributes": expandedEntities + [ | |
371 | "attributes": expanded_entities + [ | |
357 | 372 | { |
358 | 373 | "type": "com.i3visio.Platform", |
359 | 374 | "value": self.platformName, |
400 | 415 | A list of elements to be appended. |
401 | 416 | """ |
402 | 417 | results = [] |
403 | print(f"[*] Launching search using the {self.__class__.__name__} module...") | |
418 | print(f"\t[*] Launching search using the {self.__class__.__name__} module...") | |
404 | 419 | test = self.check_searchfy(query, **kwargs) |
405 | 420 | |
406 | 421 | if test: |
643 | 658 | # Appending platform URI |
644 | 659 | aux = {} |
645 | 660 | aux["type"] = "com.i3visio.URI" |
646 | aux["value"] = self.create_url(word=query, mode="usufy") | |
661 | ||
662 | uri = self.create_url(word=query, mode="base") | |
663 | if uri: | |
664 | aux["value"] = uri | |
665 | else: | |
666 | aux["value"] = self.create_url(word=query, mode="usufy") | |
667 | ||
647 | 668 | aux["attributes"] = [] |
648 | 669 | r["attributes"].append(aux) |
649 | 670 | # Appending the alias |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Bitbacker(Platform): | |
27 | """A <Platform> object for Bitbacker""" | |
28 | def __init__(self): | |
29 | self.platformName = "bitbacker" | |
30 | self.tags = ["cryptocurrencies", "payments"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "https://bitbacker.io/user/<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["<h1>Not Found</h1>"] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Bucketlistly(Platform): | |
27 | """A <Platform> object for Bucketlistly""" | |
28 | def __init__(self): | |
29 | self.platformName = "Bucketlistly" | |
30 | self.tags = ["trips"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "http://www.bucketlistly.com/users/" + "<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query. | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = "[^0-9][^\.]+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["Sorry, the page you are looking for doesn't exist. (404) - Bucketlistly"] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | ||
91 | # Definition of regular expressions to be searched in searchfy mode | |
92 | #self.fieldsRegExp["searchfy"] = {} | |
93 | # Example of fields: | |
94 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
95 | ||
96 | ################ | |
97 | # Fields found # | |
98 | ################ | |
99 | # This attribute will be feeded when running the program. | |
100 | self.foundFields = {} |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Canva(Platform): | |
27 | """A <Platform> object for Canva""" | |
28 | def __init__(self): | |
29 | self.platformName = "Canva" | |
30 | self.tags = ["imagery"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "https://www.canva.com/" + "<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["(404)</h1>"] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Colourlovers(Platform): | |
27 | """A <Platform> object for Colourlovers""" | |
28 | def __init__(self): | |
29 | self.platformName = "Colourlovers" | |
30 | self.tags = ["art"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "http://www.colourlovers.com/lover/" + "<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["<h4>No one's home</h4>"] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} |
17 | 17 | ################################################################################ |
18 | 18 | |
19 | 19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" |
20 | __version__ = "2.0" | |
20 | __version__ = "3.0" | |
21 | 21 | |
22 | 22 | |
23 | 23 | from osrframework.utils.platforms import Platform |
24 | 24 | |
25 | 25 | |
26 | 26 | class Douban(Platform): |
27 | """A <Platform> object for Douban""" | |
27 | """<Platform> class""" | |
28 | 28 | def __init__(self): |
29 | """Constructor with parameters | |
30 | ||
31 | This method permits the developer to instantiate dinamically Platform | |
32 | objects.""" | |
29 | 33 | self.platformName = "Douban" |
30 | self.tags = ["social", "opinions"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "https://site.douban.com/" + "<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query. | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["https://img3.doubanio.com/pics/douban_error.gif"] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | ||
91 | # Definition of regular expressions to be searched in searchfy mode | |
92 | #self.fieldsRegExp["searchfy"] = {} | |
93 | # Example of fields: | |
94 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
95 | ||
96 | ################ | |
97 | # Fields found # | |
98 | ################ | |
99 | # This attribute will be feeded when running the program. | |
100 | self.foundFields = {} | |
34 | self.tags = ["social"] | |
35 | self.modes = { | |
36 | "usufy": { | |
37 | "debug": False, | |
38 | "extra_fields": {}, | |
39 | "needs_credentials": False, | |
40 | "not_found_text": 'https://img9.doubanio.com/pics/douban_error.gif"/>', | |
41 | "query_validator": "[a-z0-9A-Z_]+", | |
42 | "url": "https://site.douban.com/{placeholder}", | |
43 | } | |
44 | } |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Dreamstime(Platform): | |
27 | """A <Platform> object for Dreamstime""" | |
28 | def __init__(self): | |
29 | self.platformName = "Dreamstime" | |
30 | self.tags = ["social"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "https://es.dreamstime.com/" + "<usufy>" + "_info" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ['error404'] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} |
32 | 32 | # Base URL |
33 | 33 | self.baseURL = "https://facebook.com/" |
34 | 34 | |
35 | ######################## | |
36 | # Defining valid modes # | |
37 | ######################## | |
38 | self.isValidMode = {} | |
39 | self.isValidMode["phonefy"] = False | |
40 | self.isValidMode["usufy"] = True | |
41 | self.isValidMode["searchfy"] = True | |
42 | ||
43 | ###################################### | |
44 | # Search URL for the different modes # | |
45 | ###################################### | |
46 | # Strings with the URL for each and every mode | |
47 | self.url = {} | |
48 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
49 | self.url["usufy"] = "https://www.facebook.com/" + "<usufy>" | |
50 | self.url["searchfy"] = "https://www.facebook.com/public?query=" + "<searchfy>" | |
51 | ||
52 | ###################################### | |
53 | # Whether the user needs credentials # | |
54 | ###################################### | |
55 | self.needsCredentials = {} | |
56 | #self.needsCredentials["phonefy"] = False | |
57 | self.needsCredentials["usufy"] = False | |
58 | self.needsCredentials["searchfy"] = False | |
59 | ||
60 | ################# | |
61 | # Valid queries # | |
62 | ################# | |
63 | # Strings that will imply that the query number is not appearing | |
64 | self.validQuery = {} | |
65 | # The regular expression '.+' will match any query. | |
66 | #self.validQuery["phonefy"] = ".*" | |
67 | self.validQuery["usufy"] = ".+" | |
68 | self.validQuery["searchfy"] = ".+" | |
69 | ||
70 | ################### | |
71 | # Not_found clues # | |
72 | ################### | |
73 | # Strings that will imply that the query number is not appearing | |
74 | self.notFoundText = {} | |
75 | #self.notFoundText["phonefy"] = [] | |
76 | self.notFoundText["usufy"] = ["https://static.xx.fbcdn.net/rsrc.php/v3/yp/r/U4B06nLMGQt.png"] | |
77 | self.notFoundText["searchfy"] = [] | |
78 | ||
79 | ######################### | |
80 | # Fields to be searched # | |
81 | ######################### | |
82 | self.fieldsRegExp = {} | |
83 | ||
84 | # Definition of regular expressions to be searched in phonefy mode | |
85 | #self.fieldsRegExp["phonefy"] = {} | |
86 | # Example of fields: | |
87 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
88 | ||
89 | # Definition of regular expressions to be searched in usufy mode | |
90 | self.fieldsRegExp["usufy"] = {} | |
91 | # Example of fields: | |
92 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
93 | # Definition of regular expressions to be searched in searchfy mode | |
94 | self.fieldsRegExp["searchfy"] = {} | |
95 | self.searchfyAliasRegexp = "<a title=\"[^\"]+\" class=\"_2ial\" aria-label=\"[^\"]+\" href=\"https://www.facebook.com/([^\"]+)" | |
96 | # Example of fields: | |
97 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
98 | ||
99 | ################ | |
100 | # Fields found # | |
101 | ################ | |
102 | # This attribute will be feeded when running the program. | |
103 | self.foundFields = {} | |
35 | self.modes = { | |
36 | "usufy": { | |
37 | "debug": False, | |
38 | "extra_fields": { | |
39 | "com.i3visio.FullName": '<title id="pageTitle">(.+) \| Facebook</title>', # Regular expresion to extract the alias | |
40 | }, | |
41 | "needs_credentials": False, | |
42 | "not_found_text": "https://static.xx.fbcdn.net/rsrc.php/v3/yp/r/U4B06nLMGQt.png", # Text that indicates a missing profile | |
43 | "query_validator": "[a-zA-Z\.0-9_\-]+", # Regular expression that the alias SHOULD match | |
44 | "url": "https://www.facebook.com/{placeholder}", # Target URL where {placeholder} would be modified by the alias | |
45 | }, | |
46 | "searchfy": { | |
47 | "debug": False, | |
48 | "extra_fields": {}, | |
49 | "needs_credentials": False, | |
50 | "not_found_text": "We couldn't find anything for", | |
51 | "query_validator": ".+", | |
52 | "url": "https://www.facebook.com/public?query={placeholder}", | |
53 | # Needed function to extract aliases from the website | |
54 | "alias_regexp": '<a title="[^\"]+" class="_32mo" href="https://www.facebook.com/([^\"]+)"><span>' | |
55 | }, | |
56 | # Reimplementation needed of check_mailfy | |
57 | "mailfy": {}, | |
58 | } |
17 | 17 | ################################################################################ |
18 | 18 | |
19 | 19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" |
20 | __version__ = "2.0" | |
20 | __version__ = "3.0" | |
21 | 21 | |
22 | 22 | |
23 | 23 | from osrframework.utils.platforms import Platform |
24 | 24 | |
25 | 25 | |
26 | 26 | class Freelancer(Platform): |
27 | """A <Platform> object for Freelancer""" | |
27 | """A <Platform> object for Facebook""" | |
28 | 28 | def __init__(self): |
29 | 29 | self.platformName = "Freelancer" |
30 | 30 | self.tags = ["jobs"] |
31 | 31 | |
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "https://www.freelancer.com/u/<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["404 - Page not found</h3>"] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} | |
32 | self.modes = { | |
33 | "usufy": { | |
34 | "debug": False, | |
35 | "extra_fields": {}, | |
36 | "needs_credentials": False, | |
37 | "not_found_text": " Looks like the page you are looking for doesn't exist", # Text that indicates a missing profile | |
38 | "query_validator": "[a-zA-Z\.0-9_\-]+", # Regular expression that the alias SHOULD match | |
39 | "url": "https://www.freelancer.com/u/{placeholder}", # Target URL where {placeholder} would be modified by the alias | |
40 | "test": { | |
41 | "valid": "james", | |
42 | "invalid": "7ddf32e17a6ac5" | |
43 | } | |
44 | } | |
45 | } |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | import re | |
24 | ||
25 | import osrframework.utils.general as general | |
26 | from osrframework.utils.platforms import Platform | |
27 | ||
28 | ||
29 | class GnuPGKeys(Platform): | |
30 | """A <Platform> object for the MIT PGP public keys repository""" | |
31 | def __init__(self): | |
32 | self.platformName = "GnuPGKeys" | |
33 | self.tags = ["mails", "cryptography"] | |
34 | ||
35 | # Base URL | |
36 | self.baseURL = "http://keys.gnupg.net/pks/lookup?search=" | |
37 | ######################## | |
38 | # Defining valid modes # | |
39 | ######################## | |
40 | self.isValidMode = {} | |
41 | self.isValidMode["mailfy"] = True | |
42 | self.isValidMode["phonefy"] = False | |
43 | self.isValidMode["usufy"] = False | |
44 | self.isValidMode["searchfy"] = True | |
45 | ||
46 | ###################################### | |
47 | # Search URL for the different modes # | |
48 | ###################################### | |
49 | # Strings with the URL for each and every mode | |
50 | self.url = {} | |
51 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
52 | #self.url["usufy"] = "https://github.com/" + "<usufy>" | |
53 | self.url["searchfy"] = "http://keys.gnupg.net/pks/lookup?search=<searchfy>" | |
54 | ||
55 | ###################################### | |
56 | # Whether the user needs credentials # | |
57 | ###################################### | |
58 | self.needsCredentials = {} | |
59 | #self.needsCredentials["phonefy"] = False | |
60 | #self.needsCredentials["usufy"] = False | |
61 | self.needsCredentials["searchfy"] = False | |
62 | ||
63 | ################# | |
64 | # Valid queries # | |
65 | ################# | |
66 | # Strings that will imply that the query number is not appearing | |
67 | self.validQuery = {} | |
68 | # The regular expression '.+' will match any query. | |
69 | #self.validQuery["phonefy"] = ".*" | |
70 | #self.validQuery["usufy"] = ".*" | |
71 | self.validQuery["searchfy"] = ".+" | |
72 | self.validQuery["mailfy"] = ".+" | |
73 | ||
74 | ################### | |
75 | # Not_found clues # | |
76 | ################### | |
77 | # Strings that will imply that the query number is not appearing | |
78 | self.notFoundText = {} | |
79 | #self.notFoundText["phonefy"] = [] | |
80 | self.notFoundText["usufy"] = [ | |
81 | "This is not the web page you are looking for" | |
82 | ] | |
83 | self.notFoundText["searchfy"] = [] | |
84 | ||
85 | ######################### | |
86 | # Fields to be searched # | |
87 | ######################### | |
88 | self.fieldsRegExp = {} | |
89 | ||
90 | # Definition of regular expressions to be searched in phonefy mode | |
91 | #self.fieldsRegExp["phonefy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
94 | ||
95 | # Definition of regular expressions to be searched in usufy mode | |
96 | #self.fieldsRegExp["usufy"] = {} | |
97 | # Example of fields: | |
98 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
99 | # Definition of regular expressions to be searched in searchfy mode | |
100 | self.fieldsRegExp["searchfy"] = {} | |
101 | #self.searchfyAliasRegexp = '<([^\&]+)>' | |
102 | self.searchfyEmailRegexp = ' <([^\&]+)>' | |
103 | ||
104 | # Example of fields: | |
105 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
106 | ||
107 | ################ | |
108 | # Fields found # | |
109 | ################ | |
110 | # This attribute will be feeded when running the program. | |
111 | self.foundFields = {} | |
112 | ||
113 | def check_mailfy(self, query, **kwargs): | |
114 | """Verifying a mailfy query in this platform | |
115 | ||
116 | This might be redefined in any class inheriting from Platform. The only | |
117 | condition is that any of this should return a dictionary as defined. | |
118 | ||
119 | Args: | |
120 | query (str): The element to be searched. | |
121 | ||
122 | Returns: | |
123 | String. Returns the collected data if exists or None if not. | |
124 | """ | |
125 | import re | |
126 | import requests | |
127 | ||
128 | s = requests.Session() | |
129 | ||
130 | # Getting the first response to grab the csrf_token | |
131 | resp = s.get(f"http://keys.gnupg.net/pks/lookup?search={query}") | |
132 | ||
133 | if resp.status_code == 200 or resp.status_code == 404: | |
134 | if ' 0 keys found..' in resp.text: | |
135 | return None | |
136 | else: | |
137 | return resp.text | |
138 | else: | |
139 | print(general.warning(f"\t[*] Something happened. keyserver.io returned status '{resp.status_code}' for '{query}'.")) | |
140 | return None | |
141 | ||
142 | def do_mailfy(self, query, **kwargs): | |
143 | """Verifying a mailfy query in this platform | |
144 | ||
145 | This might be redefined in any class inheriting from Platform. The only | |
146 | condition is that any of this should return an equivalent array. | |
147 | ||
148 | Args: | |
149 | query: The element to be searched. | |
150 | ||
151 | Returns: | |
152 | A list of elements to be appended. A sample output format is as follows: | |
153 | [ | |
154 | { | |
155 | "attributes": [ | |
156 | { | |
157 | "attributes": [], | |
158 | "type": "com.i3visio.Email", | |
159 | "value": "[email protected]" | |
160 | }, | |
161 | { | |
162 | "attributes": [], | |
163 | "type": "com.i3visio.Alias", | |
164 | "value": "contacto" | |
165 | }, | |
166 | { | |
167 | "attributes": [], | |
168 | "type": "com.i3visio.Domain", | |
169 | "value": "i3visio.com" | |
170 | }, | |
171 | { | |
172 | "attributes": [], | |
173 | "type": "com.i3visio.Platform", | |
174 | "value": "Twitter" | |
175 | } | |
176 | ], | |
177 | "type": "com.i3visio.Profile", | |
178 | "value": "Twitter - [email protected]" | |
179 | } | |
180 | ] | |
181 | """ | |
182 | info = self.check_mailfy(query, **kwargs) | |
183 | ||
184 | results = [] | |
185 | if info: | |
186 | emails = set(re.findall(' <([^\&]+)>', info)) | |
187 | ||
188 | for i, email in enumerate(emails): | |
189 | try: | |
190 | expandedEntities = general.expand_entities_from_email(email) | |
191 | r = { | |
192 | "type": "com.i3visio.Profile", | |
193 | "value": self.platformName + " - " + email, | |
194 | "attributes": expandedEntities + [ | |
195 | { | |
196 | "type": "com.i3visio.Platform", | |
197 | "value": self.platformName, | |
198 | "attributes": [] | |
199 | } | |
200 | ] | |
201 | } | |
202 | results.append(r) | |
203 | except IndexError: | |
204 | # A result does not contain a @. | |
205 | pass | |
206 | ||
207 | return results |
59 | 59 | # This attribute will be feeded when running the program. |
60 | 60 | self.foundFields = {} |
61 | 61 | |
62 | ||
63 | 62 | def check_mailfy(self, query, kwargs={}): |
64 | 63 | """Verifying a mailfy query in this platform |
65 | 64 |
17 | 17 | ################################################################################ |
18 | 18 | |
19 | 19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" |
20 | __version__ = "2.0" | |
20 | __version__ = "3.0" | |
21 | 21 | |
22 | 22 | |
23 | 23 | from osrframework.utils.platforms import Platform |
24 | 24 | |
25 | 25 | |
26 | 26 | class Jamiiforums(Platform): |
27 | """A <Platform> object for Jamiiforums""" | |
27 | """<Platform> class""" | |
28 | 28 | def __init__(self): |
29 | """Constructor with parameters | |
30 | ||
31 | This method permits the developer to instantiate dinamically Platform | |
32 | objects.""" | |
29 | 33 | self.platformName = "Jamiiforums" |
30 | self.tags = ["opinions", "contact"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "http://jamiiforums.com/members/?username=<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query. | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = [ | |
74 | ( | |
75 | "The specified member cannot be found. Please enter a member's" | |
76 | " entire name." | |
77 | ) | |
78 | ] | |
79 | #self.notFoundText["searchfy"] = [] | |
80 | ||
81 | ######################### | |
82 | # Fields to be searched # | |
83 | ######################### | |
84 | self.fieldsRegExp = {} | |
85 | ||
86 | # Definition of regular expressions to be searched in phonefy mode | |
87 | #self.fieldsRegExp["phonefy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
90 | ||
91 | # Definition of regular expressions to be searched in usufy mode | |
92 | self.fieldsRegExp["usufy"] = {} | |
93 | # Example of fields: | |
94 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
95 | # Definition of regular expressions to be searched in searchfy mode | |
96 | #self.fieldsRegExp["searchfy"] = {} | |
97 | # Example of fields: | |
98 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
99 | ||
100 | ################ | |
101 | # Fields found # | |
102 | ################ | |
103 | # This attribute will be feeded when running the program. | |
104 | self.foundFields = {} | |
34 | self.tags = ["opinions"] | |
35 | self.modes = { | |
36 | "usufy": { | |
37 | "debug": False, | |
38 | "extra_fields": { | |
39 | "com.i3visio.Name": '>([^<]+)</span></h1>', | |
40 | }, | |
41 | "needs_credentials": False, | |
42 | "not_found_text": "The specified member cannot be found. Please enter a member's entire name.", | |
43 | "query_validator": "[a-z0-9A-Z_]+", | |
44 | "url": "https://www.jamiiforums.com/members/?username={placeholder}", | |
45 | } | |
46 | } |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | import re | |
24 | ||
25 | import osrframework.utils.general as general | |
26 | from osrframework.utils.platforms import Platform | |
27 | ||
28 | ||
29 | class KeyServerIO(Platform): | |
30 | """A <Platform> object for the MIT PGP public keys repository""" | |
31 | def __init__(self): | |
32 | self.platformName = "KeyServerIO" | |
33 | self.tags = ["mails", "cryptography"] | |
34 | ||
35 | # Base URL | |
36 | self.baseURL = "https://pgp.key-server.io/pks/lookup?search=" | |
37 | ######################## | |
38 | # Defining valid modes # | |
39 | ######################## | |
40 | self.isValidMode = {} | |
41 | self.isValidMode["mailfy"] = True | |
42 | self.isValidMode["phonefy"] = False | |
43 | self.isValidMode["usufy"] = False | |
44 | self.isValidMode["searchfy"] = True | |
45 | ||
46 | ###################################### | |
47 | # Search URL for the different modes # | |
48 | ###################################### | |
49 | # Strings with the URL for each and every mode | |
50 | self.url = {} | |
51 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
52 | #self.url["usufy"] = "https://github.com/" + "<usufy>" | |
53 | self.url["searchfy"] = "https://pgp.key-server.io/pks/lookup?search=<searchfy>" | |
54 | ||
55 | ###################################### | |
56 | # Whether the user needs credentials # | |
57 | ###################################### | |
58 | self.needsCredentials = {} | |
59 | #self.needsCredentials["phonefy"] = False | |
60 | #self.needsCredentials["usufy"] = False | |
61 | self.needsCredentials["searchfy"] = False | |
62 | ||
63 | ################# | |
64 | # Valid queries # | |
65 | ################# | |
66 | # Strings that will imply that the query number is not appearing | |
67 | self.validQuery = {} | |
68 | # The regular expression '.+' will match any query. | |
69 | #self.validQuery["phonefy"] = ".*" | |
70 | #self.validQuery["usufy"] = ".*" | |
71 | self.validQuery["searchfy"] = ".+" | |
72 | self.validQuery["mailfy"] = ".+" | |
73 | ||
74 | ################### | |
75 | # Not_found clues # | |
76 | ################### | |
77 | # Strings that will imply that the query number is not appearing | |
78 | self.notFoundText = {} | |
79 | #self.notFoundText["phonefy"] = [] | |
80 | self.notFoundText["usufy"] = [ | |
81 | "This is not the web page you are looking for" | |
82 | ] | |
83 | self.notFoundText["searchfy"] = [] | |
84 | ||
85 | ######################### | |
86 | # Fields to be searched # | |
87 | ######################### | |
88 | self.fieldsRegExp = {} | |
89 | ||
90 | # Definition of regular expressions to be searched in phonefy mode | |
91 | #self.fieldsRegExp["phonefy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
94 | ||
95 | # Definition of regular expressions to be searched in usufy mode | |
96 | #self.fieldsRegExp["usufy"] = {} | |
97 | # Example of fields: | |
98 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
99 | # Definition of regular expressions to be searched in searchfy mode | |
100 | self.fieldsRegExp["searchfy"] = {} | |
101 | #self.searchfyAliasRegexp = '<([^\&]+)>' | |
102 | self.searchfyEmailRegexp = ' <([^\&]+)>' | |
103 | ||
104 | # Example of fields: | |
105 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
106 | ||
107 | ################ | |
108 | # Fields found # | |
109 | ################ | |
110 | # This attribute will be feeded when running the program. | |
111 | self.foundFields = {} | |
112 | ||
113 | def check_mailfy(self, query, **kwargs): | |
114 | """Verifying a mailfy query in this platform | |
115 | ||
116 | This might be redefined in any class inheriting from Platform. The only | |
117 | condition is that any of this should return a dictionary as defined. | |
118 | ||
119 | Args: | |
120 | query (str): The element to be searched. | |
121 | ||
122 | Returns: | |
123 | String. Returns the collected data if exists or None if not. | |
124 | """ | |
125 | import re | |
126 | import requests | |
127 | ||
128 | s = requests.Session() | |
129 | ||
130 | # Getting the first response to grab the csrf_token | |
131 | resp = s.get(f"https://pgp.key-server.io/pks/lookup?search={query}") | |
132 | ||
133 | if resp.status_code == 200 or resp.status_code == 404: | |
134 | if ' 0 keys found..' in resp.text: | |
135 | return None | |
136 | else: | |
137 | return resp.text | |
138 | else: | |
139 | print(general.warning(f"Something happened. keyserver.io returned status '{resp.status_code}' for '{query}'.")) | |
140 | return None | |
141 | ||
142 | def do_mailfy(self, query, **kwargs): | |
143 | """Verifying a mailfy query in this platform | |
144 | ||
145 | This might be redefined in any class inheriting from Platform. The only | |
146 | condition is that any of this should return an equivalent array. | |
147 | ||
148 | Args: | |
149 | query: The element to be searched. | |
150 | ||
151 | Returns: | |
152 | A list of elements to be appended. A sample output format is as follows: | |
153 | [ | |
154 | { | |
155 | "attributes": [ | |
156 | { | |
157 | "attributes": [], | |
158 | "type": "com.i3visio.Email", | |
159 | "value": "[email protected]" | |
160 | }, | |
161 | { | |
162 | "attributes": [], | |
163 | "type": "com.i3visio.Alias", | |
164 | "value": "contacto" | |
165 | }, | |
166 | { | |
167 | "attributes": [], | |
168 | "type": "com.i3visio.Domain", | |
169 | "value": "i3visio.com" | |
170 | }, | |
171 | { | |
172 | "attributes": [], | |
173 | "type": "com.i3visio.Platform", | |
174 | "value": "Twitter" | |
175 | } | |
176 | ], | |
177 | "type": "com.i3visio.Profile", | |
178 | "value": "Twitter - [email protected]" | |
179 | } | |
180 | ] | |
181 | """ | |
182 | info = self.check_mailfy(query, **kwargs) | |
183 | ||
184 | results = [] | |
185 | if info: | |
186 | emails = set(re.findall(' <([^\&]+)>', info)) | |
187 | ||
188 | for i, email in enumerate(emails): | |
189 | try: | |
190 | expandedEntities = general.expand_entities_from_email(email) | |
191 | r = { | |
192 | "type": "com.i3visio.Profile", | |
193 | "value": self.platformName + " - " + email, | |
194 | "attributes": expandedEntities + [ | |
195 | { | |
196 | "type": "com.i3visio.Platform", | |
197 | "value": self.platformName, | |
198 | "attributes": [] | |
199 | } | |
200 | ] | |
201 | } | |
202 | results.append(r) | |
203 | except IndexError: | |
204 | # A result does not contain a @. | |
205 | pass | |
206 | ||
207 | return results |
17 | 17 | ################################################################################ |
18 | 18 | |
19 | 19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" |
20 | __version__ = "2.0" | |
20 | __version__ = "3.0" | |
21 | 21 | |
22 | 22 | |
23 | 23 | from osrframework.utils.platforms import Platform |
29 | 29 | self.platformName = "Listaspam" |
30 | 30 | self.tags = ["phone"] |
31 | 31 | |
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = True | |
37 | self.isValidMode["usufy"] = False | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | self.url = {} | |
44 | self.url["phonefy"] = "http://www.listaspam.com/busca.php?Telefono=<phonefy>" | |
45 | #self.url["usufy"] = "http://anyurl.com/user/" + "<phonefy>" | |
46 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<phonefy>" | |
47 | ||
48 | ###################################### | |
49 | # Whether the user needs credentials # | |
50 | ###################################### | |
51 | self.needsCredentials = {} | |
52 | self.needsCredentials["phonefy"] = False | |
53 | self.needsCredentials["usufy"] = False | |
54 | self.needsCredentials["searchfy"] = False | |
55 | ||
56 | ################# | |
57 | # Valid queries # | |
58 | ################# | |
59 | # Strings that will imply that the query number is not appearing | |
60 | self.validQuery = {} | |
61 | # The regular expression '.+' will match any query. | |
62 | self.validQuery["phonefy"] = ".+" | |
63 | self.validQuery["usufy"] = ".+" | |
64 | self.validQuery["searchfy"] = ".+" | |
65 | ||
66 | ################### | |
67 | # Not_found clues # | |
68 | ################### | |
69 | # Strings that will imply that the phone number is not appearing | |
70 | self.notFoundText = {} | |
71 | self.notFoundText["phonefy"] = [ | |
72 | "No te quedes sin saber quien te llama por teléfono." | |
73 | ] | |
74 | #self.notFoundText["usufy"] = [] | |
75 | #self.notFoundText["searchfy"] = [] | |
76 | ||
77 | ######################### | |
78 | # Fields to be searched # | |
79 | ######################### | |
80 | self.fieldsRegExp = {} | |
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | self.fieldsRegExp["phonefy"] = {} | |
83 | self.fieldsRegExp["phonefy"]["i3visio.location.province"] = "<strong class='located_label'>(.*)," | |
84 | self.fieldsRegExp["phonefy"]["i3visio.location.country"] = "class='country_located' alt='([a-zA-Zñ]*)'" | |
85 | self.fieldsRegExp["phonefy"]["i3visio.text"] = '<h4 class="media-heading">(.*)</p>' | |
86 | ||
87 | # Definition of regular expressions to be searched in usufy mode | |
88 | #self.fieldsRegExp["usufy"] = {} | |
89 | # Example of fields: | |
90 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
91 | ||
92 | # Definition of regular expressions to be searched in searchfy mode | |
93 | #self.fieldsRegExp["searchfy"] = {} | |
94 | # Example of fields: | |
95 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
96 | ||
97 | ################ | |
98 | # Fields found # | |
99 | ################ | |
100 | # This attribute will be feeded when running the program. | |
101 | self.foundFields = {} | |
32 | self.modes = { | |
33 | "phonefy": { | |
34 | "debug": False, | |
35 | "extra_fields": { | |
36 | "com.i3visio.Location": "<div>📍([^<]+)</div>", | |
37 | "com.i3visio.Labels": 'Nube de tags: (.+)</div>' | |
38 | }, | |
39 | "needs_credentials": False, | |
40 | "not_found_text": "No te quedes sin saber quién te llama por teléfono.", # Text that indicates a missing profile | |
41 | "query_validator": "[0-9+\-\.]{6-16}", # Regular expression that the alias SHOULD match | |
42 | "url": "http://www.listaspam.com/busca.php?Telefono={placeholder}", # Target URL where {placeholder} would be modified by the alias | |
43 | } | |
44 | } |
17 | 17 | ################################################################################ |
18 | 18 | |
19 | 19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" |
20 | __version__ = "2.0" | |
20 | __version__ = "3.0" | |
21 | 21 | |
22 | 22 | |
23 | 23 | from osrframework.utils.platforms import Platform |
36 | 36 | "usufy": { |
37 | 37 | "debug": False, |
38 | 38 | "extra_fields": { |
39 | "com.i3visio.Name": '<h2>([^<]+)</h2>', # Regular expresion to extract the alias | |
39 | "com.i3visio.Name": '<h2>([^<]+)</h2>', | |
40 | 40 | }, |
41 | 41 | "needs_credentials": False, |
42 | "not_found_text": "<title>Minds</title>", # Text that indicates a missing profile | |
43 | "query_validator": "[a-z0-9A-Z_]+", # Regular expression that the alias SHOULD match | |
44 | "url": "https://www.minds.com/{placeholder}", # Target URL where {placeholder} would be modified by the alias | |
42 | "not_found_text": "Sorry, the channel couldn't be found", | |
43 | "query_validator": "[a-z0-9A-Z_]+", | |
44 | "url": "https://www.minds.com/{placeholder}", | |
45 | 45 | } |
46 | 46 | } |
17 | 17 | ################################################################################ |
18 | 18 | |
19 | 19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" |
20 | __version__ = "2.0" | |
20 | __version__ = "3.0" | |
21 | 21 | |
22 | 22 | |
23 | 23 | from osrframework.utils.platforms import Platform |
24 | 24 | |
25 | 25 | |
26 | class Okcupid(Platform): | |
27 | """A <Platform> object for Okcupid""" | |
26 | class OkCupid(Platform): | |
27 | """<Platform> class""" | |
28 | 28 | def __init__(self): |
29 | self.platformName = "Okcupid" | |
29 | """Constructor with parameters | |
30 | ||
31 | This method permits the developer to instantiate dinamically Platform | |
32 | objects.""" | |
33 | self.platformName = "OkCupid" | |
30 | 34 | self.tags = ["contact"] |
35 | self.modes = { | |
36 | "mailfy": { | |
37 | "debug": False, | |
38 | } | |
39 | } | |
31 | 40 | |
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
41 | def check_mailfy(self, query, kwargs={}): | |
42 | """Verifying a mailfy query in this platform | |
39 | 43 | |
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "https://www.okcupid.com/profile/" + "<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
44 | This might be redefined in any class inheriting from Platform. The only | |
45 | condition is that any of this should return a dictionary as defined. | |
48 | 46 | |
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
47 | Args: | |
48 | query (str): The element to be searched. | |
56 | 49 | |
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
50 | Returns: | |
51 | String. The collected data if exists or None if not. | |
52 | """ | |
53 | import requests | |
66 | 54 | |
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["<title>Account not found"] | |
74 | #self.notFoundText["searchfy"] = [] | |
55 | s = requests.Session() | |
75 | 56 | |
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
57 | # Getting the first response to grab the csrf_token | |
58 | r1 = s.get('https://www.okcupid.com') | |
80 | 59 | |
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
60 | # Launching the query to Instagram | |
61 | r2 = s.post( | |
62 | 'https://www.okcupid.com/1/apitun/signup/check_email', | |
63 | json={"email": query}, | |
64 | ) | |
85 | 65 | |
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
66 | if self.modes["mailfy"]["debug"]: | |
67 | print(f"Response: {[r2.text]}") | |
94 | 68 | |
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} | |
69 | if '"is_valid" : false' in r2.text: | |
70 | return r2.text | |
71 | return None |
17 | 17 | ################################################################################ |
18 | 18 | |
19 | 19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" |
20 | __version__ = "2.0" | |
20 | __version__ = "3.0" | |
21 | 21 | |
22 | 22 | |
23 | 23 | from osrframework.utils.platforms import Platform |
24 | 24 | |
25 | 25 | |
26 | 26 | class Onename(Platform): |
27 | """A <Platform> object for Onename""" | |
27 | """<Platform> class""" | |
28 | 28 | def __init__(self): |
29 | 29 | self.platformName = "Onename" |
30 | 30 | self.tags = ["cryptocurrencies", "identity"] |
31 | 31 | |
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "https://onename.com/" + "<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["User data not properly formatted"] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} | |
32 | self.modes = { | |
33 | "usufy": { | |
34 | "debug": False, | |
35 | "extra_fields": {}, | |
36 | "needs_credentials": False, | |
37 | "not_found_text": "<title>Page Not Found</title>", # Text that indicates a missing profile | |
38 | "query_validator": "[a-zA-Z\.0-9_\-]+", # Regular expression that the alias SHOULD match | |
39 | "url": "https://onename.com//{placeholder}", # Target URL where {placeholder} would be modified by the alias | |
40 | "test": { | |
41 | "valid": "james", | |
42 | "invalid": "7ddf32e17a6ac5" | |
43 | } | |
44 | } | |
45 | } |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Pixinsight(Platform): | |
27 | """A <Platform> object for Pixinsight""" | |
28 | def __init__(self): | |
29 | self.platformName = "Pixinsight" | |
30 | self.tags = ["imagery"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "http://pixinsight.com/forum/index.php?action=profile;user=<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query. | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = [ | |
74 | "The user whose profile you are trying to view does not exist." | |
75 | ] | |
76 | #self.notFoundText["searchfy"] = [] | |
77 | ||
78 | ######################### | |
79 | # Fields to be searched # | |
80 | ######################### | |
81 | self.fieldsRegExp = {} | |
82 | ||
83 | # Definition of regular expressions to be searched in phonefy mode | |
84 | #self.fieldsRegExp["phonefy"] = {} | |
85 | # Example of fields: | |
86 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
87 | ||
88 | # Definition of regular expressions to be searched in usufy mode | |
89 | self.fieldsRegExp["usufy"] = {} | |
90 | # Example of fields: | |
91 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
92 | # Definition of regular expressions to be searched in searchfy mode | |
93 | #self.fieldsRegExp["searchfy"] = {} | |
94 | # Example of fields: | |
95 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
96 | ||
97 | ################ | |
98 | # Fields found # | |
99 | ################ | |
100 | # This attribute will be feeded when running the program. | |
101 | self.foundFields = {} |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Sarahah(Platform): | |
27 | """A <Platform> object for Sarahah""" | |
28 | def __init__(self): | |
29 | self.platformName = "Sarahah" | |
30 | self.tags = ["social", "teenagers"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "https://<usufy>.sarahah.com" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ['<title>Sarahah </title>'] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = {"start": 'Location: "', "end": '"'} | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Sidereel(Platform): | |
27 | """A <Platform> object for Sidereel""" | |
28 | def __init__(self): | |
29 | self.platformName = "Sidereel" | |
30 | self.tags = ["social"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "http://www.sidereel.com/profile/" + "<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query. | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["Page Not Found"] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Soup(Platform): | |
27 | """A <Platform> object for Soup""" | |
28 | def __init__(self): | |
29 | self.platformName = "Soup" | |
30 | self.tags = ["social"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "https://" + "<usufy>" + ".soup.io" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["<h2>Happy happy joy joy! A new user!</h2>"] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Taringa(Platform): | |
27 | """A <Platform> object for Taringa""" | |
28 | def __init__(self): | |
29 | self.platformName = "Taringa" | |
30 | self.tags = ["social"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "https://www.taringa.net/" + "<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query. | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ['/dist/404Retina.png', '>Taringa! - Inteligencia Colectiva en Taringa!</title>', '>Taringa! - Inteligencia Colectiva en Taringa!</title>' ] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | from osrframework.utils.platforms import Platform | |
24 | ||
25 | ||
26 | class Thesims(Platform): | |
27 | """A <Platform> object for Thesims""" | |
28 | def __init__(self): | |
29 | self.platformName = "Thesims" | |
30 | self.tags = ["gaming"] | |
31 | ||
32 | ######################## | |
33 | # Defining valid modes # | |
34 | ######################## | |
35 | self.isValidMode = {} | |
36 | self.isValidMode["phonefy"] = False | |
37 | self.isValidMode["usufy"] = True | |
38 | self.isValidMode["searchfy"] = False | |
39 | ||
40 | ###################################### | |
41 | # Search URL for the different modes # | |
42 | ###################################### | |
43 | # Strings with the URL for each and every mode | |
44 | self.url = {} | |
45 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
46 | self.url["usufy"] = "http://mypage.thesims3.com/mypage/" + "<usufy>" | |
47 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
48 | ||
49 | ###################################### | |
50 | # Whether the user needs credentials # | |
51 | ###################################### | |
52 | self.needsCredentials = {} | |
53 | #self.needsCredentials["phonefy"] = False | |
54 | self.needsCredentials["usufy"] = False | |
55 | #self.needsCredentials["searchfy"] = False | |
56 | ||
57 | ################# | |
58 | # Valid queries # | |
59 | ################# | |
60 | # Strings that will imply that the query number is not appearing | |
61 | self.validQuery = {} | |
62 | # The regular expression '.+' will match any query. | |
63 | #self.validQuery["phonefy"] = ".*" | |
64 | self.validQuery["usufy"] = ".+" | |
65 | #self.validQuery["searchfy"] = ".*" | |
66 | ||
67 | ################### | |
68 | # Not_found clues # | |
69 | ################### | |
70 | # Strings that will imply that the query number is not appearing | |
71 | self.notFoundText = {} | |
72 | #self.notFoundText["phonefy"] = [] | |
73 | self.notFoundText["usufy"] = ["<title> - Community - The Sims 3</title>"] | |
74 | #self.notFoundText["searchfy"] = [] | |
75 | ||
76 | ######################### | |
77 | # Fields to be searched # | |
78 | ######################### | |
79 | self.fieldsRegExp = {} | |
80 | ||
81 | # Definition of regular expressions to be searched in phonefy mode | |
82 | #self.fieldsRegExp["phonefy"] = {} | |
83 | # Example of fields: | |
84 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
85 | ||
86 | # Definition of regular expressions to be searched in usufy mode | |
87 | self.fieldsRegExp["usufy"] = {} | |
88 | # Example of fields: | |
89 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
90 | # Definition of regular expressions to be searched in searchfy mode | |
91 | #self.fieldsRegExp["searchfy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
94 | ||
95 | ################ | |
96 | # Fields found # | |
97 | ################ | |
98 | # This attribute will be feeded when running the program. | |
99 | self.foundFields = {} |
31 | 31 | self.tags = ["contact", "microblogging", "social"] |
32 | 32 | |
33 | 33 | # Base URL |
34 | self.baseURL = "http://twitter.com/" | |
34 | self.baseURL = "https://twitter.com/" | |
35 | 35 | |
36 | ######################## | |
37 | # Defining valid modes # | |
38 | ######################## | |
39 | self.isValidMode = {} | |
40 | self.isValidMode["mailfy"] = True | |
41 | self.isValidMode["phonefy"] = False | |
42 | self.isValidMode["searchfy"] = True | |
43 | self.isValidMode["usufy"] = True | |
44 | ||
45 | ###################################### | |
46 | # Search URL for the different modes # | |
47 | ###################################### | |
48 | # Strings with the URL for each and every mode | |
49 | self.url = {} | |
50 | self.url["mailfy"] = "https://api.twitter.com/i/users/email_available.json?email=<mailfy>" | |
51 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
52 | self.url["searchfy"] = "https://twitter.com/search?f=users&vertical=default&q=\"" + "<searchfy>" + "\"" | |
53 | self.url["usufy"] = "http://twitter.com/" + "<usufy>" | |
54 | ||
55 | ###################################### | |
56 | # Whether the user needs credentials # | |
57 | ###################################### | |
58 | self.needsCredentials = {} | |
59 | self.needsCredentials["mailfy"] = False | |
60 | #self.needsCredentials["phonefy"] = False | |
61 | self.needsCredentials["usufy"] = False | |
62 | self.needsCredentials["searchfy"] = False | |
63 | ||
64 | ################# | |
65 | # Valid queries # | |
66 | ################# | |
67 | # Strings that will imply that the query number is not appearing | |
68 | self.validQuery = {} | |
69 | # The regular expression '.+' will match any query. | |
70 | #self.validQuery["phonefy"] = ".*" | |
71 | self.validQuery["usufy"] = "[a-zA-Z0-9_]+" | |
72 | self.validQuery["searchfy"] = ".+" | |
73 | self.validQuery["mailfy"] = ".+" | |
74 | ||
75 | ################### | |
76 | # Not_found clues # | |
77 | ################### | |
78 | # Strings that will imply that the query number is not appearing | |
79 | self.notFoundText = {} | |
80 | self.notFoundText["mailfy"] = ['"valid":true'] | |
81 | #self.notFoundText["phonefy"] = [] | |
82 | self.notFoundText["usufy"] = ["<form class=\"search-404\""] | |
83 | self.notFoundText["searchfy"] = [] | |
84 | ||
85 | ######################### | |
86 | # Fields to be searched # | |
87 | ######################### | |
88 | self.fieldsRegExp = {} | |
89 | ||
90 | # Definition of regular expressions to be searched in phonefy mode | |
91 | #self.fieldsRegExp["phonefy"] = {} | |
92 | # Example of fields: | |
93 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
94 | ||
95 | # Definition of regular expressions to be searched in usufy mode | |
96 | self.fieldsRegExp["usufy"] = {} | |
97 | # Examples (do NOT forget to escape the quoting marks inside any string: \"): | |
98 | self.fieldsRegExp["usufy"]["@protected"] = {"start": "data-protected=\"", "end": "\">\n <span class=\"UserActions"} | |
99 | self.fieldsRegExp["usufy"]["i3visio.fullname"] = {"start": "class=\"ProfileHeaderCard-nameLink u-textInheritColor js-nav\n\">", "end": "</a>\n </h1>"} | |
100 | #self.fieldsRegExp["usufy"]["ProfileHeaderCard-bio"] = {"start": "<p class=\"ProfileHeaderCard-bio u-dir\"\n \n dir=\"ltr\">", "end": "</p>"} | |
101 | self.fieldsRegExp["usufy"]["i3visio.location"] = {"start": "<span class=\"ProfileHeaderCard-locationText u-dir\" dir=\"ltr\">\n ", "end": "\n </span>\n </div>\n\n <div class=\"ProfileHeaderCard-url"} | |
102 | self.fieldsRegExp["usufy"]["@created_at"] = {"start": "<span class=\"ProfileHeaderCard-joinDateText js-tooltip u-dir\" dir=\"ltr\" title=\"", "end": "\">Se uni"} | |
103 | self.fieldsRegExp["usufy"]["i3visio.uri.homepage"] = {"start": "<span class=\"ProfileHeaderCard-urlText u-dir\" dir=\"ltr\"><a class=\"u-textUserColor\" target=\"_blank\" rel=\"me nofollow\" href=\"[^\"]*\" title=\"", "end": "\">"} | |
104 | #self.fieldsRegExp["usufy"]["PhotoRail-headingText"] = {"start": "class=\"js-nav\">\n \n ", "end": " </a>"} | |
105 | ||
106 | # Definition of regular expressions to be searched in searchfy mode | |
107 | self.fieldsRegExp["searchfy"] = {} | |
108 | self.searchfyAliasRegexp = "data-screen-name=\"([^\"]+)\"" | |
109 | # Example of fields: | |
110 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
111 | ||
112 | ################ | |
113 | # Fields found # | |
114 | ################ | |
115 | # This attribute will be feeded when running the program. | |
116 | self.foundFields = {} | |
117 | ||
36 | self.modes = { | |
37 | "usufy": { | |
38 | "debug": False, | |
39 | "extra_fields": { | |
40 | "com.i3visio.FullName": ' \((.+)\)</title>', # Regular expresion to extract the alias | |
41 | }, | |
42 | "needs_credentials": False, | |
43 | "not_found_text": "Sorry, that page does not exist. ", # Text that indicates a missing profile | |
44 | "query_validator": "[a-zA-Z0-9_]{3,15}", # Regular expression that the alias SHOULD match | |
45 | "url": "https://tweettunnel.com/{placeholder}", # Target URL where {placeholder} would be modified by the alias | |
46 | }, | |
47 | # Reimplementation needed of check_mailfy | |
48 | "mailfy": { | |
49 | "debug": False, | |
50 | "extra_fields": {}, | |
51 | "needs_credentials": False, | |
52 | "not_found_text": '"valid":true', | |
53 | "query_validator": ".+", | |
54 | "url": "https://api.twitter.com/i/users/email_available.json?email=", | |
55 | }, | |
56 | } | |
118 | 57 | |
119 | 58 | def do_usufy(self, query, **kwargs): |
120 | """ | |
121 | Verifying a usufy query in this platform. | |
59 | """Verifying a usufy query in this platform using the API | |
122 | 60 | |
123 | This might be redefined in any class inheriting from Platform. | |
61 | If no credentials are provided, the standard verifier will be raised. | |
124 | 62 | |
125 | 63 | Args: |
126 | ----- | |
127 | 64 | query: The element to be searched. |
128 | 65 | |
129 | 66 | Return: |
130 | ------- | |
131 | 67 | A list of elements to be appended. |
132 | 68 | """ |
133 | 69 | # Trying to interact with the API Wrapper |
150 | 86 | return super(Twitter, self).do_usufy(query, **kwargs) |
151 | 87 | |
152 | 88 | def do_searchfy(self, query, **kwargs): |
153 | """Verifying a usufy query in this platform | |
89 | """Verifying a searchfy query in this platform using the API | |
154 | 90 | |
155 | This might be redefined in any class inheriting from Platform. | |
91 | If no credentials are provided, the standard verifier will be raised. | |
156 | 92 | |
157 | 93 | Args: |
158 | 94 | query (str): The element to be searched. |
0 | ################################################################################ | |
1 | # | |
2 | # Copyright 2015-2020 Félix Brezo and Yaiza Rubio | |
3 | # | |
4 | # This program is part of OSRFramework. You can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # | |
17 | ################################################################################ | |
18 | ||
19 | __author__ = "Felix Brezo, Yaiza Rubio <[email protected]>" | |
20 | __version__ = "2.0" | |
21 | ||
22 | ||
23 | import osrframework.utils.browser as browser | |
24 | from osrframework.utils.platforms import Platform | |
25 | ||
26 | ||
27 | class V7n(Platform): | |
28 | """A <Platform> object for V7n""" | |
29 | def __init__(self): | |
30 | self.platformName = "V7n" | |
31 | self.tags = ["development"] | |
32 | ||
33 | ######################## | |
34 | # Defining valid modes # | |
35 | ######################## | |
36 | self.isValidMode = {} | |
37 | self.isValidMode["phonefy"] = False | |
38 | self.isValidMode["usufy"] = True | |
39 | self.isValidMode["searchfy"] = False | |
40 | ||
41 | ###################################### | |
42 | # Search URL for the different modes # | |
43 | ###################################### | |
44 | # Strings with the URL for each and every mode | |
45 | self.url = {} | |
46 | #self.url["phonefy"] = "http://anyurl.com//phone/" + "<phonefy>" | |
47 | self.url["usufy"] = "http://www.v7n.com/forums/members/" + "<usufy>" + ".html" | |
48 | #self.url["searchfy"] = "http://anyurl.com/search/" + "<searchfy>" | |
49 | ||
50 | ###################################### | |
51 | # Whether the user needs credentials # | |
52 | ###################################### | |
53 | self.needsCredentials = {} | |
54 | #self.needsCredentials["phonefy"] = False | |
55 | self.needsCredentials["usufy"] = False | |
56 | #self.needsCredentials["searchfy"] = False | |
57 | ||
58 | ################# | |
59 | # Valid queries # | |
60 | ################# | |
61 | # Strings that will imply that the query number is not appearing | |
62 | self.validQuery = {} | |
63 | # The regular expression '.+' will match any query | |
64 | #self.validQuery["phonefy"] = ".*" | |
65 | self.validQuery["usufy"] = ".+" | |
66 | #self.validQuery["searchfy"] = ".*" | |
67 | ||
68 | ################### | |
69 | # Not_found clues # | |
70 | ################### | |
71 | # Strings that will imply that the query number is not appearing | |
72 | self.notFoundText = {} | |
73 | #self.notFoundText["phonefy"] = [] | |
74 | self.notFoundText["usufy"] = ["This user has not registered and therefore does not have a profile to view."] | |
75 | #self.notFoundText["searchfy"] = [] | |
76 | ||
77 | ######################### | |
78 | # Fields to be searched # | |
79 | ######################### | |
80 | self.fieldsRegExp = {} | |
81 | ||
82 | # Definition of regular expressions to be searched in phonefy mode | |
83 | #self.fieldsRegExp["phonefy"] = {} | |
84 | # Example of fields: | |
85 | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | |
86 | ||
87 | # Definition of regular expressions to be searched in usufy mode | |
88 | self.fieldsRegExp["usufy"] = {} | |
89 | # Example of fields: | |
90 | #self.fieldsRegExp["usufy"]["i3visio.location"] = "" | |
91 | # Definition of regular expressions to be searched in searchfy mode | |
92 | #self.fieldsRegExp["searchfy"] = {} | |
93 | # Example of fields: | |
94 | #self.fieldsRegExp["searchfy"]["i3visio.location"] = "" | |
95 | ||
96 | ################ | |
97 | # Fields found # | |
98 | ################ | |
99 | # This attribute will be feeded when running the program. | |
100 | self.foundFields = {} |
39 | 39 | "com.i3visio.Date.Create": '{"start": "<li class=\"about-stat joined-date\">", "end": "</li>"}', # Regular expresion to extract the alias |
40 | 40 | }, |
41 | 41 | "needs_credentials": False, |
42 | "not_found_text": "channel-empty-message banner-message", # Text that indicates a missing profile | |
42 | "not_found_text": "error-page", # Text that indicates a missing profile | |
43 | 43 | "query_validator": "[^@, ]+", # Regular expression that the alias SHOULD match |
44 | 44 | "url": "https://www.youtube.com/user/{placeholder}/about", # Target URL where {placeholder} would be modified by the alias |
45 | 45 | }, |
0 | 0 | Metadata-Version: 2.1 |
1 | 1 | Name: osrframework |
2 | Version: 0.20.1 | |
2 | Version: 0.20.2 | |
3 | 3 | Summary: OSRFramework - A set of AGPLv3+ OSINT tools developed by i3visio analysts for online research. |
4 | 4 | Home-page: http://github.com/i3visio/osrframework |
5 | 5 | Author: Felix Brezo and Yaiza Rubio |
6 | 6 | Author-email: [email protected] |
7 | 7 | License: COPYING |
8 | Description: OSRFramework | |
9 | ============ | |
10 | ||
11 | OSRFramework: Open Sources Research Framework | |
12 | ||
13 | Copyright (C) 2014-2020 F. Brezo and Y. Rubio, i3visio | |
14 | ||
15 | [![Version in PyPI](https://img.shields.io/pypi/v/osrframework.svg)]() | |
16 | [![License](https://img.shields.io/badge/license-GNU%20Affero%20General%20Public%20License%20Version%203%20or%20Later-blue.svg)]() | |
17 | ||
18 | 1 - Description | |
19 | --------------- | |
20 | ||
21 | OSRFramework is a GNU AGPLv3+ set of libraries developed by i3visio to perform Open Source Intelligence collection tasks. | |
22 | They include references to a bunch of different applications related to username checking, DNS lookups, information leaks research, deep web search, regular expressions extraction and many others. | |
23 | At the same time, by means of ad-hoc Maltego transforms, OSRFramework provides a way of making these queries graphically as well as several interfaces to interact with like OSRFConsole or a Web interface. | |
24 | ||
25 | 2 - License: GNU AGPLv3+ | |
26 | ------------------------ | |
27 | ||
28 | This is free software, and you are welcome to redistribute it under certain conditions. | |
29 | ||
30 | This program is free software: you can redistribute it and/or modify | |
31 | it under the terms of the GNU Affero General Public License as published by | |
32 | the Free Software Foundation, either version 3 of the License, or | |
33 | (at your option) any later version. | |
34 | ||
35 | This program is distributed in the hope that it will be useful, | |
36 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
37 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
38 | GNU Affero General Public License for more details. | |
39 | ||
40 | You should have received a copy of the GNU Affero General Public License | |
41 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
42 | ||
43 | ||
44 | For more details on this issue, check the [COPYING](COPYING) file. | |
45 | ||
46 | 3 - Installation | |
47 | ---------------- | |
48 | ||
49 | Fast way to do it on any system for a user with administration privileges: | |
50 | ``` | |
51 | pip3 install osrframework | |
52 | ``` | |
53 | You can upgrade to the latest release of the framework with: | |
54 | ``` | |
55 | pip3 install osrframework --upgrade | |
56 | ``` | |
57 | This will manage all the dependencies for you and install the latest version of the framework. | |
58 | ||
59 | If you needed further information on how to install OSRFramework on certain systems, note that you may need to add `export PATH=$PATH:$HOME/.local/bin` to your `~/.bashrc_profile`). This has been confirmed in some distributions, including MacOS. | |
60 | In any case, we recommend you yo have a look at the [INSTALL.md](doc/INSTALL.md) file where we provide additional details for these cases. | |
61 | ||
62 | 4 - Basic usage | |
63 | --------------- | |
64 | ||
65 | If everything went correctly (we hope so!), it's time for trying usufy., mailfy and so on. | |
66 | But we are they | |
67 | ? They are installed in your path meaning that you can open a terminal anywhere and typing the name of the program (seems to be an improvement from previous installations...). Examples: | |
68 | ``` | |
69 | osrf --help | |
70 | usufy -n i3visio febrezo yrubiosec -p twitter facebook | |
71 | searchfy -q "i3visio" | |
72 | mailfy -n i3visio | |
73 | ``` | |
74 | ||
75 | Type -h or --help to get more information about which are the parameters of each application. | |
76 | ||
77 | The tools installed in this package include: | |
78 | ||
79 | - `alais_generator`. Generates candidate nicknames based on known info about the target. **Input**: information about the target. **Output**: list of possible nicknames. | |
80 | - `checkfy`. Guesses possible emails based on a list of candidate nicknames and a pattern. **Input**: list of nicknames and an email pattern. **Output**. list of emails matching the pattern.. | |
81 | - `domainfy`. Finds domains that currently resolve using a given word or nickname. **Input**: liat of words. **Output**: domains using that word that currently resolve. | |
82 | - `mailfy`. Find more information about emails taken as a reference either a nickname (to generate a list of possible emails) or the email list. **Input**: list of nicknames or emails. **Output**: found information about the email. | |
83 | - `osrf`. Shared wrapper for the rest of the applications. All commands can also be used as `osrf usufy…`, `osrf mailfy…`, etc. | |
84 | - `phonefy`. Recovers information about mobile phones linked to known spam practices. **Inputs**: list of phones. **Outputs**: Phones linked to spam. | |
85 | - `searchfy`. Finds profiles linked to a fullname. **Inputs**: list of phones. **Outputs**: Known profiles linked to the query. | |
86 | - `usufy`. Identifies socialmedia profiles using a given nickname. **Inputs**: list of nicknames. **Outputs**: Known profiles in socialmedia using those nicknames. | |
87 | ||
88 | You can find the configuration files in a folder created in your user home to define the default behaviour of the applications: | |
89 | ``` | |
90 | # Configuration files for Linux and MacOS | |
91 | ~/.config/OSRFramework/ | |
92 | # Configuration files for Windows | |
93 | C:\Users\<User>\OSRFramework\ | |
94 | ``` | |
95 | ||
96 | OSRFramework will look for the configuration settings for each application stored there. | |
97 | You can add new credentials there and if something goes wrong, you can always restore the files stored in the `defaults` subfolder. | |
98 | ||
99 | If you are experiencing problems, you might fight relevant information in the (FAQ Section)[doc/FAQ.md]. | |
100 | ||
101 | 5 - HACKING | |
102 | ----------- | |
103 | ||
104 | If you want to extend the functionalities of OSRFramework and you do not know where to start from, check the [HACKING.md](doc/HACKING.md) file. | |
105 | ||
106 | 6 - AUTHORS | |
107 | ----------- | |
108 | ||
109 | More details about the authors in the [AUTHORS.md](AUTHORS.md) file. | |
110 | ||
8 | Description: UNKNOWN | |
111 | 9 | Keywords: python osint harvesting profiling username socialmedia forums |
112 | 10 | Platform: UNKNOWN |
113 | 11 | Classifier: Development Status :: 4 - Beta |
106 | 106 | osrframework/wrappers/bandcamp.py |
107 | 107 | osrframework/wrappers/bennugd.py |
108 | 108 | osrframework/wrappers/betblog.py |
109 | osrframework/wrappers/bitbacker.py | |
110 | 109 | osrframework/wrappers/bitbucket.py |
111 | 110 | osrframework/wrappers/bitcointalk.py |
112 | 111 | osrframework/wrappers/bitrated.py |
115 | 114 | osrframework/wrappers/blogspot.py |
116 | 115 | osrframework/wrappers/boonex.py |
117 | 116 | osrframework/wrappers/bubok.py |
118 | osrframework/wrappers/bucketlistly.py | |
119 | 117 | osrframework/wrappers/buddypic.py |
120 | 118 | osrframework/wrappers/burbuja.py |
121 | osrframework/wrappers/canva.py | |
122 | 119 | osrframework/wrappers/carbonmade.py |
123 | 120 | osrframework/wrappers/cartodb.py |
124 | 121 | osrframework/wrappers/causes.py |
129 | 126 | osrframework/wrappers/codecademy.py |
130 | 127 | osrframework/wrappers/codementor.py |
131 | 128 | osrframework/wrappers/coderwall.py |
132 | osrframework/wrappers/colourlovers.py | |
133 | 129 | osrframework/wrappers/connectingsingles.py |
134 | 130 | osrframework/wrappers/couchsurfing.py |
135 | 131 | osrframework/wrappers/crokes.py |
143 | 139 | osrframework/wrappers/disqus.py |
144 | 140 | osrframework/wrappers/doodle.py |
145 | 141 | osrframework/wrappers/douban.py |
146 | osrframework/wrappers/dreamstime.py | |
147 | 142 | osrframework/wrappers/dribbble.py |
148 | 143 | osrframework/wrappers/drupal.py |
149 | 144 | osrframework/wrappers/dzone.py |
170 | 165 | osrframework/wrappers/freerepublic.py |
171 | 166 | osrframework/wrappers/getsatisfaction.py |
172 | 167 | osrframework/wrappers/github.py |
168 | osrframework/wrappers/gnupgkeys.py | |
173 | 169 | osrframework/wrappers/goblinrefuge.py |
174 | 170 | osrframework/wrappers/goodreads.py |
175 | 171 | osrframework/wrappers/gravatar.py |
188 | 184 | osrframework/wrappers/jamiiforums.py |
189 | 185 | osrframework/wrappers/kali.py |
190 | 186 | osrframework/wrappers/kanogames.py |
191 | osrframework/wrappers/key_server.py | |
192 | 187 | osrframework/wrappers/keybase.py |
193 | 188 | osrframework/wrappers/kickstarter.py |
194 | 189 | osrframework/wrappers/kinja.py |
234 | 229 | osrframework/wrappers/periscope.py |
235 | 230 | osrframework/wrappers/phishtank.py |
236 | 231 | osrframework/wrappers/photobucket.py |
237 | osrframework/wrappers/pixinsight.py | |
238 | 232 | osrframework/wrappers/pixls.py |
239 | 233 | osrframework/wrappers/pjrc.py |
240 | 234 | osrframework/wrappers/pokerred.py |
249 | 243 | osrframework/wrappers/ripenear.py |
250 | 244 | osrframework/wrappers/rojadirecta.py |
251 | 245 | osrframework/wrappers/ruby.py |
252 | osrframework/wrappers/sarahah.py | |
253 | 246 | osrframework/wrappers/scribd.py |
254 | 247 | osrframework/wrappers/seatwish.py |
255 | 248 | osrframework/wrappers/sencha.py |
256 | osrframework/wrappers/sidereel.py | |
257 | 249 | osrframework/wrappers/singletrackworld.py |
258 | 250 | osrframework/wrappers/slashdot.py |
259 | 251 | osrframework/wrappers/slideshare.py |
260 | 252 | osrframework/wrappers/smartcitizen.py |
261 | 253 | osrframework/wrappers/smugmug.py |
262 | 254 | osrframework/wrappers/soundcloud.py |
263 | osrframework/wrappers/soup.py | |
264 | 255 | osrframework/wrappers/spaniards.py |
265 | 256 | osrframework/wrappers/spoj.py |
266 | 257 | osrframework/wrappers/spotify.py |
268 | 259 | osrframework/wrappers/steamcommunity.py |
269 | 260 | osrframework/wrappers/steemit.py |
270 | 261 | osrframework/wrappers/steinberg.py |
271 | osrframework/wrappers/taringa.py | |
272 | 262 | osrframework/wrappers/teamtreehouse.py |
273 | 263 | osrframework/wrappers/telegram.py |
274 | osrframework/wrappers/thesims.py | |
275 | 264 | osrframework/wrappers/thestudentroom.py |
276 | 265 | osrframework/wrappers/theverge.py |
277 | 266 | osrframework/wrappers/thiscrush.py |
281 | 270 | osrframework/wrappers/twoplustwo.py |
282 | 271 | osrframework/wrappers/typepad.py |
283 | 272 | osrframework/wrappers/unsplash.py |
284 | osrframework/wrappers/v7n.py | |
285 | 273 | osrframework/wrappers/venmo.py |
286 | 274 | osrframework/wrappers/verbling.py |
287 | 275 | osrframework/wrappers/vexforum.py |
49 | 49 | requirements = file.read().splitlines() |
50 | 50 | |
51 | 51 | # Depending on the place in which the project is going to be upgraded |
52 | def read(fname): | |
53 | return open(os.path.join(os.path.dirname(__file__), fname)).read() | |
52 | """def read(fname): | |
53 | return open(os.path.join(os.path.dirname(__file__), fname)).read()""" | |
54 | 54 | |
55 | 55 | # Creating the application paths |
56 | 56 | paths = configuration.get_config_path() |
104 | 104 | 'Topic :: Text Processing :: Markup :: HTML' |
105 | 105 | ], |
106 | 106 | packages=find_packages(), |
107 | long_description=read('README.md'), | |
107 | #long_description=read('README.md'), | |
108 | 108 | long_description_content_type="text/markdown", |
109 | 109 | install_requires=requirements, |
110 | 110 | ) |