Last active
October 14, 2018 22:37
-
-
Save BigNerd95/6a5a91eef641265eabd1dd84485e590d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Credenziali voip TIM + Proxy IP | |
import sys | |
import random | |
import json | |
try: | |
import requests | |
except ImportError: | |
print("ERRORE: Il modulo \"requests\" deve essere installato. Eseguire -> pip install requests") | |
raise SystemExit(0) | |
try: | |
import dns | |
import dns.resolver | |
except ImportError: | |
print("ERRORE: Il modulo \"dnspython\" deve essere installato. Eseguire -> pip install dnspython") | |
def getTargetFromSRV(name): | |
try: | |
srv_ans = dns.resolver.query(name,'SRV') | |
except (dns.resolver.NXDOMAIN,dns.resolver.NoAnswer) as err: | |
raise SystemExit('Errore risoluzione record SRV per {0}'.format(name)) | |
for a in srv_ans: | |
#print ("SRV record: {0} priotita' {1}".format(a.target.to_text(),a.priority)) | |
try: | |
a_ans = dns.resolver.query(a.target.to_text(),'A') | |
except (dns.resolver.NXDOMAIN,dns.resolver.NoAnswer) as err: | |
raise SystemExit('Errore risoluzione record A per {0}'.format(a.target.to_text())) | |
for a1 in a_ans: | |
print("Indirizzo proxy priorita' {1} : {0}".format(a1.to_text(),a.priority)) | |
if len(sys.argv) != 4: | |
raise SystemExit('Uso: {0} lineavoip celulare nomedispositivo'.format(sys.argv[0])) | |
tel = sys.argv[1] | |
cell = sys.argv[2] | |
devicename = sys.argv[3] | |
uid = random.getrandbits(16) | |
regmanurl1 = "https://regman-telefono.interbusiness.it:10800/AppTelefono/AnyModem/wsTIphoneProvisioning/v1/otpProvisioningSessions?CLI=%2B39{0}&DeviceId={1}&Mobile=%2B39{2}".format(tel,uid,cell) | |
regmanurl2 = "https://regman-telefono.interbusiness.it:10800/AppTelefono/AnyModem/wsTIphoneProvisioning/v1/associations" | |
dns.resolver.default_resolver = dns.resolver.Resolver(configure=False) | |
dns.resolver.default_resolver.nameservers = ['85.37.17.60', '85.38.28.122'] | |
headers = {'Content-Type':'application/json', 'Accept':'application/json','charset':'utf-8','Authorization':'Basic aDloa003NXltWTVGamtRWjpCczd5RC1tdS1ObmR3QyErNU0zOWRZIW5IUmJFS2pocw==',\ | |
'User-Agent':'Dalvik/2.1.0 (Linux; U; Android 5.0.2; P10 Build/LRX22G)',\ | |
'Connection':'Keep-Alive','Accept-Encoding':'identity'} | |
r = requests.get(regmanurl1, headers=headers) | |
resp = r.json() | |
otp = input("Inserisci OTP ricevuta via sms: ") | |
payload = \ | |
{\ | |
"CLI": "{0}".format(resp['CLI']),\ | |
"DeviceId": "{0}".format(uid),\ | |
"DeviceName": "{0}".format(devicename),\ | |
"Mobile": "+39{0}".format(cell),\ | |
"NotificationId": "android:ctHDua{0}:BPA91bEvIgToivB52yRJ8_ati5sP5DSE4j2SnjUYG1dHRSetM0G6jqd{0}FmhlP3zq7QlVAnYluf2yqbh-6lHPFWuzzq4BoqjgE4A-VnRo3xWmmFIrJYal5Hd3jyLRWCpTwh7TzW1_".format(uid),\ | |
"OTP": "{0}".format(otp),\ | |
"SessionOTP": "{0}".format(resp['SessionOTP']),\ | |
"TGU": "{0}".format(resp['TGU'])\ | |
} | |
r = requests.post(regmanurl2, headers=headers, json=payload) | |
resp = r.json() | |
if resp['ResultCode'] == '100': | |
voipcreds=resp['ManagementObject'] | |
print("\n ====== CREDENZIALI VOIP ========== \n") | |
for k, v in voipcreds.items(): | |
print(k, v) | |
print("\n ====== INDIRIZZI DEI PROXY ========== \n") | |
getTargetFromSRV("_sip._udp."+voipcreds['P-CSCF_Address']) | |
else: | |
print("Numero utenti totali raggiunti!") | |
print("Accedi con l'app TIM Telefono all'area Amministrazione Linea e rimuovi almeno un account.") | |
#End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment