Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exception handling to request in subscribe method. #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions CallStranger.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@ def subscribe(URL,callbackURL):
'NT': 'upnp:event',
'TIMEOUT': 'Second-300'}
#print(URL,callbackURL,'sending')
req = requests.request('SUBSCRIBE', URL,headers=myheaders)
if req.status_code==200:
print(colored('Subscribe to '+URL+' seems successfull','green'))
print(req.headers)
print(req.text)
else:
print(colored('Subscribe to '+URL+' failed with status code:'+str(req.status_code),'red'))
print(req.headers)
print(req.text)
try:
req = requests.request('SUBSCRIBE', URL,headers=myheaders)
if req.status_code==200:
print(colored('Subscribe to '+URL+' seems successfull','green'))
print(req.headers)
print(req.text)
else:
print(colored('Subscribe to '+URL+' failed with status code:'+str(req.status_code),'red'))
print(req.headers)
print(req.text)
except:
print(colored('Failed to send the request to [' + URL + '] with callback to ['+ callbackURL +']'))



Expand All @@ -66,7 +69,7 @@ def confirmvulnerableservices(path,key):
print(colored('Successfully get services from server: '+path,'green'))
print('')
print('Encrypted vulnerable services:')
print(vulnerableservices);
print(vulnerableservices)
print('')
print('Decyripting vulnerable services with key:' , key)
f = Fernet(key)
Expand Down