Projects STRLCPY reverse_ssh Commits 53e19199
🤬
  • ■ ■ ■ ■ ■
    internal/client/client.go
    skipped 1 lines
    2 2   
    3 3  import (
    4 4   "bytes"
    5  - "encoding/json"
    6 5   "fmt"
    7 6   "io"
    8 7   "log"
    skipped 131 lines
    140 139   
    141 140   return nil
    142 141   },
    143  - ClientVersion: "SSH-" + internal.Version,
     142 + ClientVersion: "SSH-" + internal.Version + "-" + runtime.GOOS + "_" + runtime.GOARCH,
    144 143   }
    145 144   
    146 145   for { // My take on a golang do {} while loop :P
    skipped 31 lines
    178 177   case "kill":
    179 178   log.Println("Got kill command, goodbye")
    180 179   os.Exit(0)
    181  - 
    182  - case "info":
    183  - c := internal.ClientInfo{
    184  - GoOS: runtime.GOOS,
    185  - GoArch: runtime.GOARCH,
    186  - }
    187  - 
    188  - r, _ := json.Marshal(c)
    189  - err := req.Reply(true, r)
    190  - if err != nil {
    191  - continue
    192  - }
    193 180   
    194 181   case "[email protected]":
    195 182   req.Reply(false, nil)
    skipped 38 lines
  • ■ ■ ■ ■ ■
    internal/server/commands/list.go
    1 1  package commands
    2 2   
    3 3  import (
    4  - "encoding/json"
    5 4   "fmt"
    6 5   "io"
    7 6   "log"
    8 7   "sort"
    9 8   "strings"
    10 9   
    11  - "github.com/NHAS/reverse_ssh/internal"
    12 10   "github.com/NHAS/reverse_ssh/internal/server/clients"
    13 11   "github.com/NHAS/reverse_ssh/internal/terminal"
    14 12   "github.com/NHAS/reverse_ssh/internal/terminal/autocomplete"
    skipped 11 lines
    26 24   
    27 25  func fancyTable(tty io.ReadWriter, applicable []displayItem) {
    28 26   
    29  - t, _ := table.NewTable("Targets", "IDs", "Version", "Arch")
     27 + t, _ := table.NewTable("Targets", "IDs", "Version")
    30 28   for _, a := range applicable {
    31  - 
    32  - ok, result, err := a.sc.SendRequest("info", true, nil)
    33  - if err != nil {
    34  - continue
    35  - }
    36  - 
    37  - arch := "-"
    38  - if ok {
    39  - c := internal.ClientInfo{}
    40  - err = json.Unmarshal(result, &c)
    41  - if err == nil {
    42  - arch = c.GoOS + "_" + c.GoArch
    43  - }
    44  - }
    45 29   
    46 30   keyId := a.sc.Permissions.Extensions["pubkey-fp"]
    47 31   if a.sc.Permissions.Extensions["comment"] != "" {
    48 32   keyId = a.sc.Permissions.Extensions["comment"]
    49 33   }
    50 34   
    51  - if err := t.AddValues(fmt.Sprintf("%s\n%s\n%s\n%s\n", a.id, keyId, clients.NormaliseHostname(a.sc.User()), a.sc.RemoteAddr().String()), string(a.sc.ClientVersion()), arch); err != nil {
     35 + if err := t.AddValues(fmt.Sprintf("%s\n%s\n%s\n%s\n", a.id, keyId, clients.NormaliseHostname(a.sc.User()), a.sc.RemoteAddr().String()), string(a.sc.ClientVersion())); err != nil {
    52 36   log.Println("Error drawing pretty ls table (THIS IS A BUG): ", err)
    53 37   return
    54 38   }
    skipped 54 lines
    109 93   
    110 94   for i, tr := range toReturn {
    111 95   
    112  - ok, result, err := tr.sc.SendRequest("info", true, nil)
    113  - if err != nil {
    114  - continue
    115  - }
    116  - 
    117  - arch := "-"
    118  - if ok {
    119  - c := internal.ClientInfo{}
    120  - err = json.Unmarshal(result, &c)
    121  - if err == nil {
    122  - arch = c.GoOS + "_" + c.GoArch
    123  - }
    124  - }
    125  - 
    126 96   keyId := tr.sc.Permissions.Extensions["pubkey-fp"]
    127 97   if tr.sc.Permissions.Extensions["comment"] != "" {
    128 98   keyId = tr.sc.Permissions.Extensions["comment"]
    129 99   }
    130 100   
    131  - fmt.Fprintf(tty, "%s %s %s %s, version: %s arch: %s", tr.id, keyId, clients.NormaliseHostname(tr.sc.User()), tr.sc.RemoteAddr().String(), tr.sc.ClientVersion(), arch)
     101 + fmt.Fprintf(tty, "%s %s %s %s, version: %s", tr.id, keyId, clients.NormaliseHostname(tr.sc.User()), tr.sc.RemoteAddr().String(), tr.sc.ClientVersion())
    132 102   
    133 103   if i != len(toReturn)-1 {
    134 104   fmt.Fprint(tty, sep)
    skipped 28 lines
  • ■ ■ ■ ■
    internal/server/commands/watch.go
    skipped 24 lines
    25 25   arrowDirection = "->"
    26 26   }
    27 27   
    28  - messages <- fmt.Sprintf("%s %s %s (%s %s) %s", c.Timestamp.Format("2006/01/02 15:04:05"), arrowDirection, c.HostName, c.IP, c.ID, c.Status)
     28 + messages <- fmt.Sprintf("%s %s %s (%s %s) %s %s", c.Timestamp.Format("2006/01/02 15:04:05"), arrowDirection, c.HostName, c.IP, c.ID, c.Status, c.Version)
    29 29   
    30 30   })
    31 31   
    skipped 42 lines
  • ■ ■ ■ ■ ■
    internal/server/observers/observers.go
    skipped 12 lines
    13 13   ID string
    14 14   IP string
    15 15   HostName string
     16 + Version string
    16 17   Timestamp time.Time
    17 18  }
    18 19   
    19 20  func (cs ClientState) Summary() string {
    20  - return fmt.Sprintf("%s (%s) %s", cs.HostName, cs.ID, cs.Status)
     21 + return fmt.Sprintf("%s (%s) %s %s", cs.HostName, cs.ID, cs.Status, cs.Version)
    21 22  }
    22 23   
    23 24  func (cs ClientState) Json() ([]byte, error) {
    skipped 5 lines
  • ■ ■ ■ ■ ■ ■
    internal/server/sshd.go
    skipped 351 lines
    352 352   ID: id,
    353 353   IP: sshConn.RemoteAddr().String(),
    354 354   HostName: username,
     355 + Version: string(sshConn.ClientVersion()),
    355 356   Timestamp: time.Now(),
    356 357   })
    357 358   }()
    skipped 5 lines
    363 364   ID: id,
    364 365   IP: sshConn.RemoteAddr().String(),
    365 366   HostName: username,
     367 + Version: string(sshConn.ClientVersion()),
    366 368   Timestamp: time.Now(),
    367 369   })
    368 370   
    skipped 6 lines
Please wait...
Page is in error, reload to recover