def input_accesspoint(): global config config['accesspoint'] = socket.select_access_point() config['accesspoint_name'] = [ ap['name'] for ap in socket.access_points() if ap['iapid'] == config['accesspoint'] ][0]
def connect(self): if self.error_retry > 3: self.apn = socket.select_access_point() try: del self.netbios del self.addrs del self.remote except: pass self.netbios = nmb.NetBIOS(apn=self.apn) self.dprint(5) addrs = self.netbios.gethostbyname(self.dest_name) self.dprint(6) self.remote = smb.SMB(self.dest_name, addrs[0].get_ip()) if self.remote.is_login_required(): if not self.username: self.username = self.get_text( 'Enter Username:'******'Username is required').encode('utf-8') if not self.password: self.password = self.get_pass( 'Enter Password:'******'Password is required').encode('utf-8') self.remote.login(self.username, self.password) self.config.add_host(self.dest_name, self.username, self.password) self.config.write_config() self.dprint(7)
def set_accesspoint(): global _SETTINGS_ACCESPOINT apid = socket.select_access_point() if appuifw.query(u"Set as default access point", "query") == True: set_setting(_SETTINGS_ACCESPOINT, repr(apid)) apo = socket.access_point(apid) socket.set_default_access_point(apo)
def _acionaModalidade(self, tamanho): #importando as bibliotecas sys.path.append(PATHLIB) import logica self._logica = logica.Logica(tamanho) if (self.modalidade == COMPUTER): import jogador self.computador = jogador.Inteligencia() elif (self.modalidade == IMPOSSIBLE): import jogador self.computador = jogador.Inteligencia(IMPOSSIBLE, self._logica.tabuleiro()) self.modalidade = COMPUTER elif (self.modalidade == REMOTE): INTERNET = 0 BLUETOOTH = 1 import aserver if (self.conexao == INTERNET): ap_id = socket.select_access_point() apo = socket.access_point(ap_id) apo.start() ip = apo.ip() self.servidor = aserver.Servidor(ip) appuifw.query(u"Mostre o IP ao seu amigo: " + str (ip), 'info') elif (self.conexao == BLUETOOTH): self.servidor = aserver.BTSender() self.servidor.conectar(self._logica.tabuleiro())
def ap(): #print "set default access- point" #print config["ap"] ap_id = socket.select_access_point() apo = socket.access_point(ap_id) socket.set_default_access_point(apo) config["ap"] = ap_id save_config()
def set_accesspoint(self): apid = socket.select_access_point() if appuifw.query(u"Set as default access point","query") == True: appuifw.note(u"Saved default access point ", "info") config = self.get_config() config['apid'] = apid self.save_config(config) apo = socket.access_point(apid) socket.set_default_access_point(apo)
def sel_access_point(a_id=0): # Select temporary default access point if a_id: apid = a_id else: apid = socket.select_access_point() print "Selected AP: %d" % (apid) # zero is not a valid AP number return apid
def set_accesspoint(): apid = socket.select_access_point() if appuifw.query(u"Set as default access point", "query") == True: f = open('e:\\apid.txt', 'w') f.write(repr(apid)) f.close() appuifw.note(u"Saved default access point ", "info") apo = socket.access_point(apid) socket.set_default_access_point(apo)
def __init__(self, servport = NETBIOS_NS_PORT, apn=None): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) if not apn: apn = socket.select_access_point() e32.ao_yield() if not apn: raise NetBIOSError, 'Please select a AP' ap = socket.access_point(apn) socket.set_default_access_point(ap) ap.start()
def start(self): try: self.apid = socket.select_access_point() self.ap = socket.access_point(self.apid) socket.set_default_access_point(self.ap) id = appuifw.query(u'DOUGA-ID', 'text') if not id: self.exit() download(unicode(id).encode('utf-8')) except Exception, e: traceback.print_exc()
def set_ap(self): from socket import access_points, access_point, select_access_point, set_default_access_point apid = [k for k in self.aps if k['name'] == u'WAP over GPRS'] if apid: #找的默认的接入点 self.apid = apid[0] self.ap = access_point(self.apid['iapid']) self.setting[6] = unicode(self.aps.index(self.apid)) set_default_access_point(self.ap) else: #没找到就选一个 self.apid_i = select_access_point() self.apid = [k for k in self.aps if k['iapid'] == self.apid_i][0] self.ap = access_point(self.apid['iapid']) self.setting[6] = unicode(self.aps.index(self.apid)) set_default_access_point(self.ap)
def __init__(self, inet_mode): self.server_host = "http://test.talking-points.org" self.inet_mode = inet_mode self.mac_tpid_mapping = {'00194fa4e262': 33, '000272c008cb': 31, '0010c65e9224': 34} if self.inet_mode == "online": ap_id = socket.select_access_point() apo = socket.access_point(ap_id) socket.set_default_access_point(apo) # make sure path exists if e32.in_emulator(): self.dir = u"c:\\python\\tp_offline" else: self.dir = u"e:\\python\\tp_offline" if not os.path.exists(self.dir): os.makedirs(self.dir)
def start(self): if self._access_point_started: return if not self._default_access_point: confirm = appuifw.query(u"This operation requires data transfer. Confirm?", 'query') if not confirm: return apid = socket.select_access_point() # pylint: disable-msg=E1101 if not apid: return self._default_access_point = socket.access_point(apid) # pylint: disable-msg=E1101 socket.set_default_access_point(self._default_access_point) # pylint: disable-msg=E1101 self._default_access_point.start() self._access_point_started = True
def __init__(self, netbios_hostname=None): #appuifw.app.screen = 'large' self.password = None self.username = None self.debug = False self.error_retry = 0 self.config = config() self.set_title() self.apn = socket.select_access_point() self.dest_name = netbios_hostname self.set_host(netbios_hostname) #self.connect() self.set_menus() self.download_textinfo = appuifw.Text() self.download_textinfo.style = appuifw.STYLE_BOLD
def __init__(self, netbios_hostname=None): #appuifw.app.screen = 'large' self.password = None self.username = None self.debug = False self.error_retry = 0 self.config = config() self.set_title() self.apn = socket.select_access_point() self.dest_name=netbios_hostname self.set_host(netbios_hostname) #self.connect() self.set_menus() self.download_textinfo = appuifw.Text() self.download_textinfo.style = appuifw.STYLE_BOLD
def localIP(): appuifw.app.menu = [] try: id_list = [ap["iapid"] for ap in socket.access_points()] name_list = [ap["name"] for ap in socket.access_points()] apnid = socket.select_access_point() apn = socket.access_point(apnid) apn.start() ip = apn.ip() body.color = (0, 255, 0) slow_print("Your Local IP :\n") body.color = (0, 0, 255) slow_print(ip) slow_print(" \n") except: body.color = (255, 255, 0) slow_print("No Access Point Selected\n") appuifw.app.menu = [(ru("Check Internet IP"), internetIP), (ru("Check Local IP"), localIP), (ru("About"), about), (ru("Exit"), quit)]
def connect(self): if self.error_retry > 3: self.apn = socket.select_access_point() try: del self.netbios del self.addrs del self.remote except: pass self.netbios = nmb.NetBIOS(apn=self.apn) self.dprint(5) addrs = self.netbios.gethostbyname(self.dest_name) self.dprint(6) self.remote = smb.SMB(self.dest_name, addrs[0].get_ip()) if self.remote.is_login_required(): if not self.username: self.username = self.get_text('Enter Username:'******'Username is required').encode('utf-8') if not self.password: self.password = self.get_pass('Enter Password:'******'Password is required').encode('utf-8') self.remote.login(self.username, self.password) self.config.add_host(self.dest_name, self.username, self.password) self.config.write_config() self.dprint(7)
def defaultAP(): ap_id = socket.select_access_point() apo = socket.access_point(ap_id) socket.set_default_access_point(apo)
def select_iap(self): apid = socket.select_access_point() if apid is None: return self.daemon_exec_ok(""" cl2.config_set("iap", "return %d"); return "ok" """ % apid, "IAP ID set to %d" % apid, "Failed to set IAP")
def access(): point = socket.select_access_point() set = open('e:\\system\\apps\\geturl\\set.ini', 'w') set.write(str(point)) set.close()
import socket ap_id = socket.select_access_point() apo = socket.access_point(ap_id) apo.start() print "PHONE IP IS", apo.ip()
def wget(url, ap_id=None): '''Downloads a web resource with the HTTP protocol and returns the result ap_id is the access point to use. If it is None, the user will be prompted''' if not url.startswith('http://'): return None #Remove protocol part url = url[7:] #split GET and domain t = url.split('/', 1) #TODO handle IPv6 addresses m = t[0].split(':', 1) if len(m) == 1: host = m[0] port = 80 else: host = m[0] try: port = int(m[1]) except: port = 80 if len(t) > 1: get = '/' + t[1] else: get = '/' hname = host if port != 80: hname += ":%d" % port #Download the file if ap_id == None: ap_id = socket.select_access_point() ap = socket.access_point(ap_id) #socket.set_default_access_point(ap) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((host, port)) sock.send( "GET %s HTTP/1.1\r\nConnection: close\r\nHost: %s\r\nUser-Agent: RSS-agk\r\n\r\n" % (get, hname)) data = '' while True: r = sock.read(4000) if len(r) == 0: break data += r sock.close() #Release access point ap.stop() return data.split('\r\n\r\n', 1)[1]
def set_ap_cb(): apid = socket.select_access_point() if apid <> None: config.set("internet","apid",apid) set_ap()
appuifw.note(u"Welcome! You will need to set your preferences.", "error") canvas = appuifw.Canvas() appuifw.app.body = canvas w, h = canvas.size img = graphics.Image.new((w, h)) img.clear((255,255,255)) img.text((10,40), u"NoseRub Client v0.1", fill = (0,0,0)) img.text((10,70), u"www.noserub.com", fill = (0,0,0)) canvas.blit(img) location = [] loc_key = [] config = {} read_config() # if user has set a default AP, configure it. ap_id = socket.select_access_point() apo = socket.access_point(ap_id) socket.set_default_access_point(apo) appuifw.app.exit_key_handler = quit appuifw.app.title = u"NoseRub Client" appuifw.app.menu = [(u"Update Location", update), (u"Download locations list",update_list), (u"Preferences", ((u"Base URL", url), (u"User name",user),(u"API Key",api)))] print "NoseRub Client Started" app_lock = e32.Ao_lock() app_lock.wait()
def input_accesspoint(): global config config['accesspoint'] = socket.select_access_point() config['accesspoint_name'] = [ap['name'] for ap in socket.access_points() if ap['iapid']==config['accesspoint']][0]
def onSetAccessPoint(self): self.accessPointId = socket.select_access_point() self.accessPoint = socket.access_point(self.accessPointId) socket.set_default_access_point(self.accessPoint) self.saveSettings()
def wget(url,ap_id=None): '''Downloads a web resource with the HTTP protocol and returns the result ap_id is the access point to use. If it is None, the user will be prompted''' if not url.startswith('http://'): return None #Remove protocol part url=url[7:] #split GET and domain t=url.split('/',1) #TODO handle IPv6 addresses m=t[0].split(':',1) if len(m)==1: host=m[0] port=80 else: host=m[0] try: port=int(m[1]) except: port=80 if len(t)>1: get='/' + t[1] else: get='/' hname=host if port!=80: hname+=":%d" % port #Download the file if ap_id==None: ap_id=socket.select_access_point() ap=socket.access_point(ap_id) #socket.set_default_access_point(ap) sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) sock.connect((host,port)) sock.send("GET %s HTTP/1.1\r\nConnection: close\r\nHost: %s\r\nUser-Agent: RSS-agk\r\n\r\n" % (get,hname)) data='' while True: r=sock.read(4000) if len(r)==0: break data+=r sock.close() #Release access point ap.stop() return data.split('\r\n\r\n',1)[1]
def select_apn(self): appuifw.app.title = ru("Select APN") self.id = socket.select_access_point() appuifw.app.title = ru(title)
def access_point(): ap_id = socket.select_access_point() apo = socket.access_point(ap_id) socket.set_default_access_point(apo)
import e32 from socket import select_access_point from pyaosocket import AoSocketServ, AoConnection serv = AoSocketServ() serv.connect() try: apid = select_access_point() conn = AoConnection() try: conn.open(serv, apid) finally: conn.close() finally: serv.close() print "all done"
import socket print(repr(socket.access_points())) print(repr(socket.select_access_point()))