improve PROXY, other changes
This commit is contained in:
		
							parent
							
								
									e128e10dcc
								
							
						
					
					
						commit
						9980d65f57
					
				
							
								
								
									
										
											BIN
										
									
								
								HBnetv1.png
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								HBnetv1.png
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 63 KiB  | 
							
								
								
									
										16
									
								
								bridge.py
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								bridge.py
									
									
									
									
									
								
							@ -141,17 +141,17 @@ def download_config(L_CONFIG_FILE, cli_file):
 | 
				
			|||||||
##        print((iterate_config['test']))
 | 
					##        print((iterate_config['test']))
 | 
				
			||||||
##        print(corrected_config)
 | 
					##        print(corrected_config)
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        corrected_config['GLOBAL']['TG1_ACL'] = config.acl_build(corrected_config['GLOBAL']['TG1_ACL'], 16776415)
 | 
					        corrected_config['GLOBAL']['TG1_ACL'] = config.acl_build(corrected_config['GLOBAL']['TG1_ACL'], 4294967295)
 | 
				
			||||||
        corrected_config['GLOBAL']['TG2_ACL'] = config.acl_build(corrected_config['GLOBAL']['TG2_ACL'], 16776415)
 | 
					        corrected_config['GLOBAL']['TG2_ACL'] = config.acl_build(corrected_config['GLOBAL']['TG2_ACL'], 4294967295)
 | 
				
			||||||
        corrected_config['GLOBAL']['REG_ACL'] = config.acl_build(corrected_config['GLOBAL']['REG_ACL'], 16776415)
 | 
					        corrected_config['GLOBAL']['REG_ACL'] = config.acl_build(corrected_config['GLOBAL']['REG_ACL'], 4294967295)
 | 
				
			||||||
        corrected_config['GLOBAL']['SUB_ACL'] = config.acl_build(corrected_config['GLOBAL']['SUB_ACL'], 16776415)
 | 
					        corrected_config['GLOBAL']['SUB_ACL'] = config.acl_build(corrected_config['GLOBAL']['SUB_ACL'], 4294967295)
 | 
				
			||||||
##        corrected_config['SYSTEMS'] = {}
 | 
					##        corrected_config['SYSTEMS'] = {}
 | 
				
			||||||
        for i in iterate_config:
 | 
					        for i in iterate_config:
 | 
				
			||||||
##            print(i)
 | 
					##            print(i)
 | 
				
			||||||
##            corrected_config['SYSTEMS'][i] = {}
 | 
					##            corrected_config['SYSTEMS'][i] = {}
 | 
				
			||||||
            if iterate_config[i]['MODE'] == 'MASTER' or iterate_config[i]['MODE'] == 'PROXY':
 | 
					            if iterate_config[i]['MODE'] == 'MASTER' or iterate_config[i]['MODE'] == 'PROXY':
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['TG1_ACL'] = config.acl_build(iterate_config[i]['TG1_ACL'], 16776415)
 | 
					                corrected_config['SYSTEMS'][i]['TG1_ACL'] = config.acl_build(iterate_config[i]['TG1_ACL'], 4294967295)
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['TG2_ACL'] = config.acl_build(iterate_config[i]['TG2_ACL'], 16776415)
 | 
					                corrected_config['SYSTEMS'][i]['TG2_ACL'] = config.acl_build(iterate_config[i]['TG2_ACL'], 4294967295)
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['PASSPHRASE'] = bytes(iterate_config[i]['PASSPHRASE'], 'utf-8')
 | 
					                corrected_config['SYSTEMS'][i]['PASSPHRASE'] = bytes(iterate_config[i]['PASSPHRASE'], 'utf-8')
 | 
				
			||||||
                if iterate_config[i]['MODE'] == 'OPENBRIDGE':
 | 
					                if iterate_config[i]['MODE'] == 'OPENBRIDGE':
 | 
				
			||||||
                    corrected_config['SYSTEMS'][i]['NETWORK_ID'] = int(iterate_config[i]['NETWORK_ID']).to_bytes(4, 'big')
 | 
					                    corrected_config['SYSTEMS'][i]['NETWORK_ID'] = int(iterate_config[i]['NETWORK_ID']).to_bytes(4, 'big')
 | 
				
			||||||
