Assumption:
- All inputs will be in the format of [Date in the epoch format,IP,Username,SUCCESS or FAILURE] as json in payload of request Ex: 1507365137,187.218.83.136,John.Smith,SUCCESS
- All events sent in order by time. So I have search for failure logins during period of last 5 minutes
Note:
- If there many requests sent to server on parallel, server response based on current status and count he received so far.
as example server may have 3 failed and next one arrived due to latency in network the fifth before the forth.
Then fifths will be normal but forth will be suspecious
PreRequists as on mac:
brew install sbt
brew install cassandra
Steps to Run:
1- Install Cassandra DB : I selected as it will be easy handle millions of recoreds of logs per clustered DB and parition keys
2- Create Schema using file Schema.txt located at "./HackerDetectorService/conf/cql"
3- This is Intellij project created by Playframwork and you can run it by calling commands
-> sbt clean cleanFiles update compile
then
-> sbt run
4- you can test endpoint by either postman or curl command as follow :
curl -X POST http://localhost:9000/parselogline -H 'content-type: application/json' -d '"1907365745,187.218.83.190,John.Smith,FAILURE"'
5- I have added endpoint /test which run about 1000 parallel thread to hit server to make sure all requests are processed fine.
aismail2008 / hackerdetetorservice Goto Github PK
View Code? Open in Web Editor NEWLicense: Other