Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
3,059 additions
and
44 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
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,113 @@ | ||
grammar Predicate; | ||
|
||
//IP == "127.0.0.1" | ||
//SCANNER ~= 'nmap' | ||
//SERVICE LIKE 'http' | ||
//PORT LIKE "443" | ||
//EXPLOITABLE | ||
//(SERVICE LIKE 'SMB') && !EXPLOITABLE | ||
// (PORT LIKE "443") || (SERVICE LIKE "http") | ||
// ((IP == "127.0.0.1") && (!EXPLOITABLE)) || ((PORT LIKE "443") && (SERVICE LIKE "http")) | ||
// Predicate(Predicate(IP,==,"127.0.0.1).and(Predicate.not(EXPLOITABLE)).or(Predicate(PORT,LIKE,"443").and(Predicate(SERVICE,LIKE,'http'))) | ||
|
||
@header { | ||
package net.vdbaan.issuefinder.parser; | ||
} | ||
|
||
expr: expr AND expr # andExpr | ||
| expr OR expr # orExpr | ||
| LPAREN expr RPAREN # enclosedExpr | ||
| NOT expr # notExpr | ||
| column operator STRING # assign | ||
| column rangeOperator RANGE # range | ||
| column groupOperator GROUP # group | ||
| NOT column # notColumn | ||
; | ||
|
||
LPAREN: '('; | ||
RPAREN: ')'; | ||
AND : '&&' | 'AND'; | ||
OR : '||' | 'OR'; | ||
NOT : '!'; | ||
|
||
//SCANNER("SCANNER"),IP("IP"),PORT("PORT"),SERVICE("SERVICE"),RISK("RISK"),EXPLOITABLE("EXPLOITABLE"),DESCRIPTION("DESCRIPTION") | ||
column | ||
: SCANNER | ||
| IP | ||
| PORT | ||
| SERVICE | ||
| RISK | ||
| EXPLOITABLE | ||
| DESCRIPTION | ||
| PLUGIN | ||
; | ||
|
||
groupOperator: IN; | ||
rangeOperator: BETWEEN; | ||
|
||
operator | ||
: '==' | ||
| '!=' | ||
| '<' | ||
| '<=' | ||
| '>' | ||
| '=>' | ||
| '~=' | ||
| LIKE | ||
; | ||
|
||
IP: I P; | ||
SCANNER: S C A N N E R; | ||
PORT: P O R T; | ||
SERVICE: S E R V I C E; | ||
RISK: R I S K; | ||
EXPLOITABLE: E X P L O I T A B L E; | ||
DESCRIPTION: D E S C R I P T I O N; | ||
PLUGIN: P L U G I N; | ||
|
||
IN: I N; | ||
LIKE: L I K E; | ||
BETWEEN: B E T W E E N; | ||
|
||
GROUP: '[' STRING (',' STRING)+ ']'; | ||
RANGE: LPAREN STRING ',' STRING RPAREN; | ||
STRING | ||
: DQUOTE ~["]+? DQUOTE | ||
| SQUOTE ~[']+? SQUOTE | ||
| CHAR | ||
; | ||
fragment A: [aA]; | ||
fragment B: [bB]; | ||
fragment C: [cC]; | ||
fragment D: [dD]; | ||
fragment E: [eE]; | ||
fragment F: [fF]; | ||
fragment G: [gG]; | ||
fragment H: [hH]; | ||
fragment I: [iI]; | ||
fragment J: [jJ]; | ||
fragment K: [kK]; | ||
fragment L: [lL]; | ||
fragment M: [mM]; | ||
fragment N: [nN]; | ||
fragment O: [oO]; | ||
fragment P: [pP]; | ||
fragment Q: [qQ]; | ||
fragment R: [rR]; | ||
fragment S: [sS]; | ||
fragment T: [tT]; | ||
fragment U: [uU]; | ||
fragment V: [vV]; | ||
fragment W: [wW]; | ||
fragment X: [xX]; | ||
fragment Y: [yY]; | ||
fragment Z: [zZ]; | ||
SQUOTE: '\'' -> skip; | ||
DQUOTE: '"' -> skip; | ||
//CHAR : ~[ \t\r\n"']+ ; // // match any chars except space tab, newline, double and single quote | ||
|
||
CHAR: [a-zA-Z/\\.0-9:;]+; | ||
WS : [ \t\n\r]+ -> skip ; // skip spaces, tabs, newlines, \r (Windows) |
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,89 @@ | ||
package net.vdbaan.issuefinder | ||
|
||
import javafx.collections.FXCollections | ||
import javafx.collections.ObservableList | ||
import javafx.fxml.FXMLLoader | ||
import javafx.scene.Parent | ||
import javafx.scene.Scene | ||
import javafx.scene.control.Label | ||
import javafx.stage.Modality | ||
import javafx.stage.Stage | ||
import javafx.stage.StageStyle | ||
import net.vdbaan.issuefinder.controller.DialogController | ||
import net.vdbaan.issuefinder.controller.EditorController | ||
import net.vdbaan.issuefinder.controller.FXMLController | ||
import net.vdbaan.issuefinder.controller.ProgressController | ||
import net.vdbaan.issuefinder.model.Finding | ||
|
||
|
||
import static groovyx.javafx.GroovyFX.start | ||
|
||
class MainApp { | ||
Stage primaryStage | ||
private ObservableList<Finding> masterData = FXCollections.observableArrayList() | ||
|
||
def run(String... args) { | ||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/layout.fxml")) | ||
start { | ||
primaryStage = stage(title: 'Issue Finder', width: 1200, height: 500, visible: true, maximized: true) { | ||
def mainScene = scene() { | ||
} | ||
mainScene.root = fxmlLoader.load() | ||
} | ||
FXMLController controller = fxmlLoader.getController() | ||
controller.setMasterData(masterData) | ||
controller.setup(this) | ||
// controller.openFiles(args.collect { new File(it) }) | ||
} | ||
} | ||
|
||
def showAbout() { | ||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/about.fxml")) | ||
Parent root = loader.load() | ||
Stage dialog = new Stage() | ||
dialog.initOwner(primaryStage) | ||
Scene scene = new Scene(root) | ||
dialog.initStyle(StageStyle.UNDECORATED) | ||
dialog.setScene(scene) | ||
DialogController controller = loader.getController() | ||
controller.dialogPane = dialog | ||
dialog.showAndWait() | ||
} | ||
|
||
void showProgressDialog(List<File> files, Label statusLabel) { | ||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/progress.fxml")) | ||
Parent root = loader.load() | ||
Stage dialog = new Stage() | ||
dialog.initOwner(primaryStage) | ||
Scene scene = new Scene(root) | ||
dialog.initStyle(StageStyle.UNDECORATED) | ||
dialog.initModality(Modality.APPLICATION_MODAL) | ||
dialog.setScene(scene) | ||
ProgressController controller = loader.getController() | ||
controller.dialogPane = dialog | ||
controller.statusLabel = statusLabel | ||
controller.fileList = files | ||
controller.masterData = masterData | ||
controller.process() | ||
dialog.showAndWait() | ||
} | ||
|
||
void showEditor(Finding finding) { | ||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/editor.fxml")) | ||
Parent root = loader.load() | ||
Stage dialog = new Stage() | ||
dialog.initOwner(primaryStage) | ||
Scene scene = new Scene(root) | ||
dialog.initStyle(StageStyle.UNDECORATED) | ||
dialog.initModality(Modality.APPLICATION_MODAL) | ||
dialog.setScene(scene) | ||
EditorController controller = loader.getController() | ||
controller.dialogPane = dialog | ||
controller.masterData = masterData | ||
controller.finding = finding | ||
controller.setup() | ||
dialog.showAndWait() | ||
} | ||
|
||
|
||
} |
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,20 @@ | ||
package net.vdbaan.issuefinder | ||
|
||
class Runner { | ||
static void main(String... args) { | ||
testJavaFX() | ||
MainApp app = new MainApp() | ||
app.run(args) | ||
} | ||
|
||
static void testJavaFX() { | ||
try { | ||
Class.forName('javafx.stage.Stage') | ||
} catch(ClassNotFoundException e) { | ||
System.err.println 'JavaFX8 Missing' | ||
System.err.println 'Please install JavaFX, for example:' | ||
System.err.println '- sudo apt-get install openjfx' | ||
System.exit(1) | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/groovy/net/vdbaan/issuefinder/controller/DialogController.groovy
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 net.vdbaan.issuefinder.controller | ||
|
||
import javafx.fxml.FXML | ||
import javafx.fxml.Initializable | ||
import javafx.scene.control.Label | ||
import javafx.stage.Stage | ||
|
||
import java.util.jar.Manifest | ||
|
||
|
||
class DialogController implements Initializable { | ||
|
||
Stage dialogPane | ||
|
||
@FXML | ||
Label version | ||
|
||
@Override | ||
void initialize(URL url, ResourceBundle rb) { | ||
def vers | ||
getClass().classLoader.getResources('META-INF/MANIFEST.MF').each { uri -> | ||
uri.openStream().withStream { is -> | ||
def attributes = new Manifest(is).mainAttributes | ||
vers = attributes.getValue('version') | ||
} | ||
} | ||
version.text = (vers == null)?'Version: DEV':'Version: '+vers | ||
} | ||
def closeAction() { | ||
dialogPane.hide() | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/main/groovy/net/vdbaan/issuefinder/controller/EditorController.groovy
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,51 @@ | ||
package net.vdbaan.issuefinder.controller | ||
|
||
import javafx.collections.ObservableList | ||
import javafx.fxml.FXML | ||
import javafx.scene.control.* | ||
import javafx.stage.Stage | ||
import net.vdbaan.issuefinder.model.Finding | ||
|
||
|
||
class EditorController { | ||
@FXML TextField editScanner | ||
@FXML TextField editHostname | ||
@FXML TextField editIp | ||
@FXML TextField editPort | ||
@FXML TextField editService | ||
@FXML TextField editPlugin | ||
@FXML ChoiceBox editRisk | ||
|
||
Stage dialogPane | ||
ObservableList<Finding> masterData | ||
Finding finding | ||
|
||
def setup() { | ||
editRisk.items.addAll(Finding.Severity.values()) | ||
editScanner.setText(finding.scanner) | ||
editHostname.setText(finding.hostName) | ||
editIp.setText(finding.ip) | ||
editPort.setText(finding.port) | ||
editService.setText(finding.service) | ||
editPlugin.setText(finding.plugin) | ||
editRisk.setValue(finding.severity) | ||
} | ||
|
||
boolean okClicked = false | ||
|
||
def doOk() { | ||
finding.scanner = editScanner.text | ||
finding.hostName = editHostname.text | ||
finding.ip = editIp.text | ||
finding.port = editPort.text | ||
finding.service = editService.text | ||
finding.plugin = editPlugin.text | ||
finding.severity = editRisk.getValue() | ||
okClicked = true | ||
dialogPane.hide() | ||
} | ||
|
||
def doCancel() { | ||
dialogPane.hide() | ||
} | ||
} |
Oops, something went wrong.