@ -159,8 +159,8 @@ def download_config(L_CONFIG_FILE, cli_file):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if iterate_config[i]['MODE'] == 'PEER' or iterate_config[i]['MODE'] == 'XLXPEER':
 | 
					            if iterate_config[i]['MODE'] == 'PEER' or iterate_config[i]['MODE'] == 'XLXPEER':
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['RADIO_ID'] = int(iterate_config[i]['RADIO_ID']).to_bytes(4, 'big')
 | 
					                corrected_config['SYSTEMS'][i]['RADIO_ID'] = int(iterate_config[i]['RADIO_ID']).to_bytes(4, 'big')
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['TG1_ACL'] = config.acl_build(iterate_config[i]['TG1_ACL'], 16776415)
 | 
					                corrected_config['SYSTEMS'][i]['TG1_ACL'] = config.acl_build(iterate_config[i]['TG1_ACL'], 4294967295)
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['TG2_ACL'] = config.acl_build(iterate_config[i]['TG2_ACL'], 16776415)
 | 
					                corrected_config['SYSTEMS'][i]['TG2_ACL'] = config.acl_build(iterate_config[i]['TG2_ACL'], 4294967295)
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['MASTER_SOCKADDR'] = tuple(iterate_config[i]['MASTER_SOCKADDR'])
 | 
					                corrected_config['SYSTEMS'][i]['MASTER_SOCKADDR'] = tuple(iterate_config[i]['MASTER_SOCKADDR'])
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['SOCK_ADDR'] = tuple(iterate_config[i]['SOCK_ADDR'])
 | 
					                corrected_config['SYSTEMS'][i]['SOCK_ADDR'] = tuple(iterate_config[i]['SOCK_ADDR'])
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['PASSPHRASE'] = bytes((iterate_config[i]['PASSPHRASE']), 'utf-8')
 | 
					                corrected_config['SYSTEMS'][i]['PASSPHRASE'] = bytes((iterate_config[i]['PASSPHRASE']), 'utf-8')
 | 
				
			||||||
 | 
				
			|||||||
