Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Symbols with changing Environment Variables #162

Open
r4bit999 opened this issue Feb 7, 2020 · 0 comments
Open

Update Symbols with changing Environment Variables #162

r4bit999 opened this issue Feb 7, 2020 · 0 comments

Comments

@r4bit999
Copy link
Contributor

r4bit999 commented Feb 7, 2020

I almost give up, please help! How i can update Symbols with dynamic user-input and environment variables? I have e.g.

`# global variables
command1 = "ps aux"
command2 = "ls -l /proc/"
command3 = "cat " + consoleimput + "\n\n"

####################################################
CLIENT_HELLO_SYMBOL = Symbol(name="hello")
CLIENT_HELLO_SYMBOL.fields = [
Field(name="Message-Type", domain=HexaString(b"00112233")),
Field(name="SessionID", domain=HexaString(b"00000000")),
]
INPUT_VOCABULARY.append(CLIENT_HELLO_SYMBOL)

####################################################
SERVER_HELLO_SYMBOL = Symbol(name="hello")
SERVER_HELLO_SYMBOL.fields = [
Field(name="Message-Type", domain=HexaString(b"33221100")),
Field(name="SessionID", domain=HexaString(b"4FFFFF3E")),
]
OUTPUT_VOCABULARY.append(SERVER_HELLO_SYMBOL)

####################################################
QUERY_SYMBOL = Symbol(name="hello")
QUERY_SYMBOL.fields = [
Field(name="Message-Type", domain=HexaString(b"22221111")),
Field(Value(SERVER_HELLO_SYMBOL.fields[1]), #so we can access the sessionID
Field(name="command-with-args", ??? command3

]

INPUT_VOCABULARY.append(QUERY_SYMBOL)

####################################################
####################################################

open TCP Client

tcp_client = TCPClient(remoteIP='192.168.1.2', remotePort=9000)
abstractLayer1 = AbstractionLayer(tcp_client, INPUT_VOCABULARY + OUTPUT_VOCABULARY)

abstractLayer1.writeSymbol(CLIENT_HELLO_SYMBOL)
(received_symbol, received_data) = abstractLayer1.readSymbol()
print(received_symbol.name)

#command = USERINPUT IN CONSOLE
command = command2

#Write / Specialize Query Symbol with dynamic user input
abstractLayer1.writeSymbol(QUERY_SYMBOL)
(received_symbol, received_data) = abstractLayer1.readSymbol()
print(received_symbol.name)

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant