-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
daa56da
commit fb33627
Showing
6 changed files
with
106 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Base image olarak Ubuntu kullanıyoruz | ||
FROM ubuntu:latest | ||
|
||
# Gerekli paketleri yüklüyoruz | ||
RUN apt-get update && apt-get install -y \ | ||
snort \ | ||
&& apt-get clean | ||
|
||
# Snort konfigürasyon dosyasını kopyalıyoruz | ||
COPY snort.conf /etc/snort/snort.conf | ||
|
||
# Snort'u başlatıyoruz | ||
CMD ["sh", "-c", "./network && snort -i $interface_name -c /etc/snort/snort.conf -l /var/log/snort -A console"] |
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,3 @@ | ||
module github.com/SUmidcyber/BreachWatch | ||
|
||
go 1.23.1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package main | ||
|
||
import "github.com/SUmidcyber/BreachWatch/network" | ||
|
||
func main() { | ||
network.Interface() | ||
network.Network_name() | ||
} |
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,57 @@ | ||
package network | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"log" | ||
"os" | ||
"os/exec" | ||
"strings" | ||
) | ||
|
||
func Interface() { | ||
file, err := os.OpenFile("interface.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
defer file.Close() | ||
|
||
logger := log.New(file, "INFO: ", log.Ldate|log.Ltime|log.Lshortfile) | ||
|
||
reader := bufio.NewReader(os.Stdin) | ||
fmt.Print("Learn the interface [Y/n]: ") | ||
input, _ := reader.ReadString('\n') | ||
input = strings.TrimSpace(input) | ||
|
||
if strings.EqualFold(input, "Y") { | ||
fmt.Print("Enter command (Windows [ipconfig] | Linux [ifconfig]): ") | ||
command, _ := reader.ReadString('\n') | ||
command = strings.TrimSpace(command) | ||
|
||
var cmd *exec.Cmd | ||
if command == "ifconfig" { | ||
cmd = exec.Command("ifconfig") | ||
} else if command == "ipconfig" { | ||
cmd = exec.Command("ipconfig") | ||
} else { | ||
fmt.Println("Unknown command...") | ||
logger.Println("Unknown command entered.") | ||
return | ||
} | ||
|
||
output, err := cmd.Output() | ||
if err != nil { | ||
fmt.Println("Failed to execute command:", err) | ||
logger.Println("Failed to execute command:", err) | ||
return | ||
} | ||
|
||
logger.Println("Command executed successfully:", command) | ||
logger.Println("Output:\n", string(output)) | ||
|
||
fmt.Println("Command executed successfully. Check the log file for details.") | ||
} else { | ||
fmt.Println("Interface learning not initiated.") | ||
logger.Println("Interface learning not initiated.") | ||
} | ||
} |
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 network | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
) | ||
|
||
func Network_name() { | ||
reader := bufio.NewReader(os.Stdin) | ||
fmt.Print("Enter the interface name: ") | ||
interfaceName, _ := reader.ReadString('\n') | ||
interfaceName = interfaceName[:len(interfaceName)-1] | ||
|
||
os.Setenv("INTERFACE_NAME", interfaceName) | ||
|
||
cmd := exec.Command("snort", "-i", interfaceName, "-c", "/etc/snort/snort.conf", "-A", "console") | ||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
|
||
if err := cmd.Run(); err != nil { | ||
fmt.Println("Snort failed to run:", err) | ||
} | ||
} |