dstl / YAWNING-TITAN

YAWNING TITAN is an abstract, graph based cyber-security simulation environment that supports the training of intelligent agents for autonomous cyber operations.
MIT License
57 stars 17 forks source link

input never an integer in custom_network function - network_creator #14

Closed A-acuto closed 1 year ago

A-acuto commented 1 year ago

Hi,

I think there is a piece missing in the function custom_network(), from network_creator code (helper functions).

The input number of nodes is checked if it is an integer, however every input from user is read as string (or at least in a Windows environment). So it is not possible to create a custom network.

An easy fix could be: Actual code

def custom_network() -> Union[Tuple[np.array, dict], None]:
    size = input("How many nodes in the network? ")
    if type(size) != int:
        print("Error in input - NOT INT")
        return None
    else:
        #do something

FIX

def custom_network() -> Union[Tuple[np.array, dict], None]:
    size = input("How many nodes in the network? ")
    if type(int(size)) != int:
        print("Error in input - NOT INT")
        return None
    else:
        #do something

I think in this way if the input is a float or a text char it will not work, however it will go smoothly for integers. I hope this helps, Alberto

jamesshort1 commented 1 year ago

Added as a new IDT Jira issue (AIDT-96)

ChrisMcCarthyDev commented 1 year ago

Hi @A-acuto. Thank you for raising this. I can confirm that a fix for this will be included in the imminent v1.0.0 release.

ChrisMcCarthyDev commented 1 year ago

Closing this issue as fix applied in https://github.com/dstl/YAWNING-TITAN/releases/tag/v1.0.0