Skip to content

Commit

Permalink
update 1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
qiwentaidi committed Jun 11, 2024
1 parent cb08bab commit 052db85
Show file tree
Hide file tree
Showing 25 changed files with 183 additions and 302 deletions.
Binary file modified .DS_Store
Binary file not shown.
50 changes: 27 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ wails dev || wails build
> Executing: go mod tidy
> • Generating bindings:
> ERROR
> package slack-wails
> imports slack-wails/core/portscan
> imports github.com/tomatome/grdp/protocol/pdu
> imports github.com/tomatome/grdp/protocol/t125/gcc
> imports github.com/tomatome/grdp/plugin: build constraints exclude all Go files in C:\xx\go\pkg\mod\github.com\tomatome\grdp@v0.1.0\plugin
> package slack-wails
> imports slack-wails/core/portscan
> imports github.com/tomatome/grdp/protocol/pdu
> imports github.com/tomatome/grdp/protocol/t125/gcc
> imports github.com/tomatome/grdp/plugin: build constraints exclude all Go files in C:\xx\go\pkg\mod\github.com\tomatome\grdp@v0.1.0\plugin
> ```
>
> A:
Expand All @@ -151,36 +151,40 @@ wails dev || wails build
> ``````
> # Building target: linux/amd64
>
> • Generating bindings: ERROR
> # github.com/google/gopacket/pcap
> /root/go/pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap_unix.go:34:10: fatal error: pcap.h: No such file or directory
> 34 | #include <pcap.h>
> | ^~~~~~~~
> compilation terminated.
>
> exit status 1
> • Generating bindings: ERROR
> # github.com/google/gopacket/pcap
> /root/go/pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap_unix.go:34:10: fatal error: pcap.h: No such file or directory
> 34 | #include <pcap.h>
> | ^~~~~~~~
> compilation terminated.
>
> ERROR
> # github.com/google/gopacket/pcap
> /root/go/pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap_unix.go:34:10: fatal error: pcap.h: No such file or directory
> 34 | #include <pcap.h>
> | ^~~~~~~~
> compilation terminated.
>
> exit status 1
> ♥ If Wails is useful to you or your company, please consider sponsoring the project:
> exit status 1
>
> ERROR
> # github.com/google/gopacket/pcap
> /root/go/pkg/mod/github.com/google/gopacket@v1.1.19/pcap/pcap_unix.go:34:10: fatal error: pcap.h: No such file or directory
> 34 | #include <pcap.h>
> | ^~~~~~~~
> compilation terminated.
>
> exit status 1
> ♥ If Wails is useful to you or your company, please consider sponsoring the project:
> https://github.com/sponsors/leaanthony
> ``````
>
> A:
>
> ``````shell
> sudo apt install libpcap-dev
> ``````
>
> Q: Mac 启动出现安装包损坏
>
> A:
>
> ``````
> 1、在隐私和安全性处运行安装应用为任意来源
> 2、执行 xattr -c slack-wails_darwin.app
> 2、执行 xattr -c slack-macos.app
> ``````
# 联系方式
Expand Down
54 changes: 15 additions & 39 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,7 @@ func (a *App) GoFetch(method, target, body string, headers []map[string]string,

// fscan
func (a *App) Fscan2Txt(content string) string {
var result string
result += "[NetInfo]\n"
for _, netinfo := range core.NetInfoReg.FindAllString(content, -1) {
result += netinfo + "\n"
}
result += "\n"
lines := strings.Split(content, "\n")
for name, reg := range core.FscanRegs {
result += core.MatchLine(name, reg, lines)
}
return result
return core.ExtractFscanResult(content)
}

// thinkdict
Expand Down Expand Up @@ -181,35 +171,21 @@ func (a *App) ExtractIP(text string) string {
}

func (a *App) DomainInfo(text string) string {
s, s2, s3 := core.SeoChinaz(text)
s4, s5, s6, s7, s8, s9 := core.WhoisChinaz(text)
name, icp, ip := core.SeoChinaz(a.ctx, text)
return fmt.Sprintf(`---备案查询---
公司名称: %v
备案号: %v
IP: %v
---whois查询---
更新时间: %v
创建时间: %v
过期时间: %v
注册商服务器: %v
DNS: %v
状态: %v`, s, s2, s3, s4, s5, s6, s7, s8, s9)
IP: %v`, name, icp, ip)
}

