示例#1
0
    def change_access(self, user=None, passwrd=None):
        """change_access - change password for telnet and ftp access"""
        if (user is None) or (passwrd is None):
            print('WifiManager:: username and password must be specified')
            return

        server = Server()  # from network
        # disable the server
        server.deinit()
        # enable the server again with new credentials
        # for ftp and telnet, not USB
        server.init(login=(user, passwrd), timeout=600)
        print_debug('WifiManager::password {} is changed...'.format(user))
示例#2
0
 def __init__(self):
     from network import Server
     import socket
     server = Server()
     self.is_telnet_running = server.isrunning()
     server.deinit()
     self.poll = select.poll()
     listening = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     listening.bind(('', 23))
     listening.listen(1)
     self.socket = listening.accept()[0]
     listening.close()
     self.poll.register(self.socket, select.POLLIN)
     self.socket.setblocking(False)
     self.write = self.socket.write
示例#3
0
 def __init__(self):
     from network import Server
     import socket
     server = Server()
     self.is_telnet_running = server.isrunning()
     server.deinit()
     self.poll = select.poll()
     listening = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     listening.bind(('', 23))
     listening.listen(1)
     self.socket = listening.accept()[0]
     listening.close()
     self.poll.register(self.socket, select.POLLIN)
     self.socket.setblocking(False)
     self.write = self.socket.write
示例#4
0
    def change_access(self, user=None, passwrd=None):
        """change_access - change password for telnet and ftp access"""
        if (user == None) or (passwrd == None):
            print('WifiManager:: username and password must be specified')
            return

        server = Server()  # from network
        # disable the server
        server.deinit()

        # enable the server again with new credentials
        # for example: remote access, ftp and telnet, not USB
        server.init(login=(user, passwrd), timeout=600)
        if USE_DEBUG:
            print('WifiManager::password is changed...')
示例#5
0
文件: coda_boot.py 项目: kasi09/pyCom
                coda_common.CODA_CONFIG["lastssid"] = SSID
                coda_common.CODA_CONFIG["lastappwd"] = PWD
                coda_common.coda_save_config()
                break
            else:
                pass
        else:
            pass

if wlan.isconnected():
    coda_common.led_g()
    update_ap_list(SSID, PWD)

    print("ip:", wlan.ifconfig()[0])
    server = Server()
    server.deinit()
    server.init(login=(coda_common.CODA_CONFIG["server_userid"],
                       coda_common.CODA_CONFIG["server_pwd"]),
                timeout=60)

    time.sleep(1)
    coda_common.led_off()

    AP_LIST = None
    SCAN_LIST = None
    gc.collect()

    if coda_common.CODA_CONFIG[
            "enable_app_main"] and coda_common.CODA_CONFIG["app_main"] > "":
        execfile(coda_common.CODA_CONFIG["app_main"])
else:
示例#6
0
from lib.logging.handlers import RotatingFileHandler

import pycom
from network import Server
from state_machine import *
from helpers import *

import machine
import lib.logging as logging

# setup the garbage collector
garbage_collector_setup()

# disable the FTP Server
server = Server()
server.deinit()  # disable the server
# disable the wifi on boot
pycom.wifi_on_boot(False)

# allocate extra buffer for emergency exception
micropython.alloc_emergency_exception_buf(128)

# create a logging for the system and store the information in a file
FMT = "{\'t\':\'%(asctime)s\'," \
      "\'l\':\'%(levelname)s\'," \
      "\'m\':\'%(message)s\'}"
#       "\'n\':\'%(name)s\'," \
fileHandler = RotatingFileHandler(filename=logging.FILENAME,
                                  maxBytes=16384,
                                  backupCount=4)
fileHandler.setFormatter(logging.Formatter(fmt=FMT))
示例#7
0
from network import WLAN
from network import Server
from machine import WDT
import pycom
import micropython
import time

micropython.alloc_emergency_exception_buf(100)
pycom.heartbeat(False)
pycom.rgbled(0xff0000)
print('=== Exo Sense Py - LoRaWAN - v1.4.0 ===')

wdt = WDT(timeout=30000)

wlan = WLAN()
wlan.deinit()

ftp = Server()
ftp.deinit()

time.sleep(1)