Example #1
0
 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
Example #2
0
from CipherUtil import loadCertFromFile
from BankCore import LedgerLineStorage, LedgerLine
from OnlineBank import BankClientProtocol, OnlineBankConfig
import playground, time
import getpass, os, asyncio

bankconfig = OnlineBankConfig()
bank_addr = "20194.0.0.19000"
bank_port = 777
bank_stack = "default"
bank_username = "******"
certPath = "/home/student_20194/YU_MAO/20194_online_bank.cert"
bank_cert = loadCertFromFile(certPath)


async def example_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()
    except Exception as e:
        print("Login error. {}".format(e))
        return False

    try:
        await bank_client.switchAccount(src)
    except Exception as e:
Example #3
0
import asyncio
import sys
import time

from playground.common.logging import EnablePresetLogging, PRESET_VERBOSE
from playground.network.packet.fieldtypes import BOOL, STRING
from playground.network.common import PlaygroundAddress
from playground.network.packet import PacketType
import playground
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
import getpass, sys, os, asyncio

bankconfig = OnlineBankConfig()
bank_addr =     bankconfig.get_parameter("CLIENT", "bank_addr")
print('Client Bank Addr: ' + str(bank_addr))
bank_port = int(bankconfig.get_parameter("CLIENT", "bank_port"))
print('Client Bank Port: ' + str(bank_port))
bank_stack     =     bankconfig.get_parameter("CLIENT", "stack","default")
# bank_username  =     bankconfig.get_parameter("CLIENT", "username")
import asyncio
import functools
import playground
import time
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'
            )
Example #5
0
from playground.network.packet.fieldtypes import STRING, BUFFER, UINT8, UINT16, BOOL
from playground.network.common import PlaygroundAddress
from playground.network.packet import PacketType
from playground.network.packet.fieldtypes.attributes import Optional
from playground.common.logging import EnablePresetLogging, PRESET_DEBUG, PRESET_VERBOSE
from prfc_packet import *
from escape_room_006 import *

EnablePresetLogging(PRESET_DEBUG)

sys.path.append('../BitPoints-Bank-Playground3/src')
from CipherUtil import loadCertFromFile
from BankCore import LedgerLineStorage, LedgerLine
from OnlineBank import BankClientProtocol, OnlineBankConfig

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")

bank_addr = '20194.0.0.19000'
bank_port = '777'
bank_username = '******'

# certPath = os.path.join(bankconfig.path(), "bank.cert")
certPath = os.path.join('20194_online_bank.cert')
bank_cert = loadCertFromFile(certPath)

#Server_Port_number=1943+int(random.random()*1000)+int(random.random()*1000)
Server_Port_number = 18302
Example #6
0
from CipherUtil import loadCertFromFile
from BankCore import LedgerLineStorage, LedgerLine
from OnlineBank import BankClientProtocol, OnlineBankConfig
import playground
import getpass, sys, os, asyncio

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(), "bank.cert")
bank_cert = loadCertFromFile(certPath)


async def example_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()
    except Exception as e:
        print("Login error. {}".format(e))
        return False

    try:
        await bank_client.switchAccount(src)
Example #7
0
ag_start_packet.name = "Enayat Ullah"
ag_start_packet.team = 9
ag_start_packet.email = "*****@*****.**"
ag_start_packet.port = 4242
file_name = "game_packets.py"
username = "******"

with open(file_name, "r") as f:
    ag_start_packet.packet_file = str.encode(f.read())

ag_start_packet_bytes = ag_start_packet.__serialize__()

test_id = "43929a54a239bab550c68bbf3ca843ee167774b9d064085732e268fcaa8bd821"
check_status = 1

bankconfig = OnlineBankConfig()
if testLocally:
    bank_addr = "20194.1.1.1"
    bank_port = 700
    # 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")
    bank_username = "******"
    my_account = "account1"
    password = "******"
    certPath = os.path.join(bankconfig.path(), "bank.cert")

# TEST GLOBAL
else:
    bank_addr = '20194.0.0.19000'
Example #8
0
import playground
import getpass, sys, os, asyncio
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.")