Esempio n. 1
0
def search(req, stop):
    global googleAbuseToken

    if google_api_key and google_cx_id:
        return searchApi(req, stop)

    headers = {
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        'Accept-Language': 'en-us,en;q=0.5',
        'Accept-Encoding': 'gzip,deflate',
        'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
        'Keep-Alive': '115',
        'Connection': 'keep-alive',
        'Cache-Control': 'no-cache',
        'Cookie': 'Cookie: CGIC=Ij90ZXh0L2h0bWwsYXBwbGljYXRpb24veGh0bWwreG1sLGFwcGxpY2F0aW9uL3htbDtxPTAuOSwqLyo7cT0wLjg; CONSENT=YES+RE.fr+20150809-08-0; 1P_JAR=2018-11-28-14; NID=148=aSdSHJz71rufCokaUC93nH3H7lOb8E7BNezDWV-PyyiHTXqWK5Y5hsvj7IAzhZAK04-QNTXjYoLXVu_eiAJkiE46DlNn6JjjgCtY-7Fr0I4JaH-PZRb7WFgSTjiFqh0fw2cCWyN69DeP92dzMd572tQW2Z1gPwno3xuPrYC1T64wOud1DjZDhVAZkpk6UkBrU0PBcnLWL7YdL6IbEaCQlAI9BwaxoH_eywPVyS9V; SID=uAYeu3gT23GCz-ktdGInQuOSf-5SSzl3Plw11-CwsEYY0mqJLSiv7tFKeRpB_5iz8SH5lg.; HSID=AZmH_ctAfs0XbWOCJ; SSID=A0PcRJSylWIxJYTq_; APISID=HHB2bKfJ-2ZUL5-R/Ac0GK3qtM8EHkloNw; SAPISID=wQoxetHBpyo4pJKE/A2P6DUM9zGnStpIVt; SIDCC=ABtHo-EhFAa2AJrJIUgRGtRooWyVK0bAwiQ4UgDmKamfe88xOYBXM47FoL5oZaTxR3H-eOp7-rE; OTZ=4671861_52_52_123900_48_436380; OGPC=873035776-8:; OGP=-873035776:;'
    }

    try:
        REQ = urlencode({ 'q': req, 'num': stop })
        URL = 'https://www.google.com/search?tbs=li:1&{}&gws_rd=ssl&gl=us'.format(
            REQ)
        r = send('GET', URL + googleAbuseToken, headers=headers)

        while r.status_code != 200:
            warn('You are temporary blacklisted from Google search. Complete the captcha at the following URL and copy/paste the content of GOOGLE_ABUSE_EXEMPTION cookie : {}'.format(URL))
            info('Need help ? Read https://github.com/sundowndev/PhoneInfoga/wiki')
            token = ask('\nGOOGLE_ABUSE_EXEMPTION=')
            googleAbuseToken = '&google_abuse=' + token
            r = send('GET', URL + googleAbuseToken, headers=headers)

        soup = BeautifulSoup(r.text, 'html5lib')

        results = soup.find("div", id="search").find_all("div", class_="g")

        links = []

        for result in results:
            url = result.find("a").get('href')
            url = re.sub(r'(?:\/url\?q\=)', '', url)
            url = re.sub(r'(?:\/url\?url\=)', '', url)
            url = re.sub(r'(?:\&sa\=)(?:.*)', '', url)
            url = re.sub(r'(?:\&rct\=)(?:.*)', '', url)

            if re.match(r"^(?:\/search\?q\=)", url) is not None:
                url = 'https://google.com' + url

            if url is not None:
                links.append(url)

        return links
    except Exception as e:
        error('Request failed. Please retry or open an issue on https://github.com/sundowndev/PhoneInfoga.')
        print(e)
        return []
