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

File not found: MalPredictFlowStatsfile.txt #1

Open
j543453 opened this issue Nov 20, 2018 · 5 comments
Open

File not found: MalPredictFlowStatsfile.txt #1

j543453 opened this issue Nov 20, 2018 · 5 comments

Comments

@j543453
Copy link

j543453 commented Nov 20, 2018

Hey there,

When trying to run this code, CollectStats.py runs perfectly however IDS_RyuApp.py returns a file not found error for MalPredictFlowStatsfile.txt.

I notice in the code it tries to open this file but it is never created. Is there a remedy for this?

Thanks in advance

@Chandrahas-Soman
Copy link
Owner

Chandrahas-Soman commented Nov 23, 2018

Hi,

I have made a mistake, the filename shouldn't be MalPredictFlowStatsfile. It should PredictFlowStatsFile.txt. If you remove 'Mal' it will work. Thanks for bringing it to my attention.

On a different note, if the procedure is not clear here it is, (may be I should update my readme file.)

  1. Run collectstats.py on the controller.
  2. Then create a mininet custom topology.
    (While collecting normal traffic label the data 0.)
  3. Run some simple commands. So that you will be able to generate the clean data.
  4. Stop the controller.
  5. Change the collectstats.py file. Label the data as 1.
  6. Start the controller and run collectstats.py file.
  7. Create topology.
  8. Run hping flood command to capture malicious data.
  9. Now stop the controller.
  10. Run ryuapplication.py on the controller.
  11. Create a topology.
  12. Test the model on the new traffic.

@Chandrahas-Soman
Copy link
Owner

Chandrahas-Soman commented Nov 23, 2018

Also be careful while calling data_cleaning_port and data_cleaning_flow methods, paths can be confusing.

@j543453
Copy link
Author

j543453 commented Nov 30, 2018

I appreciate your response, thank you!

@j543453
Copy link
Author

j543453 commented Nov 30, 2018

For step 5 Change the collectstats.py file. Label the data as 1.

Is that the only thing you have to change in collectstats? Or do you also change the output file names to have "Mal" at the beginning?

Otherwise running it a second time and writing to the same FlowStatsFile results in there being another header added (file.write('dp_id,port_no,rx_bytes,rx_pkts,tx_bytes,tx_pkts') in the constructor.

Like so:

dp_id,port_no,rx_bytes,rx_pkts,tx_bytes,tx_pkts
1,1,824,10,3143,27
1,2,824,10,3143,27
1,1,1622,19,4225,39
1,2,1622,19,4225,39
1,1,2406,27,5149,49
1,2,2476,28,5009,47
1,1,3456,38,6236,60
1,2,3456,38,6236,60
1,1,4478,49,7258,71
1,2,4478,49,7258,71dp_id,port_no,rx_bytes,rx_pkts,tx_bytes,tx_pkts
1,1,516,6,2447,20
1,2,516,6,2447,20
1,1,656,8,3152,27
1,2,656,8,3152,27

Which then causes a parsing error in the IDS app

@Chandrahas-Soman
Copy link
Owner

Hi,

No, you don't have to change the file name to 'mal'. I see the cause of error. Every time we create a new topology and run CollectStats.py, '' dp_id,port_no,rx_bytes,rx_pkts,tx_bytes,tx_pkts '' this header is added to the PortStats.txt file as it is in the constructor of CollectStats.py. I need to modify this code such that I will only write it once.

This will be the case in FlowStatsFile.txt file as well. Thanks. I will modify the code and get back to you.

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

2 participants