| skipped 4 lines |
5 | 5 | | "fmt" |
6 | 6 | | "github.com/SharokhAtaie/extractify/scanner" |
7 | 7 | | "github.com/go-resty/resty/v2" |
| 8 | + | "github.com/logrusorgru/aurora/v4" |
8 | 9 | | "github.com/projectdiscovery/goflags" |
9 | 10 | | "github.com/projectdiscovery/gologger" |
10 | 11 | | fileutil "github.com/projectdiscovery/utils/file" |
| skipped 62 lines |
73 | 74 | | gologger.Info().Msgf("Processing %s", opt.file) |
74 | 75 | | secrets, urls, endpoints, parameters := Run(bin, opt.file) |
75 | 76 | | |
76 | | - | HandleResults(opt.endpoint, opt.parameter, opt.urls, opt.secret, opt.all, secrets, urls, endpoints, parameters) |
| 77 | + | HandleResults(opt.endpoint, opt.parameter, opt.urls, opt.secret, opt.all, secrets, urls, endpoints, parameters, opt.file) |
77 | 78 | | return |
78 | 79 | | } |
79 | 80 | | |
| skipped 25 lines |
105 | 106 | | gologger.Error().Msgf("%s [%s]\n\n", err, url) |
106 | 107 | | continue |
107 | 108 | | } |
108 | | - | gologger.Info().Msgf("Processing %s\n\n", url) |
109 | 109 | | |
110 | 110 | | secrets, urls, endpoints, parameters := Run(Data, url) |
111 | 111 | | |
112 | | - | HandleResults(opt.endpoint, opt.parameter, opt.urls, opt.secret, opt.all, secrets, urls, endpoints, parameters) |
| 112 | + | HandleResults(opt.endpoint, opt.parameter, opt.urls, opt.secret, opt.all, secrets, urls, endpoints, parameters, url) |
113 | 113 | | } |
114 | 114 | | } |
115 | 115 | | |
| skipped 19 lines |
135 | 135 | | return SecretMatchResult, sortedUrls, sortedEndpoints, sUtils.Dedupe(ParameterMatchResults) |
136 | 136 | | } |
137 | 137 | | |
138 | | - | func HandleResults(endpoint, parameter, url, secret, all bool, secrets []scanner.SecretMatched, urls, endpoints, parameters []string) { |
| 138 | + | func HandleResults(endpoint, parameter, url, secret, all bool, secrets []scanner.SecretMatched, urls, endpoints, parameters []string, input string) { |
139 | 139 | | if endpoint { |
140 | | - | HandleEndpoint(endpoints) |
| 140 | + | HandleEndpoint(endpoints, input) |
141 | 141 | | } else if parameter { |
142 | | - | HandleParameter(parameters) |
| 142 | + | HandleParameter(parameters, input) |
143 | 143 | | } else if url { |
144 | | - | HandleURL(urls) |
| 144 | + | HandleURL(urls, input) |
145 | 145 | | } else if secret { |
146 | | - | HandleSecret(secrets) |
| 146 | + | HandleSecret(secrets, input) |
147 | 147 | | } else if all { |
148 | | - | HandleSecret(secrets) |
149 | | - | HandleURL(urls) |
150 | | - | HandleEndpoint(endpoints) |
151 | | - | HandleParameter(parameters) |
| 148 | + | HandleSecret(secrets, input) |
| 149 | + | HandleURL(urls, input) |
| 150 | + | HandleEndpoint(endpoints, input) |
| 151 | + | HandleParameter(parameters, input) |
152 | 152 | | } else { |
153 | | - | HandleSecret(secrets) |
| 153 | + | HandleSecret(secrets, input) |
154 | 154 | | } |
155 | 155 | | } |
156 | 156 | | |
157 | | - | func HandleSecret(secrets []scanner.SecretMatched) { |
| 157 | + | func HandleSecret(secrets []scanner.SecretMatched, input string) { |
158 | 158 | | if len(secrets) > 0 { |
159 | | - | gologger.Info().Msgf("Secrets") |
| 159 | + | fmt.Printf("[%s] Secrets %s\n", aurora.Blue("INF"), input) |
160 | 160 | | for _, secret := range secrets { |
161 | | - | fmt.Printf("Name: %s\nMatch: %s\n\n", secret.Secret.Name, secret.Match) |
| 161 | + | fmt.Printf("%s: %s\n%s: %s\n\n", aurora.Green("Name"), secret.Secret.Name, aurora.Green("Match"), secret.Match) |
162 | 162 | | } |
163 | 163 | | } else { |
164 | | - | gologger.Info().Msgf("No results for Secrets\n\n") |
| 164 | + | gologger.Info().Msgf("%s \nNo results for Secrets\n\n", input) |
165 | 165 | | } |
166 | 166 | | } |
167 | 167 | | |
168 | | - | func HandleEndpoint(endpoints []string) { |
| 168 | + | func HandleEndpoint(endpoints []string, input string) { |
169 | 169 | | if len(endpoints) > 0 { |
170 | | - | gologger.Info().Msgf("Endpoints") |
| 170 | + | fmt.Printf("[%s] Endpoints %s\n", aurora.Blue("INF"), input) |
171 | 171 | | for _, endpoint := range endpoints { |
172 | 172 | | fmt.Println(endpoint) |
173 | 173 | | } |
174 | 174 | | fmt.Println("") |
175 | 175 | | } else { |
176 | | - | gologger.Info().Msgf("No results for Endpoints\n\n") |
| 176 | + | gologger.Info().Msgf("%s \nNo results for Endpoints\n\n", input) |
177 | 177 | | } |
178 | 178 | | } |
179 | 179 | | |
180 | | - | func HandleURL(urls []string) { |
| 180 | + | func HandleURL(urls []string, input string) { |
181 | 181 | | if len(urls) > 0 { |
182 | | - | gologger.Info().Msgf("Urls") |
| 182 | + | fmt.Printf("[%s] URLs %s\n", aurora.Blue("INF"), input) |
183 | 183 | | for _, URL := range urls { |
184 | 184 | | fmt.Println(URL) |
185 | 185 | | } |
186 | 186 | | fmt.Println("") |
187 | 187 | | } else { |
188 | | - | gologger.Info().Msgf("No results for URLs\n\n") |
| 188 | + | gologger.Info().Msgf("%s \nNo results for URLs\n\n", input) |
189 | 189 | | } |
190 | 190 | | } |
191 | 191 | | |
192 | | - | func HandleParameter(parameters []string) { |
| 192 | + | func HandleParameter(parameters []string, input string) { |
193 | 193 | | if len(parameters) > 0 { |
194 | | - | gologger.Info().Msgf("Parameters") |
| 194 | + | fmt.Printf("[%s] Parameters %s\n", aurora.Blue("INF"), input) |
195 | 195 | | for _, param := range parameters { |
196 | 196 | | fmt.Println(param) |
197 | 197 | | } |
198 | 198 | | fmt.Println("") |
199 | 199 | | } else { |
200 | | - | gologger.Info().Msgf("No results for Parameters\n\n") |
| 200 | + | gologger.Info().Msgf("%s \nNo results for Parameters\n\n", input) |
201 | 201 | | } |
202 | 202 | | } |
203 | 203 | | |
| skipped 59 lines |