Esempio n. 2
0
def scan(number, proxy):

    #test('Running Numverify.com scan...')

    try:
        requestSecret = ''
        res = send('GET', 'https://numverify.com/', {}, proxy)
        soup = BeautifulSoup(res.text, "html5lib")
    except Exception as e:
        error('Numverify.com is not available')
        #error(e)
        return -2, {'valid': False}

    for tag in soup.find_all("input", type="hidden"):
        if tag['name'] == "scl_request_secret":
            requestSecret = tag['value']
            break

    apiKey = hashlib.md5((number + requestSecret).encode('utf-8')).hexdigest()

    headers = {
        'Host': 'numverify.com',
        'User-Agent':
        'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0',
        'Accept': 'application/json, text/javascript, */*; q=0.01',
        'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
        'Accept-Encoding': 'gzip, deflate, br',
        'Referer': 'https://numverify.com/',
        'X-Requested-With': 'XMLHttpRequest',
        'DNT': '1',
        'Connection': 'keep-alive',
        'Pragma': 'no-cache',
        'Cache-Control': 'no-cache'
    }

    try:
        res = send(
            "GET",
            "https://numverify.com/php_helper_scripts/phone_api.php?secret_key={}&number={}"
            .format(apiKey, number), headers, proxy)
        data = json.loads(res.content.decode('utf-8'))
    except Exception as e:
        #error('Numverify.com is not available')
        return -2, {'valid': False}

    if res.content == "Unauthorized" or res.status_code != 200:
        #error(("An error occured while calling the API (bad request or wrong api key)."))
        return -2, {'valid': False}

    if 'error' in data:
        #error('Numverify.com is not available: ' + data['error'])
        return -2, {'valid': False}

    return 0, data
Esempio n. 3
0
def osintDisposableNumScan():
    global numberObj
    global number

    info('---- Temporary number providers footprints ----')

    try:
        info("Searching for phone number on tempophone.com...")
        response = send("GET", "https://tempophone.com/api/v1/phones")
        data = json.loads(response.content.decode('utf-8'))
        for voip_number in data['objects']:
            if voip_number['phone'] == formatNumber(number):
                plus("Found a temporary number provider: tempophone.com")
                askForExit()
    except Exception as e:
        error("Unable to reach tempophone.com API. Skipping.")

    dorks = json.load(open('osint/disposable_num_providers.json'))

    for dork in dorks:
        dorkRequest = replaceVariables(dork['request'], numberObj)

        info("Searching for footprints on {}...".format(dork['site']))

        for result in search(dorkRequest, stop=dork['stop']):
            plus("Result found: {}".format(dork['site']))
            plus("URL: " + result)
            askForExit()
Esempio n. 4
0
def searchApi(req, stop):
    options = urlencode({
        'q': req,
        'key': google_api_key,
        'cx': google_cx_id,
        'num': stop
    })
    r = send('GET',
             'https://www.googleapis.com/customsearch/v1?%s' % (options))
    response = r.json()

    if 'error' in response:
        error('Error while fetching Google search API.')
        print(response['error'])
        askForExit()
        return []

    if 'items' not in response:
        return []

    results = response['items']

    links = []

    for result in results:
        if result['link'] is not None:
            links.append(result['link'])

    return links
Esempio n. 5
0
def searchApi(req, stop):
    options = urlencode({'q': req, 'key': google_api_key, 'cx': google_cx_id})
    r = send('GET',
             'https://www.googleapis.com/customsearch/v1?%s' % (options))
    response = r.json()

    if 'error' in response:
        error(
            'Error while fetching Google search API. Maybe usage limit ? Please verify your keys.'
        )
        return []

    if 'items' not in response:
        return []

    results = response['items']

    links = []
    counter = 0

    for result in results:
        counter += 1

        if int(counter) > int(stop):
            break

        if result['link'] is not None:
            links.append(result['link'])

    return links
Esempio n. 6
0
def searchApi(req, stop):
    options = urlencode({
        "q": req,
        "key": google_api_key,
        "cx": google_cx_id,
        "num": stop
    })
    r = send("GET",
             "https://www.googleapis.com/customsearch/v1?%s" % (options))
    response = r.json()

    if "error" in response:
        error(
            "Error while fetching Google search API. Maybe usage limit ? Please verify your keys."
        )
        print(response["error"])
        askForExit()
        return []

    if "items" not in response:
        return []

    results = response["items"]

    links = []

    for result in results:
        if result["link"] is not None:
            links.append(result["link"])

    return links
