Skip to content

Commit

Permalink
reportBugToAuthor updated to help open bug report
Browse files Browse the repository at this point in the history
removed function of sending email with bug report
  • Loading branch information
sandrogauci committed Jan 15, 2022
1 parent 8922831 commit db051d8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 59 deletions.
44 changes: 12 additions & 32 deletions sipvicious/libs/svhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import re
import sys
import traceback
import uuid
import os
import dbm
Expand All @@ -34,9 +35,7 @@
import optparse
import logging
from random import getrandbits
from urllib.request import urlopen
from urllib.error import URLError
from urllib.parse import urlencode
from urllib.parse import quote
from binascii import Error as b2aerr
from .pptable import to_string
from binascii import b2a_hex, a2b_hex, hexlify
Expand Down Expand Up @@ -580,36 +579,17 @@ def makeRequest(method, fromaddr, toaddr, dsthost, port, callid, srchost='', bra
return(r)


def reportBugToAuthor(trace):
log = logging.getLogger('reportBugToAuthor')
data = str()
data += "Command line parameters:\r\n"
data += str(sys.argv)
data += '\r\n'
data += 'version: %s' % __version__
data += '\r\n'
data += 'email: <%s>' % input("Your email address (optional): ")
data += '\r\n'
data += 'msg: %s' % input("Extra details (optional): ")
data += '\r\n'
data += "python version: \r\n"
data += "%s\r\n" % sys.version
data += "osname: %s" % os.name
data += '\r\n'
def reportBugToAuthor(err):
print('Make sure you are running the latest version of SIPVicious by running "git pull" in the current directory and then python setup.py install')
print('Please visit the following URL to open a bug report: https://github.com/EnableSecurity/sipvicious/issues/new?assignees=&labels=bug&template=bug-report.md&title='+ quote("SIPVicious "+__version__+" crashing on "+ err.__str__()))
print('Include the following information:')
print('CLI params:', ' '.join(sys.argv))
print('Python version:', sys.version)
print('OS:', os.name)
if os.name == 'posix':
data += "uname: %s" % str(os.uname())
data += '\r\n'
data += '\r\n\r\n'
data += "Trace:\r\n"
data += str(trace)
try:
urlopen('https://comms.enablesecurity.com/hello.php',
urlencode({'message': data}).encode('utf-8'))
log.warn('Thanks for the bug report! We will be working on it soon')
except URLError as err:
log.error(err)
log.warn('Make sure you are running the latest version of SIPVicious \
by running "git pull" in the current directory')
print('uname:', os.uname())
print('Full trace:')
print(traceback.format_exc())


def scanlist(iprange, portranges, methods):
Expand Down
12 changes: 3 additions & 9 deletions sipvicious/svcrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import time
import os
import pickle
import traceback
from datetime import datetime
from urllib.parse import urlparse
from sipvicious.libs.pptable import to_string
Expand Down Expand Up @@ -588,14 +587,9 @@ def main():
logging.warning('caught your control^c - quiting')

except Exception as err:
if options.reportBack:
logging.critical(
"Got unhandled exception : %s\nsending report to author" % err.__str__())
reportBugToAuthor(traceback.format_exc())
else:
logging.critical(
"Unhandled exception - please run same command with the -R option to send me an automated report")
pass
logging.critical(
"Got unhandled exception : %s", err.__str__())
reportBugToAuthor(err)
logging.exception("Exception")
__exitcode__ = resolveexitcode(20, __exitcode__)

Expand Down
10 changes: 2 additions & 8 deletions sipvicious/svmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import random
import select
import socket
import traceback
from struct import pack
from sys import exit
from datetime import datetime
Expand Down Expand Up @@ -529,7 +528,6 @@ def main():
)
start_time = datetime.now()
logging.info("start your engines")

try:
sipvicious.start()
if exportpath is not None:
Expand All @@ -539,12 +537,8 @@ def main():
logging.warning( 'caught your control^c - quiting' )

except Exception as err:
if options.reportBack:
logging.critical( "Got unhandled exception : sending report to author" )
reportBugToAuthor(traceback.format_exc())
else:
logging.critical( "Unhandled exception - please run same command with the -R option to send me an automated report")
pass
logging.critical( "Got unhandled exception" )
reportBugToAuthor(err)
logging.exception("Exception")
__exitcode__ = resolveexitcode(20, __exitcode__)

Expand Down
13 changes: 3 additions & 10 deletions sipvicious/svwar.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import time
import dbm
import os
import traceback
from datetime import datetime
from urllib.parse import urlparse
from sipvicious.libs.pptable import to_string
Expand Down Expand Up @@ -695,15 +694,9 @@ def main():
logging.warning('caught your control^c - quiting')

except Exception as err:
if options.reportBack:
logging.critical(
"Got unhandled exception : %s\nSending report to author" % err.__str__())
reportBugToAuthor(traceback.format_exc())
else:
logging.critical(
"Unhandled exception - please run same command with the -R option to send me an automated report")
pass
logging.exception("Exception")
logging.critical(
"Got unhandled exception : %s", err.__str__())
reportBugToAuthor(err)
if options.save is not None and sipvicious.nextuser is not None:
lastextensiondst = os.path.join(exportpath, 'lastextension.pkl')
logging.debug('saving state to %s' % lastextensiondst)
Expand Down

0 comments on commit db051d8

Please sign in to comment.