-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: README.md ui/app/views/components/app-container.component.html
- Loading branch information
Showing
82 changed files
with
3,073 additions
and
603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
Version: GnuPG v1 | ||
|
||
mQINBFkRxeYBEAC8N672/5USJztb1R4pn8zB2/fujg71uAh1ZEERbiMFHC0IJbuh | ||
8aF0F+tn1YIbMuI8B1byMOLhSRnnuw630StbnUsVqRbLXg3plLDAg50I1v90pXfO | ||
FiOOG1XApnb8NhS+huGwIXXLk65NE1MPwhPC9jxK1Bx/RJZNKg9UDz5+YPPEydhh | ||
ZJ+35UKb94DuY/YsqMCSYJwlHL3ZnqENcQvylVD9TSdJCJ51xu655kbbZks1Amaz | ||
j7aWJQs8ur9nhEw/au221rUdOrS0XW5m4XCfE7hTqjREjDEGsUHilbsO+RH2f2+h | ||
PWalG/9aN2f1maiAezAuT/agFBWbuyYqBfSvuZOMCuLdXsiQNxdPJPcEQUIcO1Qf | ||
g4RTWJCoXrlL2QQSSstswPrlZxloHsGvl0AtAlard2+rr6Fz1QG3hokOhFav8LS+ | ||
0lbwQpR1K3RY2HUrof1r4HCQHqEJ76q0bwk9vhd8cAA9tc5uTh+oBbKXaPyO/8Be | ||
SUiBU94kJd12RR81FIF4bAcqgrTi8JDj+EaXeGH5b6eUiRmEWCSzQpq6nOYMYBQw | ||
4r62v4zYYq0NgM6f8rZ+EeuvCiGxSGAzvtLtKRYZRYHZanasO/pyVy6cpRxiWVRR | ||
5+smE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35vTABaM1m25HcjumKeU2XtfN4EArlxuxZRHSbQ | ||
2ceWDPm5TuvjMyZdb5u90xpJ/VGmFYxqjfR1nwku9mY1JKDvZgI9i3Gm+JgrDI4c | ||
ldFFLTSdSASnOfW1P+flMKUkDOBIIOYJtZgZ9BU9U/lU5/ZssPoCWkfwy022anqu | ||
wR6Z0Ao/cKE+l+XoXFOvtcRvJyfarXs9EON0s/HNyPRpy20KPyv2lCwm11bhGoI3 | ||
LGYf9udLuLm2Dex9U4+Hs2KWDT9QeVmS7OQUz0Yg184CkVWGLqaVIReYv9q7qPlI | ||
CykvrXDiG+C5OTn1wvPRUX1wA1f7dRsYXOK3AHxz65zMSw== | ||
=f0Hb | ||
-----END PGP PUBLIC KEY BLOCK----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package controllers | ||
|
||
import javax.inject.Inject | ||
|
||
import models.InvalidRequestError | ||
import play.api.Logger | ||
import play.api.libs.json.{ JsObject, JsValue } | ||
import play.api.mvc.{ Action, AnyContent, Controller } | ||
import services.MispSrv | ||
|
||
import scala.concurrent.ExecutionContext | ||
|
||
class MispCtrl @Inject() (mispSrv: MispSrv, implicit val ec: ExecutionContext) extends Controller { | ||
|
||
private[MispCtrl] lazy val logger = Logger(getClass) | ||
def modules: Action[AnyContent] = Action { _ ⇒ | ||
Ok(mispSrv.moduleList) | ||
} | ||
|
||
def query: Action[JsValue] = Action.async(parse.json) { request ⇒ | ||
val module = (request.body \ "module").asOpt[String].getOrElse(throw InvalidRequestError("Module parameter is not present in request")) | ||
val (mispType, dataJson) = request.body.as[JsObject].fields | ||
.collectFirst { | ||
case kv @ (k, _) if k != "module" ⇒ kv | ||
} | ||
.getOrElse(throw InvalidRequestError("Request doesn't contain data to analyze")) | ||
val data = dataJson.asOpt[String].getOrElse(throw InvalidRequestError("Data has invalid type (expected string)")) | ||
mispSrv.query(module, mispType, data) | ||
.map(Ok(_)) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package controllers | ||
|
||
import javax.inject.{ Inject, Singleton } | ||
|
||
import play.api.Configuration | ||
import play.api.libs.json.Json | ||
import play.api.libs.json.Json.toJsFieldJsValueWrapper | ||
import play.api.mvc.{ Action, Controller } | ||
|
||
@Singleton | ||
class StatusCtrl @Inject() ( | ||
configuration: Configuration) extends Controller { | ||
|
||
private[controllers] def getVersion(c: Class[_]) = Option(c.getPackage.getImplementationVersion).getOrElse("SNAPSHOT") | ||
|
||
def get = Action { _ ⇒ | ||
Ok(Json.obj( | ||
"versions" → Json.obj( | ||
"Cortex" → getVersion(classOf[models.Artifact]), | ||
"Play" → getVersion(classOf[Controller])), | ||
"config" → Json.obj( | ||
"authType" → "none", | ||
"capabilities" → Json.arr()))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
package models | ||
|
||
import scala.concurrent.Future | ||
import play.api.libs.json.JsObject | ||
|
||
abstract class Analyzer { | ||
def analyze(artifact: Artifact): Future[JsObject] | ||
val name: String | ||
val version: String | ||
val description: String | ||
val dataTypeList: Seq[String] | ||
val id = (name + "_" + version).replaceAll("\\.", "_") | ||
val author: String | ||
val url: String | ||
val license: String | ||
val id: String = (name + "_" + version).replaceAll("\\.", "_") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package models | ||
|
||
abstract class CortexError(message: String) extends Exception(message) | ||
|
||
case class JobNotFoundError(jobId: String) extends CortexError(s"Job $jobId not found") | ||
case class UnexpectedError(message: String) extends CortexError(message) | ||
case class AnalyzerNotFoundError(analyzerId: String) extends CortexError(s"Analyzer $analyzerId not found") | ||
case class InvalidRequestError(message: String) extends CortexError(message) |
Oops, something went wrong.