jderuiter / statelearner

A tool that can be used to learn state machines from implementations.
Apache License 2.0
63 stars 18 forks source link

How to Run protocal #9

Open Saranya237 opened 1 year ago

Saranya237 commented 1 year ago

Hi, After reading your paper about fuzzing protocol states, I'm really interested in your work. Now the tool is built successfully. but i don't know how to run config and mapping. would you please tell me how to use the tool? and how to run protocol? Thank you!

I attached the protocol -> build.xml file run state.txt

jderuiter commented 1 year ago

You will have to start by constructing the mapper component which translates the abstract input messages (fixed strings) received from StateLearner to actual messages that are understood by your protocol implementation, and the other way around from the responses received to abstract messages (strings) that StateLearner can use to construct the model. Optionally the mapper needs to handle the setup and tear down of sessions with the protocol implementation, and it needs to reset the protocol implementation/set up a new session when the string 'RESET' is received.

Once you have this you need to supply the input messages that your mapper supports to StateLearner in a config file. An example for this you can find in https://github.com/jderuiter/statelearner/tree/master/examples/socket

Saranya237 commented 1 year ago

I'm getting this error what should i do, please help.....

Apr 28, 2023 11:48:19 AM nl.cypherpunk.statelearner.Learner INFO: Using socket SUL Apr 28, 2023 11:48:19 AM nl.cypherpunk.statelearner.Learner INFO: Using socket SUL Apr 28, 2023 11:48:19 AM nl.cypherpunk.statelearner.Learner learn INFO: Using learning algorithm ExtensibleLStarMealy Apr 28, 2023 11:48:19 AM nl.cypherpunk.statelearner.Learner learn INFO: Using learning algorithm ExtensibleLStarMealy Apr 28, 2023 11:48:19 AM nl.cypherpunk.statelearner.Learner learn INFO: Using equivalence algorithm MealyRandomWordsEQOracle Apr 28, 2023 11:48:19 AM nl.cypherpunk.statelearner.Learner learn INFO: Using equivalence algorithm MealyRandomWordsEQOracle Apr 28, 2023 11:48:19 AM nl.cypherpunk.statelearner.Learner learn INFO: Starting learning Apr 28, 2023 11:48:19 AM nl.cypherpunk.statelearner.Learner learn INFO: Starting learning Apr 28, 2023 11:48:19 AM de.learnlib.logging.LearnLogger logPhase INFO: Starting round 1 Apr 28, 2023 11:48:19 AM de.learnlib.logging.LearnLogger logPhase INFO: Starting round 1 Sending symbol: RESET java.net.SocketException: Connection reset at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:320) at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:347) at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:800) at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966) at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:270) at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:313) at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188) at java.base/java.io.InputStreamReader.read(InputStreamReader.java:176) at java.base/java.io.BufferedReader.fill(BufferedReader.java:162) at java.base/java.io.BufferedReader.readLine(BufferedReader.java:329) at java.base/java.io.BufferedReader.readLine(BufferedReader.java:396) at nl.cypherpunk.statelearner.socket.SocketSUL.pre(SocketSUL.java:119) at nl.cypherpunk.statelearner.LogOracle.answerQuerySteps(LogOracle.java:79) at nl.cypherpunk.statelearner.LogOracle.answerQuery(LogOracle.java:105) at nl.cypherpunk.statelearner.LogOracle.processQueries(LogOracle.java:123) at de.learnlib.oracles.CounterOracle.processQueries(CounterOracle.java:66) at de.learnlib.oracles.CounterOracle.processQueries(CounterOracle.java:66) at de.learnlib.algorithms.lstargeneric.table.ObservationTable.initialize(ObservationTable.java:185) at de.learnlib.algorithms.lstargeneric.AbstractLStar.startLearning(AbstractLStar.java:77) at de.learnlib.algorithms.lstargeneric.AbstractAutomatonLStar.startLearning(AbstractAutomatonLStar.java:185) at nl.cypherpunk.statelearner.Learner.learn(Learner.java:226) at nl.cypherpunk.statelearner.Learner.main(Learner.java:355) Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Connection reset at nl.cypherpunk.statelearner.socket.SocketSUL.pre(SocketSUL.java:123) at nl.cypherpunk.statelearner.LogOracle.answerQuerySteps(LogOracle.java:79) at nl.cypherpunk.statelearner.LogOracle.answerQuery(LogOracle.java:105) at nl.cypherpunk.statelearner.LogOracle.processQueries(LogOracle.java:123) at de.learnlib.oracles.CounterOracle.processQueries(CounterOracle.java:66) at de.learnlib.oracles.CounterOracle.processQueries(CounterOracle.java:66) at de.learnlib.algorithms.lstargeneric.table.ObservationTable.initialize(ObservationTable.java:185) at de.learnlib.algorithms.lstargeneric.AbstractLStar.startLearning(AbstractLStar.java:77) at de.learnlib.algorithms.lstargeneric.AbstractAutomatonLStar.startLearning(AbstractAutomatonLStar.java:185) at nl.cypherpunk.statelearner.Learner.learn(Learner.java:226) at nl.cypherpunk.statelearner.Learner.main(Learner.java:355) Caused by: java.net.SocketException: Connection reset at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:320) at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:347) at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:800) at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966) at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:270) at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:313) at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188) at java.base/java.io.InputStreamReader.read(InputStreamReader.java:176) at java.base/java.io.BufferedReader.fill(BufferedReader.java:162) at java.base/java.io.BufferedReader.readLine(BufferedReader.java:329) at java.base/java.io.BufferedReader.readLine(BufferedReader.java:396) at nl.cypherpunk.statelearner.socket.SocketSUL.pre(SocketSUL.java:119) ... 10 more

jderuiter commented 1 year ago

You'll need to provide some more details on what you are exactly doing (what's running, how does your config look like, etc) to be able to provide any sensible feedback