Skip to content

Commit

Permalink
Merge pull request #1 from referefref/dev
Browse files Browse the repository at this point in the history
Major Changes - Added Lures
  • Loading branch information
referefref authored Jul 2, 2024
2 parents b42186f + 9453cff commit 8317aa0
Show file tree
Hide file tree
Showing 19 changed files with 1,465 additions and 2 deletions.
23 changes: 23 additions & 0 deletions browsing.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import (
"math/rand"
"os/exec"
"time"
)

func browseWebsites(config *Config) {
logger := logMultiWriter(config.General.LogFile)

websites := selectRandomOrHardcoded(config.Websites.Options, config.Websites.SelectionMethod)
for _, website := range websites {
cmd := exec.Command("cmd", "/C", "start", website)
err := cmd.Run()
if err != nil {
logger.Printf("Failed to browse %s: %v", website, err)
} else {
logger.Printf("Browsing %s", website)
}
time.Sleep(time.Duration(config.General.ActionDelay+rand.Intn(2*config.General.RandomnessFactor+1)-config.General.RandomnessFactor) * time.Second)
}
}
155 changes: 155 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
package main

import (
"io/ioutil"

"gopkg.in/yaml.v2"
)

type Config struct {
Applications StringSelection `yaml:"applications"`
Websites StringSelection `yaml:"websites"`
Preferences Preferences `yaml:"preferences"`
StartMenuItems StringSelection `yaml:"start_menu_items"`
FileOperations FileOperations `yaml:"file_operations"`
EmailOperations EmailOperations `yaml:"email_operations"`
SoftwareManagement StringSelection `yaml:"software_management"`
SystemUpdates SystemUpdates `yaml:"system_updates"`
UserAccounts []UserAccount `yaml:"user_accounts"`
NetworkSettings []Network `yaml:"network_settings"`
SystemLogs StringSelection `yaml:"system_logs"`
MediaFiles MediaLocation `yaml:"media_files"`
Printing StringSelection `yaml:"printing"`
ScheduledTasks ScheduledTaskSelection `yaml:"scheduled_tasks"`
DecoyFiles DecoyFiles `yaml:"decoy_files"`
Lures []LureConfig `yaml:"lures"`
General GeneralConfig `yaml:"general"`
}

type StringSelection struct {
Options []string `yaml:"options"`
SelectionMethod string `yaml:"selection_method"`
}

type ScheduledTaskSelection struct {
Options []ScheduledTask `yaml:"options"`
SelectionMethod string `yaml:"selection_method"`
}

type Preferences struct {
DefaultBrowser StringSelection `yaml:"default_browser"`
BackgroundImages MediaLocation `yaml:"background_images"`
ScreenResolutions StringSelection `yaml:"screen_resolutions"`
Languages StringSelection `yaml:"languages"`
}

type FileOperations struct {
CreateModifyFiles []FileOperation `yaml:"create_modify_files"`
}

type FileOperation struct {
Path string `yaml:"path"`
Content string `yaml:"content"`
UseGPT bool `yaml:"use_gpt"`
GPTPrompt string `yaml:"gpt_prompt"`
}

type EmailOperations struct {
GoogleAccount EmailAccount `yaml:"google_account"`
MicrosoftAccount EmailAccount `yaml:"microsoft_account"`
SendReceive []EmailOperation `yaml:"send_receive"`
}

type EmailAccount struct {
Email string `yaml:"email"`
Password string `yaml:"password"`
}

type EmailOperation struct {
SendTo string `yaml:"send_to"`
Subject string `yaml:"subject"`
Body string `yaml:"body"`
UseGPT bool `yaml:"use_gpt"`
GPTPrompt string `yaml:"gpt_prompt"`
}

type MediaLocation struct {
Location string `yaml:"location"`
Type string `yaml:"type"`
SelectionMethod string `yaml:"selection_method"`
Options []string `yaml:"options"`
}

type DecoyFiles struct {
Sets []DecoyFileSet `yaml:"sets"`
}

type DecoyFileSet struct {
Location []string `yaml:"location"`
Type string `yaml:"type"`
TargetDirectory []string `yaml:"target_directory"`
SelectionMethod string `yaml:"selection_method"`
}

type UserAccount struct {
Name string `yaml:"name"`
Password string `yaml:"password"`
FullName string `yaml:"full_name"`
Description string `yaml:"description"`
}

type Network struct {
SSID string `yaml:"ssid"`
Password string `yaml:"password"`
}

type ScheduledTask struct {
Name string `yaml:"name"`
Path string `yaml:"path"`
Schedule string `yaml:"schedule"`
StartTime string `yaml:"start_time"`
}

type LureConfig struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Location string `yaml:"location"`
GenerationParams map[string]interface{} `yaml:"generation_params"`
GenerativeType string `yaml:"generative_type"`
OpenaiPrompt string `yaml:"openai_prompt,omitempty"`
Responder string `yaml:"responder,omitempty"`
}

type SystemUpdates struct {
Method string `yaml:"method"`
SpecificUpdates []string `yaml:"specific_updates,omitempty"`
SelectionMethod string `yaml:"selection_method"`
HideUpdates []string `yaml:"hide_updates,omitempty"`
}

type GeneralConfig struct {
Redis struct {
IP string `yaml:"ip"`
Port int `yaml:"port"`
} `yaml:"redis"`
LogFile string `yaml:"log_file,omitempty"`
OpenaiApiKey string `yaml:"openai_api_key,omitempty"`
InteractionDuration int `yaml:"interaction_duration"`
ActionDelay int `yaml:"action_delay"`
RandomnessFactor int `yaml:"randomness_factor"`
Usernames []string `yaml:"usernames"`
SelectionMethod string `yaml:"selection_method"`
}

func loadConfig(filename string) (*Config, error) {
data, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
var config Config
err = yaml.Unmarshal(data, &config)
if err != nil {
return nil, err
}
return &config, nil
}
38 changes: 38 additions & 0 deletions email.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package main

import (
"fmt"
"net/smtp"
)

func sendEmails(config *Config) {
for _, emailOp := range config.EmailOperations.SendReceive {
var body string
if emailOp.UseGPT {
body = generateContentUsingGPT(config.General.OpenaiApiKey, emailOp.GPTPrompt, config)
} else {
body = emailOp.Body
}
sendEmail(config.EmailOperations.GoogleAccount, emailOp.SendTo, emailOp.Subject, body, config)
}
}

func sendEmail(account EmailAccount, to, subject, body string, config *Config) {
from := account.Email
password := account.Password

msg := "From: " + from + "\n" +
"To: " + to + "\n" +
"Subject: " + subject + "\n\n" +
body

err := smtp.SendMail("smtp.gmail.com:587",
smtp.PlainAuth("", from, password, "smtp.gmail.com"),
from, []string{to}, []byte(msg))

if err != nil {
logToFile(config.General.LogFile, fmt.Sprintf("Failed to send email: %v", err))
} else {
logToFile(config.General.LogFile, fmt.Sprintf("Email sent to %s", to))
}
}
12 changes: 11 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@ module sinon
go 1.18

require (
github.com/fsnotify/fsnotify v1.7.0
github.com/go-redis/redis/v8 v8.11.5
golang.org/x/net v0.26.0
github.com/iamacarpet/go-win64api v0.0.0-20240507095429-873e84e85847
github.com/pkg/sftp v1.13.6
golang.org/x/crypto v0.24.0
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/google/cabbie v1.0.2 // indirect
github.com/google/glazier v0.0.0-20211029225403-9f766cca891d // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.21.0 // indirect
)
Loading

0 comments on commit 8317aa0

Please sign in to comment.