Esempio n. 7
0
def scan(number):
    if not args.scanner == 'numverify' and not args.scanner == 'all':
        return -1

    test('Running Numverify.com scan...')

    try:
        requestSecret = ''
        res = send('GET', 'https://numverify.com/')
        soup = BeautifulSoup(res.text, "html5lib")
    except Exception as e:
        error('Numverify.com is not available')
        error(e)
        return -1

    for tag in soup.find_all("input", type="hidden"):
        if tag['name'] == "scl_request_secret":
            requestSecret = tag['value']
            break

    apiKey = hashlib.md5((number + requestSecret).encode('utf-8')).hexdigest()

    headers = {
        'Host': 'numverify.com',
        'User-Agent':
        'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0',
        'Accept': 'application/json, text/javascript, */*; q=0.01',
        'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
        'Accept-Encoding': 'gzip, deflate, br',
        'Referer': 'https://numverify.com/',
        'X-Requested-With': 'XMLHttpRequest',
        'DNT': '1',
        'Connection': 'keep-alive',
        'Pragma': 'no-cache',
        'Cache-Control': 'no-cache'
    }

    try:
        res = send(
            "GET",
            "https://numverify.com/php_helper_scripts/phone_api.php?secret_key={}&number={}"
            .format(apiKey, number),
            headers=headers)

        data = json.loads(res.content.decode('utf-8'))
    except Exception as e:
        error('Numverify.com is not available')
        return -1

    if res.content == "Unauthorized" or res.status_code != 200:
        error((
            "An error occured while calling the API (bad request or wrong api key)."
        ))
        return -1

    if 'error' in data:
        error('Numverify.com is not available: ' + data['error'])
        return -1

    if data['valid'] == False:
        error(
            ("Error: Please specify a valid phone number. Example: +6464806649"
             ))
        sys.exit()

    InternationalNumber = '({}){}'.format(data["country_prefix"],
                                          data["local_format"])

    plus(("Number: ({}) {}").format(data["country_prefix"],
                                    data["local_format"]))
    plus(("Country: {} ({})").format(data["country_name"],
                                     data["country_code"]))
    plus(("Location: {}").format(data["location"]))
    plus(("Carrier: {}").format(data["carrier"]))
    plus(("Line type: {}").format(data["line_type"]))

    if data["line_type"] == 'landline':
        warn((
            "This is most likely a landline, but it can still be a fixed VoIP number."
        ))
    elif data["line_type"] == 'mobile':
        warn((
            "This is most likely a mobile number, but it can still be a VoIP number."
        ))
Esempio n. 8
0
def scan(number):
    if not args.scanner == "numverify" and not args.scanner == "all":
        return -1

    test("Running Numverify.com scan...")

    try:
        requestSecret = ""
        res = send("GET", "https://numverify.com/")
        soup = BeautifulSoup(res.text, "html5lib")
    except Exception as e:
        error("Numverify.com is not available")
        error(e)
        return -1

    for tag in soup.find_all("input", type="hidden"):
        if tag["name"] == "scl_request_secret":
            requestSecret = tag["value"]
            break

    apiKey = hashlib.md5((number + requestSecret).encode("utf-8")).hexdigest()

    headers = {
        "Host": "numverify.com",
        "User-Agent":
        "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0",
        "Accept": "application/json, text/javascript, */*; q=0.01",
        "Accept-Language": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3",
        "Accept-Encoding": "gzip, deflate, br",
        "Referer": "https://numverify.com/",
        "X-Requested-With": "XMLHttpRequest",
        "DNT": "1",
        "Connection": "keep-alive",
        "Pragma": "no-cache",
        "Cache-Control": "no-cache",
    }

    try:
        res = send(
            "GET",
            "https://numverify.com/php_helper_scripts/phone_api.php?secret_key={}&number={}"
            .format(apiKey, number),
            headers=headers,
        )

        data = json.loads(res.content.decode("utf-8"))
    except Exception as e:
        error("Numverify.com is not available")
        return -1

    if res.content == "Unauthorized" or res.status_code != 200:
        error((
            "An error occured while calling the API (bad request or wrong api key)."
        ))
        return -1

    if "error" in data:
        error("Numverify.com is not available: " + data["error"])
        return -1

    if data["valid"] == False:
        error(
            ("Error: Please specify a valid phone number. Example: +6464806649"
             ))
        sys.exit()

    InternationalNumber = "({}){}".format(data["country_prefix"],
                                          data["local_format"])

    plus(("Number: ({}) {}").format(data["country_prefix"],
                                    data["local_format"]))
    plus(("Country: {} ({})").format(data["country_name"],
                                     data["country_code"]))
    plus(("Location: {}").format(data["location"]))
    plus(("Carrier: {}").format(data["carrier"]))
    plus(("Line type: {}").format(data["line_type"]))

    if data["line_type"] == "landline":
        warn((
            "This is most likely a landline, but it can still be a fixed VoIP number."
        ))
    elif data["line_type"] == "mobile":
        warn((
            "This is most likely a mobile number, but it can still be a VoIP number."
        ))