func (a *App) CheckCdn(domain string) string {
var result string
ips, cnames, err := core.Resolution(domain, 10)
if err == nil {
if len(cnames) != 0 {
for name, cdns := range core.ReadCDNFile(a.cdnFile) {
for name, cdns := range core.ReadCDNFile(a.ctx, a.cdnFile) {
for _, cdn := range cdns {
for _, cname := range cnames {
if strings.Contains(cname, cdn) { // 识别到cdn
Expand Down Expand Up @@ -239,7 +215,7 @@ func (a *App) LoadSubDict(configPath string) []string {
}

func (a *App) Subdomain(subdomain string, timeout int) []string {
sr := core.BurstSubdomain(subdomain, timeout, a.qqwryFile, a.cdnFile)
sr := core.BurstSubdomain(a.ctx, subdomain, timeout, a.qqwryFile, a.cdnFile)
return []string{sr.Subdomain, strings.Join(sr.Cname, " | "), strings.Join(sr.Ips, " | "), sr.Notes}
}

Expand All @@ -253,13 +229,13 @@ type TycAssetResult struct {
}

// mode 0 = 查询子公司 . mode 1 = 查询公众号
func (*App) SubsidiariesAndDomains(companyName string, ratio int) TycAssetResult {
func (a *App) SubsidiariesAndDomains(companyName string, ratio int) TycAssetResult {
var isFuzz string
companyId, fuzzName := info.GetCompanyID(companyName) // 获得到一个模糊匹配后,关联度最高的名称
if companyName != fuzzName { // 如果传进来的名称与模糊匹配的不相同
companyId, fuzzName := info.GetCompanyID(a.ctx, companyName) // 获得到一个模糊匹配后,关联度最高的名称
if companyName != fuzzName { // 如果传进来的名称与模糊匹配的不相同
isFuzz = fmt.Sprintf("天眼查模糊匹配名称为%v ——> %v,已替换原有名称进行查.", companyName, fuzzName)
}
asset, logs := info.SearchSubsidiary(fuzzName, companyId, ratio)
asset, logs := info.SearchSubsidiary(a.ctx, fuzzName, companyId, ratio)
if isFuzz == "" {
logs = isFuzz + logs
}
Expand All @@ -277,8 +253,8 @@ type WechatAssetResult struct {

func (a *App) WechatOfficial(companyName string) WechatAssetResult {
var isFuzz string
companyId, fuzzName := info.GetCompanyID(companyName) // 获得到一个模糊匹配后,关联度最高的名称
if companyName != fuzzName { // 如果传进来的名称与模糊匹配的不相同
companyId, fuzzName := info.GetCompanyID(a.ctx, companyName) // 获得到一个模糊匹配后,关联度最高的名称
if companyName != fuzzName { // 如果传进来的名称与模糊匹配的不相同
isFuzz = fmt.Sprintf("天眼查模糊匹配名称为%v ——> %v,已替换原有名称进行查.", companyName, fuzzName)
}
asset, logs := info.WeChatOfficialAccounts(fuzzName, companyId)
Expand Down Expand Up @@ -426,7 +402,7 @@ func (a *App) FofaTips(query string) *space.TipsResult {
}

func (a *App) FofaSearch(query, pageSzie, pageNum, address, email, key string, fraud, cert bool) *space.FofaSearchResult {
return space.FofaApiSearch(query, pageSzie, pageNum, address, email, key, fraud, cert)
return space.FofaApiSearch(a.ctx, query, pageSzie, pageNum, address, email, key, fraud, cert)
}

func (a *App) Sock5Connect(ip string, port, timeout int, username, password string) bool {
Expand Down Expand Up @@ -558,13 +534,13 @@ func (a *App) HunterSearch(api, query, pageSize, pageNum, times, asset string, d
}

func (a *App) JSFind(target, customPrefix string) (fs *jsfind.FindSomething) {
jsLinks := jsfind.ExtractJS(target)
jsLinks := jsfind.ExtractJS(a.ctx, target)
var wg sync.WaitGroup
limiter := make(chan bool, 100)
wg.Add(1)
limiter <- true
go func() {
fs = jsfind.FindInfo(target, limiter, &wg)
fs = jsfind.FindInfo(a.ctx, target, limiter, &wg)
}()
wg.Wait()
u, _ := url.Parse(target)
Expand All @@ -580,7 +556,7 @@ func (a *App) JSFind(target, customPrefix string) (fs *jsfind.FindSomething) {
limiter <- true
go func(js string) {
newURL := host + "/" + js
fs2 := jsfind.FindInfo(newURL, limiter, &wg)
fs2 := jsfind.FindInfo(a.ctx, newURL, limiter, &wg)
fs.IP_URL = append(fs.IP_URL, fs2.IP_URL...)
fs.ChineseIDCard = append(fs.ChineseIDCard, fs2.ChineseIDCard...)
fs.ChinesePhone = append(fs.ChinesePhone, fs2.ChinesePhone...)
Expand Down
Binary file modified build/.DS_Store
Binary file not shown.
46 changes: 30 additions & 16 deletions core/fscan2txt.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,40 @@ import (

var (
FscanRegs = map[string][]string{
"FTP": {"[+] ftp"},
"SSH": {"[+] SSH"},
"Mssql": {"[+] mssql"},
"Oracle": {"[+] oracle"},
"Mysql": {"[+] mysql"},
"RDP": {"[+] RDP"},
"Redis": {"[+] Redis"},
"Postgres": {"[+] Postgres"},
"Mongodb": {"[+] Mongodb"},
"Memcached": {"[+] Memcached"},
"MS17-010": {"[+] MS17-010"},
"POC": {"poc"},
"DC INFO": {"DC"},
"INFO": {"[+] InfoScan"},
"Vcenter": {"ID_VC_Welcome"},
"Camera": {"len:2512", "len:600", "len:481", "len:480"},
"FTP": {"[+] ftp"},
"SSH": {"[+] SSH"},
"Mssql": {"[+] mssql"},
"Oracle": {"[+] oracle"},
"Mysql": {"[+] mysql"},
"RDP": {"[+] RDP"},
"Redis": {"[+] Redis"},
"Postgres": {"[+] Postgres"},
"Mongodb": {"[+] Mongodb"},
"Memcached": {"[+] Memcached"},
"MS17-010": {"[+] MS17-010"},
"POC": {"poc"},
"DC INFO": {"DC"},
"INFO": {"[+] InfoScan"},
"Vcenter": {"ID_VC_Welcome"},
"Hikvison-Camera": {"len:2512", "len:600", "len:481", "len:480"},
}
NetInfoReg = regexp.MustCompile(`\[\*]((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}(\s+\[\-\>](\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[a-zA-Z0-9\-]+))+`)
)

func ExtractFscanResult(content string) string {
var result string
result += "[NetInfo]\n"
for _, netinfo := range NetInfoReg.FindAllString(content, -1) {
result += netinfo + "\n"
}
result += "\n"
lines := strings.Split(content, "\n")
for name, reg := range FscanRegs {
result += MatchLine(name, reg, lines)
}
return result
}

func MatchLine(name string, contains, lines []string) string {
var temp []string
var result string
Expand Down
12 changes: 7 additions & 5 deletions core/info/tianyancha.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package info

import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"regexp"
"slack-wails/lib/clients"
"slack-wails/lib/gologger"
"slack-wails/lib/util"
"time"

Expand Down Expand Up @@ -113,18 +115,18 @@ func InitHEAD(token string) {
}

// 要根据ID值查子公司
func GetCompanyID(company string) (string, string) {
func GetCompanyID(ctx context.Context, company string) (string, string) {
var max, id int
data := make(map[string]interface{})
data["keyword"] = company
bytesData, _ := json.Marshal(data)
_, b, err := clients.NewRequest("POST", "https://capi.tianyancha.com/cloud-tempest/search/suggest/v3", posthead, bytes.NewReader(bytesData), 10, true, clients.DefaultClient())
if err != nil {
logger.NewDefaultLogger().Debug(err.Error())
gologger.Error(ctx, err)
}
var qs TycSearchID
if err = json.Unmarshal(b, &qs); err != nil {
logger.NewDefaultLogger().Debug(err.Error())
gologger.Error(ctx, err)
}
time.Sleep(time.Second * 2)
if len(qs.Data) > 0 { // 先走接口不会进行模糊匹配,如果匹配不到值那就走模糊查询
Expand Down Expand Up @@ -164,7 +166,7 @@ type CompanyInfo struct {
}

// 返回查询公司的名称和子公司的名称
func SearchSubsidiary(companyName, companyId string, ratio int) (holdasset []CompanyInfo, logs string) {
func SearchSubsidiary(ctx context.Context, companyName, companyId string, ratio int) (holdasset []CompanyInfo, logs string) {
data := make(map[string]interface{})
data["gid"] = companyId
data["pageSize"] = 100
Expand All @@ -175,7 +177,7 @@ func SearchSubsidiary(companyName, companyId string, ratio int) (holdasset []Com
bytesData, _ := json.Marshal(data)
_, b, err := clients.NewRequest("POST", "https://capi.tianyancha.com/cloud-company-background/company/investListV2", posthead, bytes.NewReader(bytesData), 10, true, clients.DefaultClient())
if err != nil {
logger.NewDefaultLogger().Debug(err.Error())
gologger.Error(ctx, err)
}
var qr TycResult
json.Unmarshal(b, &qr)
Expand Down
3 changes: 2 additions & 1 deletion core/info/tianyancha_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package info

import (
"context"
"fmt"
"testing"
)
Expand All @@ -9,7 +10,7 @@ func TestXxx(t *testing.T) {
token := ""
InitHEAD(token)
companyName := "杭州福斯达深冷装备股份有限公司"
companyId, fuzzName := GetCompanyID(companyName) // 获得到一个模糊匹配后,关联度最高的名称
companyId, fuzzName := GetCompanyID(context.TODO(), companyName) // 获得到一个模糊匹配后,关联度最高的名称
fmt.Printf("fuzzName: %v\n", fuzzName)
fmt.Printf("companyId: %v\n", companyId)
}
Loading

0 comments on commit 052db85

Please sign in to comment.