当前位置: 首页>>代码示例>>Python>>正文


Python WConio.cgets方法代码示例

本文整理汇总了Python中WConio.cgets方法的典型用法代码示例。如果您正苦于以下问题:Python WConio.cgets方法的具体用法?Python WConio.cgets怎么用?Python WConio.cgets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WConio的用法示例。


在下文中一共展示了WConio.cgets方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: login

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import cgets [as 别名]
def login ():
	global HOST
	global PORT
	global auth
	WConio.textcolor(7)
	print('\n\n  Please enter server data: \n\n    IP: ', end=" ")
	HOST = WConio.cgets(30)
	print('\n    Port: ', end=" ")
	PORT = WConio.cgets(30)
	print('\n\n  Setting up connection...')
	try:
		HOST = HOST.split()
		PORT = PORT.split()
		HOST = HOST[0]
		PORT = int(PORT[0])
		
		s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
		s.connect((HOST,PORT))
		s.send('OPT')
		req = s.recv(1024)
		if req == 'AUTH':
			print('\n  Please enter user data: \n\n    User: ', end=" ")
			user = WConio.cgets(30)
			print('\n    Password: ', end=" ")
			passw = WConio.cgets(30)
			print('\n\n  Sending login data...')
			s.send(user)
			s.send(passw)
			req = s.recv(1024)
			if req == 'DENY':
				WConio.textcolor(4)
				print('\n  Error! Server rejected login. Wrong Password?\n  Please try again later!')
				auth = 0
			else:
				auth = 1
				print('\n  Successfully logged in!')
		else:
				auth = 1
				print('\n  Already logged in')
	except:
		WConio.textcolor(4)
		print('\n  Connection Error!')
开发者ID:ice8lue,项目名称:MiniServ,代码行数:44,代码来源:cons_no_threads.py

示例2: exit

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import cgets [as 别名]
od[3] = od[3].split('\n')[0]
onver = od[0]+od[1]+od[2]+od[3]
versio = vc[0]+vc[1]+vc[2]+vc[3]

if versio == onver:
	WConio.textcolor(2)
	print '\n  Your Version is up to date'
	WConio.textcolor(7)
	exit()
else:
	if onver > versio:
		WConio.textcolor(4)
		print '\n  You should update!'
		WConio.textcolor(7)
		print '\n  This Updater can do all that for you, ok? [y/n]: ',
		text = WConio.cgets(1)
		if text == 'n':
			exit()
		elif text == 'y':
			print '\n\n  Creating temp directory...',
			goto_dir('temp')
		
			WConio.textcolor(2)
			print 'done'
			WConio.textcolor(7)
			cons = 'http://www.frankadler.de/miniserv/files/latest/cons.exe'
			download(cons)
			serv = 'http://www.frankadler.de/miniserv/files/latest/serv.exe'
			download(serv)
			updater = 'http://www.frankadler.de/miniserv/files/latest/updater.exe'
			download(updater)
开发者ID:ice8lue,项目名称:MiniServ,代码行数:33,代码来源:updater.py

示例3: open

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import cgets [as 别名]
import WConio
import win32crypt
import binascii

WConio.settitle('MiniServ :: First-Use-Configuration')
WConio.textmode()
WConio.textcolor(2)

ini = open('settings.ini','r')
inidat = ini.readlines()
ini.close()
version = inidat[0].split()
version = version[0]

print("\n\nPlease enter some letters and numbers and press ENTER: ", end=" ")
text = WConio.cgets(512)

print("\n\nPlease give me some more letters and numbers and press ENTER: ", end=" ")
textb = WConio.cgets(512)

string = text + textb
pwdHash = win32crypt.CryptProtectData(string.encode(),'psw',None,None,None,0)
pwdHashStr = str(binascii.hexlify(pwdHash)).upper()
print('\n\nSecurity Login Hash: ' + pwdHashStr)

print("\n\nWriting settings.ini ...")

g = open('settings.ini', "w")
linez = str(version)+"\n"
linea = pwdHashStr
g.write(linez)
开发者ID:ice8lue,项目名称:MiniServ,代码行数:33,代码来源:firstrun.py

示例4: print

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import cgets [as 别名]
WConio.textcolor(9)

print('>>>>> MiniServ :: Service Console %s\n'%version)

WConio.textcolor(15)

print('Enter "help" for a list of commands \n') 

commands = 'help','check update','connect','say hello','get server time','get server info','set logging min','set logging max','close server','close console','close all','disconnect'

auth = 0

while 1:
	WConio.textcolor(2)
	print('\n> ', end=" ")
	text = WConio.cgets(30)
	
	### text now contains a command ###
	
	if not text in commands:
		WConio.textcolor(7)
		print('\n\n  Unknown Command!')
		continue
	
	elif text == 'help':
		WConio.textcolor(7)
		print('\n\n  Possible Commands:')
		print('    help			-- shows this page')
		print('    connect to [IP] [PORT]	-- connects to selected IP to login')
		print('    say hello			-- sends Greetings to the Server')
		print('    get server time		-- fetches current server time')
开发者ID:ice8lue,项目名称:MiniServ,代码行数:33,代码来源:cons_no_threads.py

示例5: print

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import cgets [as 别名]
ini.close()
version = inidat[0]
pwdHashStr = inidat[1]

WConio.settitle("MiniServ :: Service Terminal")
WConio.textmode()
WConio.textcolor(9)
print("MiniServ :: Service Terminal %s\n" % version)
WConio.textcolor(15)
print('Enter "help" for a list of commands \n')

# Setup Server Connection

WConio.textcolor(2)
print("\nPlease enter Server IP: ", end=" ")
IP = WConio.cgets(20)

try:
    SPORT = 10104
    ssock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    ssock.connect((IP, SPORT))
    print("\n\nService Socket connected to " + str(IP) + " on Port " + str(SPORT) + "\n")
except:
    WConio.textcolor(4)
    print("\n\nERROR! Can not connect to " + IP)
    exit()


def auth():
    global pwdHashStr
    ssock.send(bytes(pwdHashStr, "iso-8859-1"))
开发者ID:ice8lue,项目名称:MiniServ,代码行数:33,代码来源:cons.py


注:本文中的WConio.cgets方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。