Skip to content

Commit

Permalink
Merge pull request #1 from nezzzumi/feat/add-dbms
Browse files Browse the repository at this point in the history
feat: add other dbms
  • Loading branch information
nezzzumi authored Jan 18, 2023
2 parents 54b8bb3 + 5832f03 commit 3fcadb1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This tool dumps Navicat database connections stored in the computer registries,
## TODO

- [ ] Test with other types of DBMS.
- [x] Test with other types of DBMS.

## References

Expand Down
37 changes: 24 additions & 13 deletions navicat-dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,37 @@ func main() {

rights := registry.QUERY_VALUE | registry.ENUMERATE_SUB_KEYS
allServers := []Server{}
dbmsPaths := []string{
`\SOFTWARE\PremiumSoft\Navicat\Servers\`, // MySQL
`\SOFTWARE\PremiumSoft\NavicatMARIADB\Servers\`, // MariaDB
`\SOFTWARE\PremiumSoft\NavicatMONGODB\Servers\`, // MONGODB
`\SOFTWARE\PremiumSoft\NavicatMSSQL\Servers\`, // SQL SERVER
`\SOFTWARE\PremiumSoft\NavicatOra\Servers\`, // Oracle
`\SOFTWARE\PremiumSoft\NavicatPG\Servers\`, // PostgreSQL
`\SOFTWARE\PremiumSoft\NavicatSQLite\Servers\`, // SQLite
}

for _, subKey := range subKeys {
keyPath := subKey + `\SOFTWARE\PremiumSoft\Navicat\Servers\`
for _, dbmsPath := range dbmsPaths {
for _, subKey := range subKeys {
keyPath := subKey + dbmsPath

key, err := registry.OpenKey(registry.USERS, keyPath, uint32(rights))
key, err := registry.OpenKey(registry.USERS, keyPath, uint32(rights))

if err != nil {
continue
}
if err != nil {
continue
}

servers, err := key.ReadSubKeyNames(-1)
servers, err := key.ReadSubKeyNames(-1)

if err != nil {
continue
}
if err != nil {
continue
}

for _, serverName := range servers {
allServers = append(allServers, NewServer(serverName, keyPath+serverName))
}
for _, serverName := range servers {
allServers = append(allServers, NewServer(serverName, keyPath+serverName))
}

}
}

for _, server := range allServers {
Expand Down

0 comments on commit 3fcadb1

Please sign in to comment.