github.com/iDigitalFlame/xmt@v0.5.4/examples/example_shellcode.go (about)

     1  // Copyright (C) 2020 - 2023 iDigitalFlame
     2  //
     3  // This program is free software: you can redistribute it and/or modify
     4  // it under the terms of the GNU General Public License as published by
     5  // the Free Software Foundation, either version 3 of the License, or
     6  // any later version.
     7  //
     8  // This program is distributed in the hope that it will be useful,
     9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  // GNU General Public License for more details.
    12  //
    13  // You should have received a copy of the GNU General Public License
    14  // along with this program.  If not, see <https://www.gnu.org/licenses/>.
    15  //
    16  
    17  package main
    18  
    19  import (
    20  	"fmt"
    21  	"time"
    22  
    23  	"github.com/iDigitalFlame/xmt/cmd"
    24  	"github.com/iDigitalFlame/xmt/cmd/filter"
    25  )
    26  
    27  func exampleShellcode() {
    28  	c := &cmd.Assembly{
    29  		Data: []byte{},
    30  	}
    31  
    32  	c.Timeout = 3 * time.Second
    33  	c.SetParent(filter.Random)
    34  
    35  	if err := c.Start(); err != nil {
    36  		panic(err)
    37  	}
    38  
    39  	fmt.Println(c.Wait())
    40  	fmt.Println(c.ExitCode())
    41  }