bootstrap_iNmapInfo
This commit is contained in:
parent
4e44a559e7
commit
048caad578
@ -82,3 +82,6 @@ Others include:
|
|||||||
|
|
||||||
To our point of view, the ability of CTYPEs to follow code in the
|
To our point of view, the ability of CTYPEs to follow code in the
|
||||||
debugger is crucial.
|
debugger is crucial.
|
||||||
|
|
||||||
|
Work on this project is suspended until the
|
||||||
|
[MultiDevice](https://git.plastiras.org/emdee/tox_profile/wiki/MultiDevice-Announcements-POC) problem is solved. Fork me!
|
||||||
|
@ -4,6 +4,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import re
|
import re
|
||||||
|
import traceback
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
import shutil
|
||||||
import json
|
import json
|
||||||
@ -62,7 +63,8 @@ else:
|
|||||||
# self._audio_thread.isAlive
|
# self._audio_thread.isAlive
|
||||||
iTHREAD_TIMEOUT = 1
|
iTHREAD_TIMEOUT = 1
|
||||||
iTHREAD_SLEEP = 1
|
iTHREAD_SLEEP = 1
|
||||||
iTHREAD_JOINS = 5
|
iTHREAD_JOINS = 8
|
||||||
|
iNODES=6
|
||||||
|
|
||||||
lToxSamplerates = [8000, 12000, 16000, 24000, 48000]
|
lToxSamplerates = [8000, 12000, 16000, 24000, 48000]
|
||||||
lToxSampleratesK = [8, 12, 16, 24, 48]
|
lToxSampleratesK = [8, 12, 16, 24, 48]
|
||||||
@ -70,6 +72,7 @@ lBOOLEANS = [
|
|||||||
'local_discovery_enabled',
|
'local_discovery_enabled',
|
||||||
'udp_enabled',
|
'udp_enabled',
|
||||||
'ipv6_enabled',
|
'ipv6_enabled',
|
||||||
|
'trace_enabled',
|
||||||
'compact_mode',
|
'compact_mode',
|
||||||
'allow_inline',
|
'allow_inline',
|
||||||
'notifications',
|
'notifications',
|
||||||
@ -511,6 +514,41 @@ def bootstrap_tcp(lelts, lToxes):
|
|||||||
else:
|
else:
|
||||||
LOG.debug('bootstrap_tcp to ' +largs[0] +' not connected')
|
LOG.debug('bootstrap_tcp to ' +largs[0] +' not connected')
|
||||||
|
|
||||||
|
def bootstrap_iNmapInfo(lElts, oArgs, bIS_LOCAL=False, iNODES=iNODES):
|
||||||
|
if not bIS_LOCAL and not bAreWeConnected():
|
||||||
|
LOG.warn(f"bootstrap_iNmapInfo not local and NOT CONNECTED")
|
||||||
|
return True
|
||||||
|
env = dict()
|
||||||
|
if oArgs.proxy_type == 2:
|
||||||
|
protocol='socks'
|
||||||
|
elif oArgs.proxy_type == 1:
|
||||||
|
protocol='https'
|
||||||
|
else:
|
||||||
|
protocol='ipv4'
|
||||||
|
env = os.environ
|
||||||
|
lRetval = []
|
||||||
|
for elts in lElts[:iNODES]:
|
||||||
|
if elts[0] in lDEAD_BS: continue
|
||||||
|
iRet = -1
|
||||||
|
try:
|
||||||
|
iRet = iNmapInfo(protocol, *elts)
|
||||||
|
if iRet != 0:
|
||||||
|
LOG.warn('iNmapInfo to ' +repr(elts[0]) +' retval=' +str(iRet))
|
||||||
|
lRetval += [False]
|
||||||
|
else:
|
||||||
|
LOG.info(f'bootstrap_iNmapInfo '
|
||||||
|
+f" net={oArgs.network}"
|
||||||
|
+f" prot={protocol}"
|
||||||
|
+f" proxy={oArgs.proxy_type}"
|
||||||
|
+f' {elts[:2]!r}'
|
||||||
|
)
|
||||||
|
lRetval += [True]
|
||||||
|
except Exception as e:
|
||||||
|
LOG.error('iNmapInfo to ' +repr(elts[0]) +' : ' +str(e) \
|
||||||
|
+'\n' + traceback.format_exc())
|
||||||
|
lRetval += [False]
|
||||||
|
return any(lRetval)
|
||||||
|
|
||||||
def setup_logging(oArgs):
|
def setup_logging(oArgs):
|
||||||
global LOG
|
global LOG
|
||||||
if coloredlogs:
|
if coloredlogs:
|
||||||
|
@ -81,7 +81,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
bIS_NOT_TOXYGEN = True
|
bIS_NOT_TOXYGEN = True
|
||||||
|
|
||||||
iNODES=8
|
|
||||||
# from PyQt5 import QtCore
|
# from PyQt5 import QtCore
|
||||||
if 'QtCore' in globals():
|
if 'QtCore' in globals():
|
||||||
def qt_sleep(fSec):
|
def qt_sleep(fSec):
|
||||||
@ -140,41 +139,6 @@ def iNmapInfo(sProt, sHost, sPort, key=None, environ=None, bTest=False):
|
|||||||
LOG.debug(f"iNmapInfo: {s}")
|
LOG.debug(f"iNmapInfo: {s}")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def bootstrap_iNmapInfo(lElts):
|
|
||||||
if not bIS_LOCAL and not ts.bAreWeConnected():
|
|
||||||
LOG.warn(f"bootstrap_iNmapInfo not local and NOT CONNECTED")
|
|
||||||
return True
|
|
||||||
env = dict()
|
|
||||||
if oTOX_OARGS.proxy_type == 2:
|
|
||||||
protocol='socks'
|
|
||||||
elif oTOX_OARGS.proxy_type == 1:
|
|
||||||
protocol='https'
|
|
||||||
else:
|
|
||||||
protocol='ipv4'
|
|
||||||
env = os.environ
|
|
||||||
lRetval = []
|
|
||||||
for elts in lElts[:iNODES]:
|
|
||||||
if elts[0] in ts.lDEAD_BS: continue
|
|
||||||
iRet = -1
|
|
||||||
try:
|
|
||||||
iRet = iNmapInfo(protocol, *elts)
|
|
||||||
if iRet != 0:
|
|
||||||
LOG.warn('iNmapInfo to ' +repr(elts[0]) +' retval=' +str(iRet))
|
|
||||||
lRetval += [False]
|
|
||||||
else:
|
|
||||||
LOG.info(f'bootstrap_iNmapInfo '
|
|
||||||
+f" net={oTOX_OARGS.network}"
|
|
||||||
+f" prot={protocol}"
|
|
||||||
+f" proxy={oTOX_OARGS.proxy_type}"
|
|
||||||
+f' {elts[:2]!r}'
|
|
||||||
)
|
|
||||||
lRetval += [True]
|
|
||||||
except Exception as e:
|
|
||||||
LOG.error('iNmapInfo to ' +repr(elts[0]) +' : ' +str(e) \
|
|
||||||
+'\n' + traceback.format_exc())
|
|
||||||
lRetval += [False]
|
|
||||||
return any(lRetval)
|
|
||||||
|
|
||||||
class ToxOptions():
|
class ToxOptions():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ipv6_enabled = True
|
self.ipv6_enabled = True
|
||||||
@ -816,7 +780,7 @@ class ToxSuite(unittest.TestCase):
|
|||||||
lRetval = []
|
lRetval = []
|
||||||
random.shuffle(lElts)
|
random.shuffle(lElts)
|
||||||
# assert
|
# assert
|
||||||
bootstrap_iNmapInfo(lElts)
|
ts.bootstrap_iNmapInfo(lElts, oTOX_OARGS, bIS_LOCAL, iNODES=8)
|
||||||
|
|
||||||
def test_self_get_secret_key(self): # works
|
def test_self_get_secret_key(self): # works
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user