-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated master to shocase new functionality
- Loading branch information
Showing
31 changed files
with
1,665 additions
and
286 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,7 @@ build/ | |
nbbuild/ | ||
dist/ | ||
nbdist/ | ||
.nb-gradle/ | ||
.nb-gradle/ | ||
|
||
### NMap outputs ### | ||
nmap-scan_*.xml |
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,5 @@ | ||
language: java | ||
jdk: | ||
- oraclejdk8 | ||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
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,2 +1,7 @@ | ||
# NMapGUI | ||
Advanced Graphical User Interface for NMap | ||
|
||
[![Build Status](https://travis-ci.org/danicuestasuarez/NMapGUI.svg?branch=develop)](https://travis-ci.org/danicuestasuarez/NMapGUI) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/37479ced18a04d4e8f1c38753b22003c)](https://www.codacy.com/app/danicuestasuarez/NMapGUI?utm_source=github.com&utm_medium=referral&utm_content=danicuestasuarez/NMapGUI&utm_campaign=Badge_Grade) | ||
|
||
On progress: Menu creation |
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
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 |
---|---|---|
@@ -1,45 +1,117 @@ | ||
package com.uniovi.nmapgui; | ||
|
||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.FileNotFoundException; | ||
import java.io.InputStream; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import javax.annotation.Resource; | ||
|
||
import org.springframework.core.io.InputStreamResource; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
|
||
import com.uniovi.nmapgui.executor.CommandExecutor; | ||
import com.uniovi.nmapgui.model.Command; | ||
import com.uniovi.nmapgui.util.Filefinder; | ||
|
||
@Controller | ||
public class WebController { | ||
private CommandExecutor executor = new CommandExecutor(); | ||
Command command = new Command(); | ||
|
||
private List<Command> commands; | ||
private Command command; | ||
@GetMapping("/nmap") | ||
public String command(Model model) { | ||
command = new Command(); | ||
executor = new CommandExecutor(); | ||
commands= new ArrayList<Command>(); | ||
model.addAttribute("command", command); | ||
model.addAttribute("output",executor.out); | ||
model.addAttribute("commands", commands); | ||
|
||
|
||
return "index"; | ||
} | ||
|
||
@GetMapping("/nmap-exe") | ||
public String command(Model model, @RequestParam String code) { | ||
command.setText(code); | ||
executor.execute(command); | ||
model.addAttribute("output",executor.out); | ||
command = new Command(code); | ||
commands.add(0,command); | ||
new CommandExecutor().execute(command); | ||
model.addAttribute("command", command); | ||
return "index :: out-fragment"; | ||
model.addAttribute("commands", commands); | ||
|
||
return "index :: output"; | ||
} | ||
|
||
|
||
@GetMapping("/nmap/update") | ||
public String updateOut(Model model) { | ||
model.addAttribute("output",executor.out); | ||
|
||
model.addAttribute("command", command); | ||
model.addAttribute("commands", commands); | ||
boolean notFinished=false; | ||
for(Command cmd : commands) | ||
if(notFinished=!cmd.isFinished()) | ||
break; | ||
if(!notFinished) | ||
commands=new ArrayList<>(); | ||
|
||
|
||
return "index :: out-fragment"; | ||
return "index :: output"; | ||
} | ||
|
||
@GetMapping("/nmap/update-finished") | ||
public @ResponseBody Boolean updateEnd() { | ||
for(Command cmd : commands) | ||
if(!cmd.isFinished()) | ||
return false; | ||
return true; | ||
} | ||
@GetMapping("/nmap/download/{filename}") | ||
public ResponseEntity<InputStreamResource> download(@PathVariable("filename") String filename) throws FileNotFoundException { | ||
|
||
InputStream file= new Filefinder().find(filename); | ||
|
||
InputStreamResource resource = new InputStreamResource(file); | ||
|
||
return ResponseEntity.ok() | ||
.contentType(MediaType.parseMediaType("application/octect-stream")) | ||
.body(resource); | ||
} | ||
|
||
// @GetMapping("/nmap/update-finished-list") | ||
// public @ResponseBody List<Integer> updateEndList() { | ||
// List<Integer> ids = new ArrayList<Integer>(); | ||
// int index=0; | ||
// for(Command cmd : commands) | ||
// { | ||
// if(!cmd.isFinished()) | ||
// ids.add(++index); | ||
// else if(!cmd.isChkUpdateFlag()){ | ||
// cmd.setChkUpdateFlag(true); | ||
// ids.add(++index); | ||
// } | ||
// } | ||
// return ids; | ||
// } | ||
// | ||
// @GetMapping("/nmap/updateid") | ||
// public String updateOut(Model model, @RequestParam int id) { | ||
// model.addAttribute("command", command); | ||
// model.addAttribute("commands", commands); | ||
// | ||
// | ||
// return "index :: out"+id; | ||
// } | ||
// | ||
// | ||
|
||
} |
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,15 @@ | ||
package com.uniovi.nmapgui.util; | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.FileNotFoundException; | ||
import java.io.InputStream; | ||
|
||
public class Filefinder { | ||
|
||
public InputStream find(String filename) throws FileNotFoundException { | ||
File xml =new File(System.getProperty("user.dir")+"/src/main/resources/static/temp/"+filename+".xml"); | ||
return new FileInputStream(xml); | ||
} | ||
|
||
} |
Oops, something went wrong.