def __init__(self): bankconfig = OnlineBankConfig() self.bank_addr = bankconfig.get_parameter("CLIENT", "bank_addr") self.bank_port = int(bankconfig.get_parameter("CLIENT", "bank_port")) # bank_stack = bankconfig.get_parameter("CLIENT", "stack", "default") self.bank_username = bankconfig.get_parameter("CLIENT", "username") self.certPath = os.path.join(bankconfig.path(), BANK_CERT_FILE_NAME) self.bank_cert = loadCertFromFile(self.certPath) self.bank_client = None
sys.path.insert( 1,'../src/')#change dict from CipherUtil import loadCertFromFile from BankCore import LedgerLineStorage, LedgerLine from OnlineBank import BankClientProtocol, OnlineBankConfig # insert at 1, 0 is the script path (or '' in REPL)# bankconfig = OnlineBankConfig() bank_addr = bankconfig.get_parameter("CLIENT", "bank_addr") bank_port = int(bankconfig.get_parameter("CLIENT", "bank_port")) bank_stack = bankconfig.get_parameter("CLIENT", "stack","default") bank_username = "******" #bankconfig.get_parameter("CLIENT", "username") certPath = os.path.join(bankconfig.path(), "20194_online_bank.cert") bank_cert = loadCertFromFile(certPath) async def example_transfer(bank_client, src, dst, amount, memo): print("transfer begin") await playground.create_connection( lambda: bank_client, bank_addr, bank_port, family='default' ) print("Connected. Logging in.") try: await bank_client.loginToServer()
from autograder_ex8_packets import AutogradeStartTest, AutogradeTestStatus from playground.network.packet import PacketType import gc_packet_types from CipherUtil import loadCertFromFile from BankCore import LedgerLineStorage, LedgerLine from OnlineBank import BankClientProtocol, OnlineBankConfig import getpass, sys, os, asyncio from playground.common.logging import EnablePresetLogging, PRESET_DEBUG EnablePresetLogging(PRESET_DEBUG) bankconfig = OnlineBankConfig() bank_addr = bankconfig.get_parameter("CLIENT", "bank_addr") bank_port = int(bankconfig.get_parameter("CLIENT", "bank_port")) certPath = os.path.join(bankconfig.path(), "bank.cert") bank_cert = loadCertFromFile(certPath) SRC_ACCOUNT = "jlee662_account" async def transfer(bank_client, src, dst, amount, memo): await playground.create_connection( lambda: bank_client, bank_addr, bank_port, family='default' ) print("Connected. Logging in.") try: await bank_client.loginToServer()
from autograder_ex6_packets import * from game_packets import * from CipherUtil import loadCertFromFile from BankCore import LedgerLineStorage, LedgerLine from OnlineBank import BankClientProtocol, OnlineBankConfig import playground if IS_ONLINE: bankconfig = OnlineBankConfig() bank_addr = bankconfig.get_parameter("CLIENT", "bank_addr") bank_port = int(bankconfig.get_parameter("CLIENT", "bank_port")) bank_stack = bankconfig.get_parameter("CLIENT", "stack", "default") # bank_username = bankconfig.get_parameter("", "username") bank_username = '******' # certPath = os.path.join(bankconfig.path(), "20194_online_bank.cert") certPath = os.path.join(bankconfig.path(), "live_fire_bank.cert") bank_cert = loadCertFromFile(certPath) dst_account = 'sabdous1_account' EnablePresetLogging(PRESET_VERBOSE) STACK = "crap" def create_container_contents(*escape_room_objects): return {obj.name: obj for obj in escape_room_objects} def listFormat(object_list): l = ["a " + object.name for object in object_list if object["visible"]]