Skip to content

Commit

Permalink
Move logs and summaries to certain directories.
Browse files Browse the repository at this point in the history
Nothing special, just move the location of generated logs and summaries to specific folders.
Remove deprecated documentations in readme file.
  • Loading branch information
yat17006 committed Feb 28, 2021
1 parent 5b16dd5 commit 3c639af
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 70 deletions.
4 changes: 2 additions & 2 deletions Python/filegenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def __init__(self, make_log, make_summary,
self.makeSummary = make_summary
self.makeAnimation = make_animation
# File Name to be used
self.logFileName = "log-{0}.csv".format(str(sessionId))
self.summaryFileName = "summary-{0}.csv".format(str(sessionId))
self.logFileName = "logs\log-{0}.csv".format(str(sessionId))
self.summaryFileName = "summaries\summary-{0}.csv".format(str(sessionId))
# names of the output files
self.logName = log_name
self.summaryName = summary_name
Expand Down
4 changes: 3 additions & 1 deletion cleanup.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
@echo off
del *.csv
del *.csv
del logs\log-*.csv
del summaries\summary-*.csv
90 changes: 24 additions & 66 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ Follow these steps to get started:
pip install flask
```

3. Execute the following commands to run flask:
3. If it is your first time to run the server, you should create some folders:
```bat
mkdir logs
mkdir summaries
```

4. Execute the following commands to run flask:
```bat
set FLASK_APP=pserver
set FLASK_ENV=development
python -m flask run
```
Alternatively, you may double-click `run_server.bat` file in lieu of manually typing these commands.

4. In certain circumstances, your system might be configuring the `*.js` files with incorrect treatings. Locate registry key `HKEY_CLASSES_ROOT\.js` and edit the key value `Content Type` to be `text/javascript`. <br>
5. In certain circumstances, your system might be configuring the `*.js` files with incorrect treatings. Locate registry key `HKEY_CLASSES_ROOT\.js` and edit the key value `Content Type` to be `text/javascript`. <br>
Please note that you are all set if key value `Content Type` does not exist in `HKEY_CLASSES_ROOT\.js` key at all: just leave the registry as is. Usually, things are problematic if the value of `Content Type` equals to `text/plain`.

### Option 2: Get Started on Windows with WSL
Expand All @@ -43,76 +49,28 @@ https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set

Link: https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3
1) You only need to follow step 1 to install flask.
2) Copy and paste and then run the below two commands. ***You have to do this everytime you open up a new terminal***:\
export FLASK_APP=pserver\
2) Copy and paste and then run the below two commands. ***You have to do this everytime you open up a new terminal***:
```bash
export FLASK_APP=pserver
export FLASK_ENV=development
```

### To run the server:
1) Navigate to the top of this repo
2) Run the following\
2) If it is your first time to run the server, then run
```bat
mkdir summaries
mkdir logs
```

3) Run the following
```bat
flask run
```

## Get Started for Localized Animator
There is a localized animator project written in `Visual Basic .NET 2010`. This sub-project is in initial stage. <br>
To run the project, you should install `.NET Framework 4.0`: https://dotnet.microsoft.com/download/dotnet-framework/net40 <br>
To make changes to the project, you should install `Visual Studio 2010` or higher. Make sure you have installed `VB.NET`.

## Algorithm and Pseudocode
The high level design is to make eight classes of objects: The `Attacker`, `Server`, `Router`, `Packets`, `Connection Object`, `DDD Controller`, `DDD Mapper` and `Client`. <br>
In the high level design, there are eight classes of objects

1. `Attacker` class includes: <br>
- `init` - For defining the object specific data. <br>
- Data includes: <br>
- clientIP: client's IP, used for generating spoofed packetsDropped <br>
- serverIP: IP of server used for SYN-ACK Flood <br>
- curTime: Tracks the current time of the simulation <br>
- counterPacketsSent:Counter for the summary file <br>
- connectionToServer: stores the connectionObject connecting the attacker to the server <br>
- packetsSent: counter for logging purposes <br>
- packetsReceived: counter for logging purposes (currently unused but it makes it easier for the log file to operate) <br>
- packetsDropped: counter for packets dropped (currently unused but it makes it easier for the log file to operate) <br>
- packetsGenerated: Counter for number of packets generated (dw - in the case of a dumb attacker it ends up being the same as packetsSent, but I was adding this variable to all classes for consistency and symmetry in the summary file) <br>
- fileGen: File management object <br>
- packetIDPrefix: Used for packet IDs as a prefix so that we're not using the IPs <br>
- ipAddress: IP address of attacker <br>
- packetSize: The size of the packets sent by the attacker<br>
- sendRate: The rate at which the attacker sents data (MB/ms) <br>
- transmissionDelay: How long it takes to send a packet onto a connection <br>
- sendingPacket: The packet that is currently being sent <br>
- timeToNextIteration: Time inbetween iterations <br>
- `processPackets()` - Checks if a packet is being sent or not. If no packet is being sent then it creates a new packet and starts sending it<br>
- `sendPackets()` - Checks if packet's transmission delay has been satisfied. If it has, then it sends it to the correct connection.<br>
- `generateSYN` - Generates a new syn packet.<br>
- `updateTime` - Updates the current time for the object and runs necessary functions.<br>
2. Server
3. Router
4. Packets
5. Connection Object
6. DDD Controller
7. DDD Mapper
8. Client


2. The ddd controller is to be determined** <br>

3. The `Packet`class is defined as follows: <br>
- `constructor` - Creating new instances of the Packet object.<br>
- Data includes: x and y coordinates for simulation, src and dst IP, and src and dst Port.<br>
- `setSrcPort(newSrcPort)` - Sets new src port. <br>
- `setSrcIp(newSrcIp)` - Sets new src IP. <br>
- `setDstPort(newDstPort)` - Sets new dst port. <br>
- `setDstIp(newDstIp)` - Sets new dst IP. <br>
- `setX(newX)` - Sets the x coordinate of this packet. <br>
- `setY(newY)` - Sets the y coordinate of this packet. <br>
- `getX()` - Returns the x coordinate of this packet. <br>
- `getY()` - Returns the y coordinate of this packet. <br>
- `getSrcPort()` - Returns the src port. <br>
- `getSrcIp()` - Returns the src IP. <br>
- `getDstPort()` - Returns the dst port. <br>
- `getDstIp()` - Returns the dst IP. <br>

4.Have to include info here about main and canvas**
## Summary and Log Files
For each session, the backend would generate a summary file and a log file. They will be separately placed in two directories: `logs` and `summaries`. <br>
There is also a `cleanup.bat`. If you would like to delete all summaries and logs for previous sessions, run it. <br>

## License
This project is under NCSA License. For more information, view the [license](license.txt).
5 changes: 4 additions & 1 deletion run_server.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@echo off
set FLASK_APP=pserver
set FLASK_ENV=development
python -m flask run
mkdir logs > NUL
mkdir summaries > NUL
python -m flask run
pause.

0 comments on commit 3c639af

Please sign in to comment.