@ -258,7 +258,7 @@ class HBSYSTEM(DatagramProtocol):
 | 
				
			|||||||
        #Change this to a config value
 | 
					        #Change this to a config value
 | 
				
			||||||
        user_man_url = self._CONFIG['USER_MANAGER']['URL']
 | 
					        user_man_url = self._CONFIG['USER_MANAGER']['URL']
 | 
				
			||||||
        shared_secret = str(sha256(self._CONFIG['USER_MANAGER']['SHARED_SECRET'].encode()).hexdigest())
 | 
					        shared_secret = str(sha256(self._CONFIG['USER_MANAGER']['SHARED_SECRET'].encode()).hexdigest())
 | 
				
			||||||
        #print(int(str(int_id(_id))[:7]))
 | 
					##        print(int(str(int_id(_id))[:7]))
 | 
				
			||||||
        auth_check = {
 | 
					        auth_check = {
 | 
				
			||||||
        'secret':shared_secret,
 | 
					        'secret':shared_secret,
 | 
				
			||||||
        'login_id':int(str(int_id(_id))[:7]),
 | 
					        'login_id':int(str(int_id(_id))[:7]),
 | 
				
			||||||
@ -269,6 +269,7 @@ class HBSYSTEM(DatagramProtocol):
 | 
				
			|||||||
        try:
 | 
					        try:
 | 
				
			||||||
            req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
 | 
					            req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
 | 
				
			||||||
            resp = json.loads(req.text)
 | 
					            resp = json.loads(req.text)
 | 
				
			||||||
 | 
					##            print(resp)
 | 
				
			||||||
            return resp
 | 
					            return resp
 | 
				
			||||||
        except requests.ConnectionError:
 | 
					        except requests.ConnectionError:
 | 
				
			||||||
            return {'allow':True}
 | 
					            return {'allow':True}
 | 
				
			||||||
@ -517,6 +518,7 @@ class HBSYSTEM(DatagramProtocol):
 | 
				
			|||||||
                # Check for valid Radio ID
 | 
					                # Check for valid Radio ID
 | 
				
			||||||
                #print(self.check_user_man(_peer_id))
 | 
					                #print(self.check_user_man(_peer_id))
 | 
				
			||||||
                if self._config['USE_USER_MAN'] == True:
 | 
					                if self._config['USE_USER_MAN'] == True:
 | 
				
			||||||
 | 
					##                    print(str(_peer_id) + ' - hblink.py')
 | 
				
			||||||
                    self.ums_response = self.check_user_man(_peer_id, self._CONFIG['USER_MANAGER']['THIS_SERVER_NAME'], _sockaddr[0])
 | 
					                    self.ums_response = self.check_user_man(_peer_id, self._CONFIG['USER_MANAGER']['THIS_SERVER_NAME'], _sockaddr[0])
 | 
				
			||||||
##                    print(self.ums_response)
 | 
					##                    print(self.ums_response)
 | 
				
			||||||
                    #Will allow anyone to attempt authentication, used for a transition period
 | 
					                    #Will allow anyone to attempt authentication, used for a transition period
 | 
				
			||||||
 | 
				
			|||||||
@ -66,21 +66,30 @@ class Proxy(DatagramProtocol):
 | 
				
			|||||||
        #If the packet comes from the master
 | 
					        #If the packet comes from the master
 | 
				
			||||||
        if host == self.master:
 | 
					        if host == self.master:
 | 
				
			||||||
            _command = data[:4]
 | 
					            _command = data[:4]
 | 
				
			||||||
 | 
					            _lng_command = data[:6]
 | 
				
			||||||
 | 
					####            print(_lng_command)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            if _command == DMRD:
 | 
					            if _command == DMRD:
 | 
				
			||||||
                _peer_id = data[11:15]
 | 
					                _peer_id = data[11:15]
 | 
				
			||||||
 | 
					##                print(self.peerTrack[_peer_id]['timer'])
 | 
				
			||||||
            elif  _command == RPTA:
 | 
					            elif  _command == RPTA:
 | 
				
			||||||
                    if data[6:10] in self.peerTrack:
 | 
					                    if data[6:10] in self.peerTrack:
 | 
				
			||||||
                        _peer_id = data[6:10]
 | 
					                        _peer_id = data[6:10]
 | 
				
			||||||
                    else:
 | 
					                    else:
 | 
				
			||||||
                        _peer_id = self.connTrack[port]
 | 
					                        _peer_id = self.connTrack[port]
 | 
				
			||||||
            elif _command == MSTN:
 | 
					            elif _lng_command == MSTNAK:
 | 
				
			||||||
                _peer_id = data[6:10]
 | 
					                _peer_id = data[6:10]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            elif _command == MSTN and MSTNAK not in _lng_command:
 | 
				
			||||||
 | 
					                    _peer_id = data[6:10]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    self.peerTrack[_peer_id]['timer'].cancel()
 | 
					                    self.peerTrack[_peer_id]['timer'].cancel()
 | 
				
			||||||
                    self.reaper(_peer_id)
 | 
					                    self.reaper(_peer_id)
 | 
				
			||||||
                    return
 | 
					                    return
 | 
				
			||||||
            elif _command == MSTP:
 | 
					            elif _command == MSTP:
 | 
				
			||||||
                    _peer_id = data[7:11]
 | 
					                    _peer_id = data[7:11]
 | 
				
			||||||
 | 
					##                    print(self.peerTrack)
 | 
				
			||||||
            elif _command == MSTC:
 | 
					            elif _command == MSTC:
 | 
				
			||||||
                    _peer_id = data[5:9]
 | 
					                    _peer_id = data[5:9]
 | 
				
			||||||
                    self.peerTrack[_peer_id]['timer'].cancel()
 | 
					                    self.peerTrack[_peer_id]['timer'].cancel()
 | 
				
			||||||
@ -150,6 +159,7 @@ class Proxy(DatagramProtocol):
 | 
				
			|||||||
                self.transport.write(data, (self.master,_dport))
 | 
					                self.transport.write(data, (self.master,_dport))
 | 
				
			||||||
                if self.debug:
 | 
					                if self.debug:
 | 
				
			||||||
                    print(data)
 | 
					                    print(data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return
 | 
					                return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -461,10 +461,10 @@ def create_app():
 | 
				
			|||||||
        _new_peer_id = bytes_4(int(str(dmr_id)[:7]))
 | 
					        _new_peer_id = bytes_4(int(str(dmr_id)[:7]))
 | 
				
			||||||
        trimmed_id = int(str(dmr_id)[:7])
 | 
					        trimmed_id = int(str(dmr_id)[:7])
 | 
				
			||||||
        b_list = get_burnlist()
 | 
					        b_list = get_burnlist()
 | 
				
			||||||
        print(b_list)
 | 
					        # print(b_list)
 | 
				
			||||||
        burned = False
 | 
					        burned = False
 | 
				
			||||||
        for ui in b_list.items():
 | 
					        for ui in b_list.items():
 | 
				
			||||||
            print(ui)
 | 
					            # print(ui)
 | 
				
			||||||
            #print(b_list)
 | 
					            #print(b_list)
 | 
				
			||||||
            if ui[0] == trimmed_id:
 | 
					            if ui[0] == trimmed_id:
 | 
				
			||||||
                if ui[0] != 0:
 | 
					                if ui[0] != 0:
 | 
				
			||||||
@ -1719,6 +1719,7 @@ def create_app():
 | 
				
			|||||||
            p = mmdvmPeer.query.filter_by(server=_server).filter_by(name=_name).first()
 | 
					            p = mmdvmPeer.query.filter_by(server=_server).filter_by(name=_name).first()
 | 
				
			||||||
        if _mode == 'xlx':
 | 
					        if _mode == 'xlx':
 | 
				
			||||||
            p = xlxPeer.query.filter_by(server=_server).filter_by(name=_name).first()
 | 
					            p = xlxPeer.query.filter_by(server=_server).filter_by(name=_name).first()
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        db.session.delete(p)
 | 
					        db.session.delete(p)
 | 
				
			||||||
        db.session.commit()
 | 
					        db.session.commit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1901,16 +1902,16 @@ def create_app():
 | 
				
			|||||||
        print(s_config['REPORTS'])
 | 
					        print(s_config['REPORTS'])
 | 
				
			||||||
        return s_config
 | 
					        return s_config
 | 
				
			||||||
    def masters_get(_name):
 | 
					    def masters_get(_name):
 | 
				
			||||||
##        print(_name)
 | 
					##        # print(_name)
 | 
				
			||||||
        #s = ServerList.query.filter_by(name=_name).first()
 | 
					        #s = ServerList.query.filter_by(name=_name).first()
 | 
				
			||||||
       # print(s.name)        
 | 
					       # print(s.name)        
 | 
				
			||||||
        i = MasterList.query.filter_by(server=_name).filter_by(active=True).all()
 | 
					        i = MasterList.query.filter_by(server=_name).filter_by(active=True).all()
 | 
				
			||||||
        o = OBP.query.filter_by(server=_name).filter_by(enabled=True).all()
 | 
					        o = OBP.query.filter_by(server=_name).filter_by(enabled=True).all()
 | 
				
			||||||
        p = ProxyList.query.filter_by(server=_name).filter_by(active=True).all()
 | 
					        p = ProxyList.query.filter_by(server=_name).filter_by(active=True).all()
 | 
				
			||||||
        print('get masters')
 | 
					        # print('get masters')
 | 
				
			||||||
        master_config_list = {}
 | 
					        master_config_list = {}
 | 
				
			||||||
##        master_config_list['SYSTEMS'] = {}
 | 
					##        master_config_list['SYSTEMS'] = {}
 | 
				
			||||||
        print(i)
 | 
					        # print(i)
 | 
				
			||||||
        for m in i:
 | 
					        for m in i:
 | 
				
			||||||
            print (m.name)
 | 
					            print (m.name)
 | 
				
			||||||
            master_config_list.update({m.name: {
 | 
					            master_config_list.update({m.name: {
 | 
				
			||||||
@ -1970,7 +1971,7 @@ def create_app():
 | 
				
			|||||||
                    }})
 | 
					                    }})
 | 
				
			||||||
            master_config_list[pr.name].update({'PEERS': {}})
 | 
					            master_config_list[pr.name].update({'PEERS': {}})
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
        print(master_config_list)
 | 
					        # print(master_config_list)
 | 
				
			||||||
        return master_config_list
 | 
					        return master_config_list
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def add_system_rule(_bridge_name, _system_name, _ts, _tg, _active, _timeout, _to_type, _on, _off, _reset, _server, _public_list):
 | 
					    def add_system_rule(_bridge_name, _system_name, _ts, _tg, _active, _timeout, _to_type, _on, _off, _reset, _server, _public_list):
 | 
				
			||||||
@ -2013,7 +2014,7 @@ def create_app():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def server_edit(_name, _secret, _ip, _public_list, _port, _global_path, _global_ping_time, _global_max_missed, _global_use_acl, _global_reg_acl, _global_sub_acl, _global_tg1_acl, _global_tg2_acl, _ai_subscriber_file, _ai_try_download, _ai_path, _ai_peer_file, _ai_tgid_file, _ai_peer_url, _ai_subs_url, _ai_stale, _um_shorten_passphrase, _um_burn_file, _report_enable, _report_interval, _report_port, _report_clients, _unit_time, _notes):
 | 
					    def server_edit(_name, _secret, _ip, _public_list, _port, _global_path, _global_ping_time, _global_max_missed, _global_use_acl, _global_reg_acl, _global_sub_acl, _global_tg1_acl, _global_tg2_acl, _ai_subscriber_file, _ai_try_download, _ai_path, _ai_peer_file, _ai_tgid_file, _ai_peer_url, _ai_subs_url, _ai_stale, _um_shorten_passphrase, _um_burn_file, _report_enable, _report_interval, _report_port, _report_clients, _unit_time, _notes):
 | 
				
			||||||
        s = ServerList.query.filter_by(name=_name).first()
 | 
					        s = ServerList.query.filter_by(name=_name).first()
 | 
				
			||||||
        print(_name)
 | 
					        # print(_name)
 | 
				
			||||||
        if _secret == '':
 | 
					        if _secret == '':
 | 
				
			||||||
            s.secret = s.secret
 | 
					            s.secret = s.secret
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
@ -2088,7 +2089,7 @@ def create_app():
 | 
				
			|||||||
            m.notes = _notes
 | 
					            m.notes = _notes
 | 
				
			||||||
            db.session.commit()
 | 
					            db.session.commit()
 | 
				
			||||||
        if _mode == 'OBP':
 | 
					        if _mode == 'OBP':
 | 
				
			||||||
            print(_enable_unit)
 | 
					            # print(_enable_unit)
 | 
				
			||||||
##            print(enable_unit)
 | 
					##            print(enable_unit)
 | 
				
			||||||
            o = OBP.query.filter_by(server=_server).filter_by(name=_name).first()
 | 
					            o = OBP.query.filter_by(server=_server).filter_by(name=_name).first()
 | 
				
			||||||
            o.enabled = _active
 | 
					            o.enabled = _active
 | 
				
			||||||
@ -2153,7 +2154,7 @@ def create_app():
 | 
				
			|||||||
##            db.session.add(add_master)
 | 
					##            db.session.add(add_master)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def add_master(_mode, _name, _server, _static_positions, _repeat, _active, _max_peers, _ip, _port, _enable_um, _passphrase, _group_hang_time, _use_acl, _reg_acl, _sub_acl, _tg1_acl, _tg2_acl, _enable_unit, _notes, _external_proxy, _int_start_port, _int_stop_port, _network_id, _target_ip, _target_port, _both_slots):
 | 
					    def add_master(_mode, _name, _server, _static_positions, _repeat, _active, _max_peers, _ip, _port, _enable_um, _passphrase, _group_hang_time, _use_acl, _reg_acl, _sub_acl, _tg1_acl, _tg2_acl, _enable_unit, _notes, _external_proxy, _int_start_port, _int_stop_port, _network_id, _target_ip, _target_port, _both_slots):
 | 
				
			||||||
        print(_mode)
 | 
					        # print(_mode)
 | 
				
			||||||
        if _mode == 'MASTER':
 | 
					        if _mode == 'MASTER':
 | 
				
			||||||
            add_master = MasterList(
 | 
					            add_master = MasterList(
 | 
				
			||||||
                name = _name,
 | 
					                name = _name,
 | 
				
			||||||
@ -2202,8 +2203,8 @@ def create_app():
 | 
				
			|||||||
            db.session.add(add_proxy)
 | 
					            db.session.add(add_proxy)
 | 
				
			||||||
            db.session.commit()
 | 
					            db.session.commit()
 | 
				
			||||||
        if _mode == 'OBP':
 | 
					        if _mode == 'OBP':
 | 
				
			||||||
                print(_name)
 | 
					                # print(_name)
 | 
				
			||||||
                print(_network_id)
 | 
					                # print(_network_id)
 | 
				
			||||||
                add_OBP = OBP(
 | 
					                add_OBP = OBP(
 | 
				
			||||||
                    name = _name,
 | 
					                    name = _name,
 | 
				
			||||||
                    enabled = _active,
 | 
					                    enabled = _active,
 | 
				
			||||||
@ -2380,7 +2381,7 @@ def create_app():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
##            s = mmdvmPeer.query.filter_by(server=_server).filter_by(name=_name).first()
 | 
					##            s = mmdvmPeer.query.filter_by(server=_server).filter_by(name=_name).first()
 | 
				
			||||||
            p = xlxPeer.query.filter_by(server=_server).filter_by(name=_name).first()
 | 
					            p = xlxPeer.query.filter_by(server=_server).filter_by(name=_name).first()
 | 
				
			||||||
            print(type(p.enable_unit))
 | 
					            # print(type(p.enable_unit))
 | 
				
			||||||
            p.enabled = _enabled
 | 
					            p.enabled = _enabled
 | 
				
			||||||
            p.loose = _loose
 | 
					            p.loose = _loose
 | 
				
			||||||
            p.ip = _ip
 | 
					            p.ip = _ip
 | 
				
			||||||
@ -3318,7 +3319,7 @@ def create_app():
 | 
				
			|||||||
            all_s = ServerList.query.all()
 | 
					            all_s = ServerList.query.all()
 | 
				
			||||||
            p_list = ''
 | 
					            p_list = ''
 | 
				
			||||||
            for s in all_s:
 | 
					            for s in all_s:
 | 
				
			||||||
                print(s.name)
 | 
					                # print(s.name)
 | 
				
			||||||
                p_list = p_list + '''
 | 
					                p_list = p_list + '''
 | 
				
			||||||
<h4 style="text-align: center;">Server: ''' + str(s.name) + '''</h4>
 | 
					<h4 style="text-align: center;">Server: ''' + str(s.name) + '''</h4>
 | 
				
			||||||
<table style="width: 400px; margin-left: auto; margin-right: auto;" border="1">
 | 
					<table style="width: 400px; margin-left: auto; margin-right: auto;" border="1">
 | 
				
			||||||
@ -3573,8 +3574,8 @@ def create_app():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
'''
 | 
					'''
 | 
				
			||||||
        elif request.args.get('edit_proxy'):
 | 
					        elif request.args.get('edit_proxy'):
 | 
				
			||||||
            print(request.args.get('server'))
 | 
					            # print(request.args.get('server'))
 | 
				
			||||||
            print(request.args.get('edit_proxy'))
 | 
					            # print(request.args.get('edit_proxy'))
 | 
				
			||||||
            p = ProxyList.query.filter_by(server=request.args.get('server')).filter_by(name=request.args.get('edit_proxy')).first()
 | 
					            p = ProxyList.query.filter_by(server=request.args.get('server')).filter_by(name=request.args.get('edit_proxy')).first()
 | 
				
			||||||
            content = '''
 | 
					            content = '''
 | 
				
			||||||
<p> </p>
 | 
					<p> </p>
 | 
				
			||||||
@ -4307,8 +4308,8 @@ def create_app():
 | 
				
			|||||||
            elif request.args.get('save_rule') == 'edit':
 | 
					            elif request.args.get('save_rule') == 'edit':
 | 
				
			||||||
                content = 'edit rule'
 | 
					                content = 'edit rule'
 | 
				
			||||||
            elif request.args.get('save_rule') == 'delete':
 | 
					            elif request.args.get('save_rule') == 'delete':
 | 
				
			||||||
                print(request.args.get('bridge'))
 | 
					                # print(request.args.get('bridge'))
 | 
				
			||||||
                print(request.args.get('server'))
 | 
					                # print(request.args.get('server'))
 | 
				
			||||||
                if request.args.get('system'):
 | 
					                if request.args.get('system'):
 | 
				
			||||||
                    delete_system_rule(request.args.get('bridge'), request.args.get('server'), request.args.get('system'))
 | 
					                    delete_system_rule(request.args.get('bridge'), request.args.get('server'), request.args.get('system'))
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
@ -4578,7 +4579,7 @@ def create_app():
 | 
				
			|||||||
'''
 | 
					'''
 | 
				
			||||||
            r_list = ''
 | 
					            r_list = ''
 | 
				
			||||||
            for i in s:
 | 
					            for i in s:
 | 
				
			||||||
                print(i)
 | 
					                # print(i)
 | 
				
			||||||
                r_list = r_list + '''
 | 
					                r_list = r_list + '''
 | 
				
			||||||
<table style="width: 500px; margin-left: auto; margin-right: auto;" border="1">
 | 
					<table style="width: 500px; margin-left: auto; margin-right: auto;" border="1">
 | 
				
			||||||
  <tbody>
 | 
					  <tbody>
 | 
				
			||||||
@ -4616,7 +4617,7 @@ def create_app():
 | 
				
			|||||||
    @app.route('/svr', methods=['POST'])
 | 
					    @app.route('/svr', methods=['POST'])
 | 
				
			||||||
    def auth():
 | 
					    def auth():
 | 
				
			||||||
        hblink_req = request.json
 | 
					        hblink_req = request.json
 | 
				
			||||||
        print((hblink_req))
 | 
					        # print((hblink_req))
 | 
				
			||||||
        if hblink_req['secret'] in shared_secrets():
 | 
					        if hblink_req['secret'] in shared_secrets():
 | 
				
			||||||
            if 'login_id' in hblink_req and 'login_confirmed' not in hblink_req:
 | 
					            if 'login_id' in hblink_req and 'login_confirmed' not in hblink_req:
 | 
				
			||||||
                if type(hblink_req['login_id']) == int:
 | 
					                if type(hblink_req['login_id']) == int:
 | 
				
			||||||
@ -4635,14 +4636,14 @@ def create_app():
 | 
				
			|||||||
                                    )
 | 
					                                    )
 | 
				
			||||||
                        elif authorized_peer(hblink_req['login_id'])[1] != '' or isinstance(authorized_peer(hblink_req['login_id'])[1], int) == False:
 | 
					                        elif authorized_peer(hblink_req['login_id'])[1] != '' or isinstance(authorized_peer(hblink_req['login_id'])[1], int) == False:
 | 
				
			||||||
                            authlog_add(hblink_req['login_id'], hblink_req['login_ip'], hblink_req['login_server'], authorized_peer(hblink_req['login_id'])[2], authorized_peer(hblink_req['login_id'])[1], 'Attempt')
 | 
					                            authlog_add(hblink_req['login_id'], hblink_req['login_ip'], hblink_req['login_server'], authorized_peer(hblink_req['login_id'])[2], authorized_peer(hblink_req['login_id'])[1], 'Attempt')
 | 
				
			||||||
                            print(authorized_peer(hblink_req['login_id']))
 | 
					                            # print(authorized_peer(hblink_req['login_id']))
 | 
				
			||||||
                            response = jsonify(
 | 
					                            response = jsonify(
 | 
				
			||||||
                                    allow=True,
 | 
					                                    allow=True,
 | 
				
			||||||
                                    mode='override',
 | 
					                                    mode='override',
 | 
				
			||||||
                                    value=authorized_peer(hblink_req['login_id'])[1]
 | 
					                                    value=authorized_peer(hblink_req['login_id'])[1]
 | 
				
			||||||
                                        )
 | 
					                                        )
 | 
				
			||||||
                    elif authorized_peer(hblink_req['login_id'])[0] == False:
 | 
					                    elif authorized_peer(hblink_req['login_id'])[0] == False:
 | 
				
			||||||
                        print('log fail')
 | 
					##                        print('log fail')
 | 
				
			||||||
                        authlog_add(hblink_req['login_id'], hblink_req['login_ip'], hblink_req['login_server'], 'Not Registered', '-', 'Failed')
 | 
					                        authlog_add(hblink_req['login_id'], hblink_req['login_ip'], hblink_req['login_server'], 'Not Registered', '-', 'Failed')
 | 
				
			||||||
                        response = jsonify(
 | 
					                        response = jsonify(
 | 
				
			||||||
                                    allow=False)
 | 
					                                    allow=False)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user