<commit_before>################################################################################
#
#    Copyright 2015-2020 <NAME> and <NAME>
#
#    This program is part of OSRFramework. You can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

__author__ = "<NAME>, <NAME> <<EMAIL>>"
__version__ = "2.0"


from osrframework.utils.platforms import Platform


class Listaspam(Platform):
    """A <Platform> object for Listaspam"""
    def __init__(self):
        self.platformName = "Listaspam"
        self.tags = ["phone"]

        ########################
        # Defining valid modes #
        ########################
        self.isValidMode = {}
        self.isValidMode["phonefy"] = True
        self.isValidMode["usufy"] = False
        self.isValidMode["searchfy"] = False

        ######################################
        # Search URL for the different modes #
        ######################################
        self.url = {}
        self.url["phonefy"] = "http://www.listaspam.com/busca.php?Telefono=<phonefy>"
        #self.url["usufy"] = "http://anyurl.com/user/" + "<phonefy>"
        #self.url["searchfy"] = "http://anyurl.com/search/" + "<phonefy>"

        ######################################
        # Whether the user needs credentials #
        ######################################
        self.needsCredentials = {}
        self.needsCredentials["phonefy"] = False
        self.needsCredentials["usufy"] = False
        self.needsCredentials["searchfy"] = False

        #################
        # Valid queries #
        #################
        # Strings that will imply that the query number is not appearing
        self.validQuery = {}
        # The regular expression '.+' will match any query.
        self.validQuery["phonefy"] = ".+"
        self.validQuery["usufy"] = ".+"
        self.validQuery["searchfy"] = ".+"

        ###################
        # Not_found clues #
        ###################
        # Strings that will imply that the phone number is not appearing
        self.notFoundText = {}
        self.notFoundText["phonefy"] = [
            "No te quedes sin saber quien te llama por teléfono."
        ]
        #self.notFoundText["usufy"] = []
        #self.notFoundText["searchfy"] = []

        #########################
        # Fields to be searched #
        #########################
        self.fieldsRegExp = {}
        # Definition of regular expressions to be searched in phonefy mode
        self.fieldsRegExp["phonefy"] = {}
        self.fieldsRegExp["phonefy"]["i3visio.location.province"] = "<strong class='located_label'>(.*),"
        self.fieldsRegExp["phonefy"]["i3visio.location.country"] = "class='country_located' alt='([a-zA-Zñ]*)'"
        self.fieldsRegExp["phonefy"]["i3visio.text"] = '<h4 class="media-heading">(.*)</p>'

        # Definition of regular expressions to be searched in usufy mode
        #self.fieldsRegExp["usufy"] = {}
        # Example of fields:
        #self.fieldsRegExp["usufy"]["i3visio.location"] = ""

        # Definition of regular expressions to be searched in searchfy mode
        #self.fieldsRegExp["searchfy"] = {}
        # Example of fields:
        #self.fieldsRegExp["searchfy"]["i3visio.location"] = ""

        ################
        # Fields found #
        ################
        # This attribute will be feeded when running the program.
        self.foundFields = {}<commit_msg>Fix #351: Update phonefy wrapper for Listaspam<commit_after>################################################################################
#
#    Copyright 2015-2020 <NAME> and <NAME>
#
#    This program is part of OSRFramework. You can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

__author__ = "<NAME>, <NAME> <<EMAIL>>"
__version__ = "3.0"


from osrframework.utils.platforms import Platform


class Listaspam(Platform):
    """A <Platform> object for Listaspam"""
    def __init__(self):
        self.platformName = "Listaspam"
        self.tags = ["phone"]

        self.modes = {
            "phonefy": {
                "debug": False,
                "extra_fields": {
                    "com.i3visio.Location": "<div>📍([^<]+)</div>",
                    "com.i3visio.Labels": 'Nube de tags: (.+)</div>'
                },
                "needs_credentials": False,
                "not_found_text": "No te quedes sin saber quién te llama por teléfono.",                   # Text that indicates a missing profile
                "query_validator": "[0-9+\-\.]{6-16}",                            # Regular expression that the alias SHOULD match
                "url": "http://www.listaspam.com/busca.php?Telefono={placeholder}",       # Target URL where {placeholder} would be modified by the alias
            }
        }
{'fraction_non_alphanumeric': 0.21339665902391092, 'fraction_numerical': 0.006223386832623649, 'mean_word_length': 2.762784966112138, 'pattern_counts': {'":': 9, '<': 29, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '954062', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1563, 'n_words': 477}