Skip to content

Commit a6d2532

Browse files
committed
multi-platform and setup via go install
1 parent ec995be commit a6d2532

File tree

5 files changed

+68
-29
lines changed

5 files changed

+68
-29
lines changed

Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ default: build
44

55
build:
66
mkdir -p ./build
7-
go build -o ./build/mbtc ./
8-
strip -x ./build/mbtc
7+
go build -o ./build/maltego-btc ./
8+
strip -x ./build/maltego-btc
99

1010
install:
1111
@echo "Maltego directory: $(install_dir)"
12-
@cp -vf ./build/mbtc /usr/local/bin/mbtc
13-
@cp -vf ./config.json /usr/local/etc/mbtc.conf
14-
12+
@cp -vf ./build/maltego-btc /usr/local/bin/maltego-btc
1513

1614
.PHONY: build

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,33 @@ Set of Maltego transforms written in Go for Bitcoin addresses/wallets investigat
55
### Installation
66

77
Requirements:
8-
98
- Maltego 4.0 or higher
109
- Go 1.8+
1110

12-
Clone repository locally and run: ```make && make install``` (tested under macOS Sierra only for now).
11+
Installation:
12+
- Do `go install github.com/Megarushing/maltego-btc@latest`
13+
- Download [maltego-btc.mtz] (https://github.com/Megarushing/maltego-btc/raw/master/maltego-btc.mtz)
14+
- In Maltego go to Import | Export > Import Config
15+
- Point to the downloaded file and import all transforms, entities and icons
16+
- Important: Edit each Transform BTC command line to include your path to maltego-btc, this is usually `(User Folder)/go/bin/maltego-btc`
17+
18+
Recommended:
19+
- I recommend also installing maltegos library standard blockchain.com transform to use alongside
1320

1421
### Config options
1522

1623
Edit config.json and re-run installation commands. List of config options:
1724

1825
- ```logfile``` – path to logfile
19-
- ```redis_url```Redis connection string (host:port)
20-
- ```link_default``` – color of arrows from wallets and addresses
21-
- ```link_service``` – color of arrows from large services
22-
- ```wallet_max_size``` – max count of transactions to distinguish personal wallets and large services (default 2000)
26+
- ```cachefile```path to cache file
27+
- ```link_address_color``` – color of arrows from wallets and addresses
28+
- ```link_wallet_color``` – color of arrows from wallets to wallets
29+
- ```wallet_max_size``` – max count of transactions to download from api in one go
2330
- ```cache_addresses``` – max number of addresses to cache
2431
- ```cache_wallets``` – max number of wallets to cache
2532
- ```icon_address``` – url to address entity icon
2633
- ```icon_wallet``` – url to wallet entity icon
2734
- ```icon_service``` – url to service entity icon
28-
}
2935

3036
### Screenshots
3137

config.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

main.go

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,37 @@ var (
1414
Type string
1515
path string
1616
help bool
17-
defConfig string = "/usr/local/etc/mbtc.conf"
17+
defFolder string = "maltego-btc"
1818
)
1919

2020
func main() {
21-
// parse flags and config
21+
// makes config folder
22+
appconfig, _ := os.UserConfigDir()
23+
_ = os.MkdirAll(appconfig+
24+
string(os.PathSeparator)+
25+
defFolder, 0755)
26+
// if path is defined use it, otherwise fall back to default
27+
LogFile := config.LogFile
28+
if LogFile == "" {
29+
LogFile = appconfig +
30+
string(os.PathSeparator) +
31+
defFolder +
32+
string(os.PathSeparator) +
33+
"maltego-btc.log"
34+
}
35+
CacheFile := config.CacheFile
36+
if CacheFile == "" {
37+
LogFile = appconfig +
38+
string(os.PathSeparator) +
39+
defFolder +
40+
string(os.PathSeparator) +
41+
"maltego-btc.cache"
42+
}
2243
argc := parseArgs()
2344
config = ParseConfig(path)
2445

2546
// enable logging
26-
f, err := os.OpenFile(config.LogFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
47+
f, err := os.OpenFile(LogFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
2748
if err != nil {
2849
fmt.Println("Error: %v", err)
2950
os.Exit(1)
@@ -32,20 +53,46 @@ func main() {
3253
log.SetOutput(f)
3354

3455
if argc >= 3 {
35-
LoadCache(config.CacheFile)
56+
LoadCache(CacheFile)
3657
list := GetTransform(query, Type)
3758

3859
FilterTransform(query, Type, &list)
3960
PrintTransform(&list)
4061
CacheGC()
41-
SaveCache(config.CacheFile)
62+
SaveCache(CacheFile)
4263
} else {
4364
flag.PrintDefaults()
4465
os.Exit(1)
4566
}
4667
}
4768

4869
func parseArgs() (argc int) {
70+
appconfig, _ := os.UserConfigDir()
71+
defConfig := appconfig +
72+
string(os.PathSeparator) +
73+
defFolder +
74+
string(os.PathSeparator) +
75+
"maltego-btc.conf"
76+
77+
configTemplate := `
78+
{
79+
"logfile": "",
80+
"cachefile": "",
81+
"link_address_color": "#B0BEC5",
82+
"link_wallet_color": "#107896",
83+
"wallet_max_size": 5000,
84+
"cache_addresses": 1000,
85+
"cache_wallets": 5000,
86+
"icon_address": "https://raw.githubusercontent.com/Megarushing/maltego-btc/master/assets/bitcoin.png",
87+
"icon_wallet": "https://raw.githubusercontent.com/Megarushing/maltego-btc/master/assets/wallet.png",
88+
"icon_service": "https://raw.githubusercontent.com/Megarushing/maltego-btc/master/assets/service.png"
89+
}
90+
`
91+
if _, err := os.Stat(defConfig); err != nil {
92+
f, _ := os.Create(defConfig)
93+
f.WriteString(configTemplate)
94+
f.Close()
95+
}
4996
// parse flags
5097
flag.StringVar(&path, "c", defConfig, "Path to config file")
5198
flag.BoolVar(&help, "h", false, "Print Help")

maltego-btc.mtz

-48 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)