forked from sundowndev/phoneinfoga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathovh.py
44 lines (35 loc) · 1.4 KB
/
ovh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
#
# @name : PhoneInfoga - Phone numbers OSINT tool
# @url : https://github.com/sundowndev
# @author : Raphael Cerveaux (sundowndev)
import requests
from lib.output import *
def scan(localNumber, numberCountry):
if not args.scanner == 'ovh' and not args.scanner == 'all':
return -1
test('Running OVH scan...')
querystring = {"country": numberCountry.lower()}
headers = {
'accept': "application/json",
'cache-control': "no-cache"
}
try:
response = requests.request(
"GET", "https://api.ovh.com/1.0/telephony/number/detailedZones", data="", headers=headers, params=querystring)
data = json.loads(response.content.decode('utf-8'))
except Exception as e:
error('OVH API is unreachable. Maybe retry later.')
return -1
if isinstance(data, list):
askedNumber = "0" + localNumber.replace(localNumber[-4:], 'xxxx')
for voip_number in data:
if voip_number['number'] == askedNumber:
plus(("1 result found in OVH database"))
plus(("Number range: {}".format(voip_number['number'])))
plus(("City: {}".format(voip_number['city'])))
plus(("Zip code: {}".format(
voip_number['zipCode'] if voip_number['zipCode'] is not None else ''
)))
askForExit()